iplink: bridge_slave: add support for displaying xstats

This patch adds support to the bridge_slave link type for displaying
xstats by reusing the previously added bridge xstats callbacks.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
This commit is contained in:
Nikolay Aleksandrov 2017-02-15 15:23:13 +01:00 committed by Stephen Hemminger
parent 60ec0ecf0f
commit 217264a079
3 changed files with 8 additions and 3 deletions

View File

@ -98,6 +98,9 @@ struct link_util {
struct link_util *get_link_kind(const char *kind);
void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
int bridge_parse_xstats(struct link_util *lu, int argc, char **argv);
int bridge_print_xstats(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg);
__u32 ipvrf_get_table(const char *name);
int name_is_vrf(const char *name);

View File

@ -680,8 +680,8 @@ static void bridge_print_stats_attr(FILE *f, struct rtattr *attr, int ifindex)
}
}
static int bridge_print_xstats(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
int bridge_print_xstats(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
struct if_stats_msg *ifsm = NLMSG_DATA(n);
struct rtattr *tb[IFLA_STATS_MAX+1];
@ -708,7 +708,7 @@ static int bridge_print_xstats(const struct sockaddr_nl *who,
return 0;
}
static int bridge_parse_xstats(struct link_util *lu, int argc, char **argv)
int bridge_parse_xstats(struct link_util *lu, int argc, char **argv)
{
while (argc > 0) {
if (strcmp(*argv, "igmp") == 0 || strcmp(*argv, "mcast") == 0) {

View File

@ -312,4 +312,6 @@ struct link_util bridge_slave_link_util = {
.print_opt = bridge_slave_print_opt,
.parse_opt = bridge_slave_parse_opt,
.print_help = bridge_slave_print_help,
.parse_ifla_xstats = bridge_parse_xstats,
.print_ifla_xstats = bridge_print_xstats,
};