From ffe3a1337c1380a5b79651b34037c6c9f66b9ea1 Mon Sep 17 00:00:00 2001 From: Stephan Brunner Date: Tue, 1 Nov 2022 09:51:14 +0100 Subject: 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. --- accel-pppd/lua/session.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'accel-pppd/lua') diff --git a/accel-pppd/lua/session.c b/accel-pppd/lua/session.c index a6ce2b08..6d3b6762 100644 --- a/accel-pppd/lua/session.c +++ b/accel-pppd/lua/session.c @@ -218,13 +218,12 @@ static int session_ipv6(lua_State *L) static int session_rx_bytes(lua_State *L) { struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION); - uint64_t gword_sz = (uint64_t)UINT32_MAX + 1; uint64_t bytes; if (!ses) return 0; - bytes = gword_sz*ses->acct_input_gigawords + ses->acct_rx_bytes; + bytes = ses->acct_rx_bytes; lua_pushnumber(L, bytes); return 1; @@ -233,13 +232,12 @@ static int session_rx_bytes(lua_State *L) static int session_tx_bytes(lua_State *L) { struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION); - uint64_t gword_sz = (uint64_t)UINT32_MAX + 1; uint64_t bytes; if (!ses) return 0; - bytes = gword_sz*ses->acct_output_gigawords + ses->acct_tx_bytes; + bytes = ses->acct_tx_bytes; lua_pushnumber(L, bytes); return 1; -- cgit v1.2.3