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/lua | |
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/lua')
-rw-r--r-- | accel-pppd/lua/session.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/accel-pppd/lua/session.c b/accel-pppd/lua/session.c index a6ce2b0..6d3b676 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; |