]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - lib/libnetlink.c
bridge: vlan: add support to display per-vlan statistics
[mirror_iproute2.git] / lib / libnetlink.c
index a02cf9f0d3bb530d8393fb599607374b15509919..22799355ed7a7b8309200388d97df43568077ac8 100644 (file)
@@ -152,6 +152,26 @@ int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
        return send(rth->fd, (void*)&req, sizeof(req), 0);
 }
 
+int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
+                                  __u32 filt_mask)
+{
+       struct {
+               struct nlmsghdr nlh;
+               struct if_stats_msg ifsm;
+       } req;
+
+       memset(&req, 0, sizeof(req));
+       req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct if_stats_msg));
+       req.nlh.nlmsg_type = type;
+       req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
+       req.nlh.nlmsg_pid = 0;
+       req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
+       req.ifsm.family = fam;
+       req.ifsm.filter_mask = filt_mask;
+
+       return send(rth->fd, (void *)&req, sizeof(req), 0);
+}
+
 int rtnl_send(struct rtnl_handle *rth, const void *buf, int len)
 {
        return send(rth->fd, buf, len, 0);