diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-03-16 11:55:19 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-03-16 11:55:19 (GMT) |
commit | 4b0126b8e6b8b3c5377e1f001be0987d7046da9a (patch) | |
tree | aec8003f07a6f58cd0c59af938edf7fae6663897 /lib/route/link | |
parent | 82fe78582045d29d3b9a5bd2f5b233814bd23c23 (diff) | |
download | libnl-4b0126b8e6b8b3c5377e1f001be0987d7046da9a.zip libnl-4b0126b8e6b8b3c5377e1f001be0987d7046da9a.tar.gz libnl-4b0126b8e6b8b3c5377e1f001be0987d7046da9a.tar.bz2 |
prefix ipv6 link statistics identifiers with IP6
Diffstat (limited to 'lib/route/link')
-rw-r--r-- | lib/route/link/inet6.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c index cca308f..cfb0e44 100644 --- a/lib/route/link/inet6.c +++ b/lib/route/link/inet6.c @@ -76,16 +76,18 @@ static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr, uint64_t *cnt = nla_data(tb[IFLA_INET6_STATS]); int i; - for (i = 1; i < __IPSTATS_MIB_MAX; i++) - rtnl_link_set_stat(link, RTNL_LINK_INPKTS, cnt[i-1]); + for (i = 1; i <= __IPSTATS_MIB_MAX; i++) + rtnl_link_set_stat(link, RTNL_LINK_IP6_INPKTS + i - 1, + cnt[i]); } if (tb[IFLA_INET6_ICMP6STATS]) { - uint64_t *cnt = nla_data(tb[IFLA_INET6_STATS]); + uint64_t *cnt = nla_data(tb[IFLA_INET6_ICMP6STATS]); int i; - for (i = 1; i < __ICMP6_MIB_MAX; i++) - rtnl_link_set_stat(link, RTNL_LINK_ICMP6_INMSGS, cnt[i-1]); + for (i = 1; i <= __ICMP6_MIB_MAX; i++) + rtnl_link_set_stat(link, RTNL_LINK_ICMP6_INMSGS + i - 1, + cnt[i]); } return 0; @@ -230,9 +232,9 @@ static void inet6_dump_stats(struct rtnl_link *link, nl_dump(p, " IPv6: InPkts InOctets " " InDiscards InDelivers\n"); - nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_INPKTS]); + nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_IP6_INPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_INOCTETS], + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_INOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); @@ -240,15 +242,15 @@ static void inet6_dump_stats(struct rtnl_link *link, nl_dump(p, "%16llu B ", 0); nl_dump(p, "%18llu %18llu\n", - link->l_stats[RTNL_LINK_INDISCARDS], - link->l_stats[RTNL_LINK_INDELIVERS]); + link->l_stats[RTNL_LINK_IP6_INDISCARDS], + link->l_stats[RTNL_LINK_IP6_INDELIVERS]); nl_dump(p, " OutPkts OutOctets " " OutDiscards OutForwards\n"); - nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_OUTPKTS]); + nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_IP6_OUTPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_OUTOCTETS], + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_OUTOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); @@ -256,23 +258,23 @@ static void inet6_dump_stats(struct rtnl_link *link, nl_dump(p, "%16llu B ", 0); nl_dump(p, "%18llu %18llu\n", - link->l_stats[RTNL_LINK_OUTDISCARDS], - link->l_stats[RTNL_LINK_OUTFORWDATAGRAMS]); + link->l_stats[RTNL_LINK_IP6_OUTDISCARDS], + link->l_stats[RTNL_LINK_IP6_OUTFORWDATAGRAMS]); nl_dump(p, " InMcastPkts InMcastOctets " " InBcastPkts InBcastOctests\n"); - nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_INMCASTPKTS]); + nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_IP6_INMCASTPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_INMCASTOCTETS], + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_INMCASTOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else nl_dump(p, "%16llu B ", 0); - nl_dump(p, "%18llu ", link->l_stats[RTNL_LINK_INBCASTPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_INBCASTOCTETS], + nl_dump(p, "%18llu ", link->l_stats[RTNL_LINK_IP6_INBCASTPKTS]); + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_INBCASTOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s\n", octets, octetsUnit); @@ -282,17 +284,17 @@ static void inet6_dump_stats(struct rtnl_link *link, nl_dump(p, " OutMcastPkts OutMcastOctets " " OutBcastPkts OutBcastOctests\n"); - nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_OUTMCASTPKTS]); + nl_dump(p, " %18llu ", link->l_stats[RTNL_LINK_IP6_OUTMCASTPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_OUTMCASTOCTETS], + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_OUTMCASTOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else nl_dump(p, "%16llu B ", 0); - nl_dump(p, "%18llu ", link->l_stats[RTNL_LINK_OUTBCASTPKTS]); - octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_OUTBCASTOCTETS], + nl_dump(p, "%18llu ", link->l_stats[RTNL_LINK_IP6_OUTBCASTPKTS]); + octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_OUTBCASTOCTETS], &octetsUnit); if (octets) nl_dump(p, "%14.2f %3s\n", octets, octetsUnit); @@ -302,32 +304,32 @@ static void inet6_dump_stats(struct rtnl_link *link, nl_dump(p, " ReasmOKs ReasmFails " " ReasmReqds ReasmTimeout\n"); nl_dump(p, " %18llu %18llu %18llu %18llu\n", - link->l_stats[RTNL_LINK_REASMOKS], - link->l_stats[RTNL_LINK_REASMFAILS], - link->l_stats[RTNL_LINK_REASMREQDS], - link->l_stats[RTNL_LINK_REASMTIMEOUT]); + link->l_stats[RTNL_LINK_IP6_REASMOKS], + link->l_stats[RTNL_LINK_IP6_REASMFAILS], + link->l_stats[RTNL_LINK_IP6_REASMREQDS], + link->l_stats[RTNL_LINK_IP6_REASMTIMEOUT]); nl_dump(p, " FragOKs FragFails " " FragCreates\n"); nl_dump(p, " %18llu %18llu %18llu\n", - link->l_stats[RTNL_LINK_FRAGOKS], - link->l_stats[RTNL_LINK_FRAGFAILS], - link->l_stats[RTNL_LINK_FRAGCREATES]); + link->l_stats[RTNL_LINK_IP6_FRAGOKS], + link->l_stats[RTNL_LINK_IP6_FRAGFAILS], + link->l_stats[RTNL_LINK_IP6_FRAGCREATES]); nl_dump(p, " InHdrErrors InTooBigErrors " " InNoRoutes InAddrErrors\n"); nl_dump(p, " %18llu %18llu %18llu %18llu\n", - link->l_stats[RTNL_LINK_INHDRERRORS], - link->l_stats[RTNL_LINK_INTOOBIGERRORS], - link->l_stats[RTNL_LINK_INNOROUTES], - link->l_stats[RTNL_LINK_INADDRERRORS]); + link->l_stats[RTNL_LINK_IP6_INHDRERRORS], + link->l_stats[RTNL_LINK_IP6_INTOOBIGERRORS], + link->l_stats[RTNL_LINK_IP6_INNOROUTES], + link->l_stats[RTNL_LINK_IP6_INADDRERRORS]); nl_dump(p, " InUnknownProtos InTruncatedPkts " " OutNoRoutes\n"); nl_dump(p, " %18llu %18llu %18llu\n", - link->l_stats[RTNL_LINK_INUNKNOWNPROTOS], - link->l_stats[RTNL_LINK_INTRUNCATEDPKTS], - link->l_stats[RTNL_LINK_OUTNOROUTES]); + link->l_stats[RTNL_LINK_IP6_INUNKNOWNPROTOS], + link->l_stats[RTNL_LINK_IP6_INTRUNCATEDPKTS], + link->l_stats[RTNL_LINK_IP6_OUTNOROUTES]); nl_dump(p, " ICMPv6: InMsgs InErrors " " OutMsgs OutErrors\n"); |