summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-03-16 12:55:19 +0100
committerThomas Graf <tgraf@suug.ch>2011-03-16 12:55:19 +0100
commit4b0126b8e6b8b3c5377e1f001be0987d7046da9a (patch)
treeaec8003f07a6f58cd0c59af938edf7fae6663897 /lib
parent82fe78582045d29d3b9a5bd2f5b233814bd23c23 (diff)
downloadlibnl-4b0126b8e6b8b3c5377e1f001be0987d7046da9a.tar.gz
prefix ipv6 link statistics identifiers with IP6
Diffstat (limited to 'lib')
-rw-r--r--lib/route/link.c60
-rw-r--r--lib/route/link/inet6.c72
2 files changed, 67 insertions, 65 deletions
diff --git a/lib/route/link.c b/lib/route/link.c
index c583917..00c9781 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -1287,36 +1287,36 @@ static const struct trans_tbl link_stats[] = {
__ADD(RTNL_LINK_TX_WIN_ERR, tx_win_err)
__ADD(RTNL_LINK_COLLISIONS, collisions)
__ADD(RTNL_LINK_MULTICAST, multicast)
- __ADD(RTNL_LINK_INPKTS, InReceives)
- __ADD(RTNL_LINK_INHDRERRORS, InHdrErrors)
- __ADD(RTNL_LINK_INTOOBIGERRORS, InTooBigErrors)
- __ADD(RTNL_LINK_INNOROUTES, InNoRoutes)
- __ADD(RTNL_LINK_INADDRERRORS, InAddrErrors)
- __ADD(RTNL_LINK_INUNKNOWNPROTOS, InUnknownProtos)
- __ADD(RTNL_LINK_INTRUNCATEDPKTS, InTruncatedPkts)
- __ADD(RTNL_LINK_INDISCARDS, InDiscards)
- __ADD(RTNL_LINK_INDELIVERS, InDelivers)
- __ADD(RTNL_LINK_OUTFORWDATAGRAMS, OutForwDatagrams)
- __ADD(RTNL_LINK_OUTPKTS, OutRequests)
- __ADD(RTNL_LINK_OUTDISCARDS, OutDiscards)
- __ADD(RTNL_LINK_OUTNOROUTES, OutNoRoutes)
- __ADD(RTNL_LINK_REASMTIMEOUT, ReasmTimeout)
- __ADD(RTNL_LINK_REASMREQDS, ReasmReqds)
- __ADD(RTNL_LINK_REASMOKS, ReasmOKs)
- __ADD(RTNL_LINK_REASMFAILS, ReasmFails)
- __ADD(RTNL_LINK_FRAGOKS, FragOKs)
- __ADD(RTNL_LINK_FRAGFAILS, FragFails)
- __ADD(RTNL_LINK_FRAGCREATES, FragCreates)
- __ADD(RTNL_LINK_INMCASTPKTS, InMcastPkts)
- __ADD(RTNL_LINK_OUTMCASTPKTS, OutMcastPkts)
- __ADD(RTNL_LINK_INBCASTPKTS, InBcastPkts)
- __ADD(RTNL_LINK_OUTBCASTPKTS, OutBcastPkts)
- __ADD(RTNL_LINK_INOCTETS, InOctets)
- __ADD(RTNL_LINK_OUTOCTETS, OutOctets)
- __ADD(RTNL_LINK_INMCASTOCTETS, InMcastOctets)
- __ADD(RTNL_LINK_OUTMCASTOCTETS, OutMcastOctets)
- __ADD(RTNL_LINK_INBCASTOCTETS, InBcastOctets)
- __ADD(RTNL_LINK_OUTBCASTOCTETS, OutBcastOctets)
+ __ADD(RTNL_LINK_IP6_INPKTS, Ip6InReceives)
+ __ADD(RTNL_LINK_IP6_INHDRERRORS, Ip6InHdrErrors)
+ __ADD(RTNL_LINK_IP6_INTOOBIGERRORS, Ip6InTooBigErrors)
+ __ADD(RTNL_LINK_IP6_INNOROUTES, Ip6InNoRoutes)
+ __ADD(RTNL_LINK_IP6_INADDRERRORS, Ip6InAddrErrors)
+ __ADD(RTNL_LINK_IP6_INUNKNOWNPROTOS, Ip6InUnknownProtos)
+ __ADD(RTNL_LINK_IP6_INTRUNCATEDPKTS, Ip6InTruncatedPkts)
+ __ADD(RTNL_LINK_IP6_INDISCARDS, Ip6InDiscards)
+ __ADD(RTNL_LINK_IP6_INDELIVERS, Ip6InDelivers)
+ __ADD(RTNL_LINK_IP6_OUTFORWDATAGRAMS, Ip6OutForwDatagrams)
+ __ADD(RTNL_LINK_IP6_OUTPKTS, Ip6OutRequests)
+ __ADD(RTNL_LINK_IP6_OUTDISCARDS, Ip6OutDiscards)
+ __ADD(RTNL_LINK_IP6_OUTNOROUTES, Ip6OutNoRoutes)
+ __ADD(RTNL_LINK_IP6_REASMTIMEOUT, Ip6ReasmTimeout)
+ __ADD(RTNL_LINK_IP6_REASMREQDS, Ip6ReasmReqds)
+ __ADD(RTNL_LINK_IP6_REASMOKS, Ip6ReasmOKs)
+ __ADD(RTNL_LINK_IP6_REASMFAILS, Ip6ReasmFails)
+ __ADD(RTNL_LINK_IP6_FRAGOKS, Ip6FragOKs)
+ __ADD(RTNL_LINK_IP6_FRAGFAILS, Ip6FragFails)
+ __ADD(RTNL_LINK_IP6_FRAGCREATES, Ip6FragCreates)
+ __ADD(RTNL_LINK_IP6_INMCASTPKTS, Ip6InMcastPkts)
+ __ADD(RTNL_LINK_IP6_OUTMCASTPKTS, Ip6OutMcastPkts)
+ __ADD(RTNL_LINK_IP6_INBCASTPKTS, Ip6InBcastPkts)
+ __ADD(RTNL_LINK_IP6_OUTBCASTPKTS, Ip6OutBcastPkts)
+ __ADD(RTNL_LINK_IP6_INOCTETS, Ip6InOctets)
+ __ADD(RTNL_LINK_IP6_OUTOCTETS, Ip6OutOctets)
+ __ADD(RTNL_LINK_IP6_INMCASTOCTETS, Ip6InMcastOctets)
+ __ADD(RTNL_LINK_IP6_OUTMCASTOCTETS, Ip6OutMcastOctets)
+ __ADD(RTNL_LINK_IP6_INBCASTOCTETS, Ip6InBcastOctets)
+ __ADD(RTNL_LINK_IP6_OUTBCASTOCTETS, Ip6OutBcastOctets)
__ADD(RTNL_LINK_ICMP6_INMSGS, ICMP6_InMsgs)
__ADD(RTNL_LINK_ICMP6_INERRORS, ICMP6_InErrors)
__ADD(RTNL_LINK_ICMP6_OUTMSGS, ICMP6_OutMsgs)
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");