]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
iproute2: Add netlink attribute to filter dump requests
authorRose, Gregory V <gregory.v.rose@intel.com>
Tue, 21 Feb 2012 10:43:09 +0000 (10:43 +0000)
committerStephen Hemminger <shemminger@vyatta.com>
Thu, 12 Apr 2012 16:36:30 +0000 (09:36 -0700)
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 <gregory.v.rose@intel.com>
lib/libnetlink.c

index c581e11cce49c35bb8f9758248a826046c4651a8..878911ec4610d7247d78d1bb1d5324e00c98d5cc 100644 (file)
@@ -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);
 }