From: Rose, Gregory V Date: Tue, 21 Feb 2012 10:43:09 +0000 (+0000) Subject: iproute2: Add netlink attribute to filter dump requests X-Git-Url: https://rtime.felk.cvut.cz/gitweb/lisovros/iproute2_canprio.git/commitdiff_plain/bd886ebb1ffd84301caa2341b671df9a9e2db4c9 iproute2: Add netlink attribute to filter dump requests Add a new netlink attribute type to the dump request to allow filtering of the information returned for the respective matching interfaces. At this time the only filter defined is to request virtual function (VF) device info for interfaces that attached VFs. It will also be possible to extend the request with other yet to be defined netlink attributes in the future. Signed-off-by: Greg Rose --- diff --git a/lib/libnetlink.c b/lib/libnetlink.c index c581e11..878911e 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -94,6 +94,9 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) struct { struct nlmsghdr nlh; struct rtgenmsg g; + __u16 align_rta; /* attribute has to be 32bit aligned */ + struct rtattr ext_req; + __u32 ext_filter_mask; } req; memset(&req, 0, sizeof(req)); @@ -104,6 +107,10 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) req.nlh.nlmsg_seq = rth->dump = ++rth->seq; req.g.rtgen_family = family; + req.ext_req.rta_type = IFLA_EXT_MASK; + req.ext_req.rta_len = RTA_LENGTH(sizeof(__u32)); + req.ext_filter_mask = RTEXT_FILTER_VF; + return send(rth->fd, (void*)&req, sizeof(req), 0); }