Use 64bit counters for accounting

Otherwise with 5-minute reporting we overflow with >= ~100Mbps.

Fixes #12
This commit is contained in:
Samuel Thibault 2022-01-17 23:04:43 +01:00
parent 7c715f16fc
commit 31dedbbe66
4 changed files with 151 additions and 10 deletions

View file

@ -5061,22 +5061,22 @@ static int dump_session(FILE **f, sessiont *s)
LOG(4, 0, 0, "Dumping accounting information for %s\n", s->user);
if(config->account_all_origin)
{
fprintf(*f, "%s %s %d %u %u %s\n",
fprintf(*f, "%s %s %d %llu %llu %s\n",
s->user, // username
fmtaddr(htonl(s->ip), 0), // ip
(s->throttle_in || s->throttle_out) ? 2 : 1, // qos
(uint32_t) s->cin_delta, // uptxoctets
(uint32_t) s->cout_delta, // downrxoctets
(unsigned long long) s->cin_delta, // uptxoctets
(unsigned long long) s->cout_delta, // downrxoctets
(s->tunnel == TUNNEL_ID_PPPOE)?"P":(tunnel[s->tunnel].isremotelns?"R":"L")); // Origin
}
else if (!tunnel[s->tunnel].isremotelns && (s->tunnel != TUNNEL_ID_PPPOE))
{
fprintf(*f, "%s %s %d %u %u\n",
fprintf(*f, "%s %s %d %llu %llu\n",
s->user, // username
fmtaddr(htonl(s->ip), 0), // ip
(s->throttle_in || s->throttle_out) ? 2 : 1, // qos
(uint32_t) s->cin_delta, // uptxoctets
(uint32_t) s->cout_delta); // downrxoctets
(unsigned long long) s->cin_delta, // uptxoctets
(unsigned long long) s->cout_delta); // downrxoctets
}
s->cin_delta = s->cout_delta = 0;