summaryrefslogtreecommitdiffstats
path: root/include/libnetlink.h
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2016-08-25 14:28:55 +0200
committerStephen Hemminger <stephen@networkplumber.org>2016-08-29 10:58:40 -0700
commit7abf5de677e32f39dcd908f5b69adb047feeb76a (patch)
treeb5d384f9c8b6004d11e73201ef414b243c475894 /include/libnetlink.h
parentf7708201f8e0f00b62810d0a053f1628acf31c5b (diff)
bridge: vlan: add support to display per-vlan statistics
This patch adds support for the stats argument to the bridge vlan command which will display the per-vlan statistics and the device each vlan belongs to with its flags. The supported command filtering options are dev and vid. Also the man page is updated to explain the new option. The patch uses the new RTM_GETSTATS interface with a filter_mask to dump all bridges and ports vlans. Later we can add support for using the per-device dump and filter it in the kernel instead. Example: $ bridge -s vlan show port vlan id br0 1 Egress Untagged RX: 2536 bytes 20 packets TX: 2536 bytes 20 packets 101 RX: 43158 bytes 50 packets TX: 43158 bytes 50 packets eth1 1 Egress Untagged RX: 2536 bytes 20 packets TX: 2536 bytes 20 packets 100 RX: 0 bytes 0 packets TX: 0 bytes 0 packets 101 RX: 43158 bytes 50 packets TX: 43158 bytes 50 packets 102 RX: 16897 bytes 93 packets TX: 0 bytes 0 packets The format is the same as bridge vlan show but with stats, even though under the hood the calls done to the kernel are different. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Diffstat (limited to 'include/libnetlink.h')
-rw-r--r--include/libnetlink.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libnetlink.h b/include/libnetlink.h
index f7b85dcc..483509ca 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -44,6 +44,9 @@ typedef int (*req_filter_fn_t)(struct nlmsghdr *nlh, int reqlen);
int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int fam, int type,
req_filter_fn_t fn)
__attribute__((warn_unused_result));
+int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
+ __u32 filt_mask)
+ __attribute__((warn_unused_result));
int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
int len)
__attribute__((warn_unused_result));
@@ -202,6 +205,11 @@ int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
#define NETNS_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct rtgenmsg))
#endif
+#ifndef IFLA_STATS_RTA
+#define IFLA_STATS_RTA(r) \
+ ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct if_stats_msg))))
+#endif
+
/* User defined nlmsg_type which is used mostly for logging netlink
* messages from dump file */
#define NLMSG_TSTAMP 15