From 987ecf732ae21efd9e62faea265245492a15723e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 30 Nov 2009 01:17:42 +0100 Subject: [PATCH] Print some details of the interface statistics --- src/rtnl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rtnl.c b/src/rtnl.c index 6d2efa2..455a259 100644 --- a/src/rtnl.c +++ b/src/rtnl.c @@ -242,6 +242,7 @@ static const char *operstate2str(unsigned char operstate) static void extract_link(struct ifinfomsg *msg, int bytes, const char **ifname, unsigned char *operstate) { + struct rtnl_link_stats stats; struct rtattr *attr; for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes); @@ -257,6 +258,14 @@ static void extract_link(struct ifinfomsg *msg, int bytes, break; case IFLA_LINKMODE: break; + case IFLA_STATS: + memcpy(&stats, RTA_DATA(attr), + sizeof(struct rtnl_link_stats)); + connman_info("%s {RX} %d packets %d bytes", *ifname, + stats.rx_packets, stats.rx_bytes); + connman_info("%s {TX} %d packets %d bytes", *ifname, + stats.tx_packets, stats.tx_bytes); + break; } } } -- 2.7.4