[dpdk-dev] Common netlink parsing?

Andrzej Ostruszka [C] aostruszka at marvell.com
Mon Apr 27 13:43:58 CEST 2020


On 25/04/2020 21:24, Stephen Hemminger wrote:
> While adding error handling to tap device, I noticed we already have two
> places rolling their own netlink message handling (tap and mlx5) and now
> with proposed IF proxy there is a third.
> 
> Netlink is non-trivial and easy to get wrong and doing error handling
> also requires work. There should be a common library for this.

Right.  I was looking at this but eventually decided to go with 
implementation using macros defined in system headers.  However some of 
these macros are there with "backward compatibility" notes e.g.:

/* backwards compatibility for userspace */
#define IFLA_RTA(r)  ((struct rtattr*)(((char*)(r)) + ...
#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))

So I'm not that sure what will be their fate (possible removal?).

There is some considerable overlap between these macros and libmnl when 
it comes to handling of messages/attributes, so I decided to go with 
macros instead of introducing external dependency.  However I'm open to 
change if that would be the general consensus.

With regards
Andrzej Ostruszka



More information about the dev mailing list