diff options
author | Stephan Brunner <s.brunner@stephan-brunner.net> | 2022-11-01 09:51:14 +0100 |
---|---|---|
committer | Stephan Brunner <s.brunner@stephan-brunner.net> | 2022-11-01 09:51:34 +0100 |
commit | ffe3a1337c1380a5b79651b34037c6c9f66b9ea1 (patch) | |
tree | 077d1e424913b5a55e621a842215baea1739535c /accel-pppd/libnetlink | |
parent | f4a22056a221d69bf8d1aaa8eca39f276b52431d (diff) | |
download | accel-ppp-xebd-ffe3a1337c1380a5b79651b34037c6c9f66b9ea1.tar.gz accel-ppp-xebd-ffe3a1337c1380a5b79651b34037c6c9f66b9ea1.zip |
Use 64-bit interface statistics rather than doing custom 32-bit overflow handling.
When a link has a relatively high throughput, the 32-bit packet and byte counters could overflow multiple times between accounting runs.
To accommodate this limitation, directly use 64-bit interface statistics.
This also gets rid of the internal giga-word counters.
Diffstat (limited to 'accel-pppd/libnetlink')
-rw-r--r-- | accel-pppd/libnetlink/iputils.c | 6 | ||||
-rw-r--r-- | accel-pppd/libnetlink/iputils.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c index a1ededb..550717f 100644 --- a/accel-pppd/libnetlink/iputils.c +++ b/accel-pppd/libnetlink/iputils.c @@ -103,7 +103,7 @@ out_err: return -1; } -int __export iplink_get_stats(int ifindex, struct rtnl_link_stats *stats) +int __export iplink_get_stats(int ifindex, struct rtnl_link_stats64 *stats) { struct iplink_req { struct nlmsghdr n; @@ -142,8 +142,8 @@ int __export iplink_get_stats(int ifindex, struct rtnl_link_stats *stats) goto out; parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); - if (tb[IFLA_STATS]) { - memcpy(stats, RTA_DATA(tb[IFLA_STATS]), sizeof(*stats)); + if (tb[IFLA_STATS64]) { + memcpy(stats, RTA_DATA(tb[IFLA_STATS64]), sizeof(*stats)); r = 0; } diff --git a/accel-pppd/libnetlink/iputils.h b/accel-pppd/libnetlink/iputils.h index 7822474..9292cea 100644 --- a/accel-pppd/libnetlink/iputils.h +++ b/accel-pppd/libnetlink/iputils.h @@ -8,7 +8,7 @@ typedef int (*iplink_list_func)(int index, int flags, const char *name, int iflink, int vid, void *arg); int iplink_list(iplink_list_func func, void *arg); -int iplink_get_stats(int ifindex, struct rtnl_link_stats *stats); +int iplink_get_stats(int ifindex, struct rtnl_link_stats64 *stats); int iplink_set_mtu(int ifindex, int mtu); int iplink_vlan_add(const char *ifname, int ifindex, int vid); |