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 <gregory.v.rose@intel.com>
This commit is contained in:
Rose, Gregory V 2012-02-21 10:43:09 +00:00 committed by Stephen Hemminger
parent 29cea29df0
commit bd886ebb1f
1 changed files with 7 additions and 0 deletions

View 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);
}