diff options
author | Stephan Brunner <s.brunner@stephan-brunner.net> | 2022-11-01 10:08:06 +0100 |
---|---|---|
committer | Stephan Brunner <s.brunner@stephan-brunner.net> | 2022-11-01 10:08:06 +0100 |
commit | 5d3e96a67dc6ea6ca81156bdccd83b9b7e241ccb (patch) | |
tree | d4df4990549815fecb1880766117a5fcf1f13920 /accel-pppd/extra | |
parent | ffe3a1337c1380a5b79651b34037c6c9f66b9ea1 (diff) | |
download | accel-ppp-5d3e96a67dc6ea6ca81156bdccd83b9b7e241ccb.tar.gz accel-ppp-5d3e96a67dc6ea6ca81156bdccd83b9b7e241ccb.zip |
Add PACKETS_SENT and PACKETS_RCVD to the pppd-compat environment.
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r-- | accel-pppd/extra/pppd_compat.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index 9bc393b4..040e7d90 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -30,7 +30,7 @@ #include "memdebug.h" #define ENV_MEM 1024 -#define ENV_MAX 16 +#define ENV_MAX 32 static char *conf_ip_up; static char *conf_ip_pre_up; @@ -686,9 +686,13 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd) if (pd->ses->stop_time) { uint64_t tx_bytes; uint64_t rx_bytes; + uint64_t tx_packets; + uint64_t rx_packets; tx_bytes = ses->acct_tx_bytes; rx_bytes = ses->acct_rx_bytes; + tx_packets = ses->acct_tx_packets; + rx_packets = ses->acct_rx_packets; env[n] = mem; write_sz = snprintf(mem, mem_sz, "CONNECT_TIME=%lu", @@ -714,6 +718,24 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd) rx_bytes); if (write_sz < 0 || write_sz >= mem_sz) goto out; + mem_sz -= write_sz + 1; + mem += write_sz + 1; + ++n; + + env[n] = mem; + write_sz = snprintf(mem, mem_sz, "PACKETS_SENT=%" PRIu64, + tx_packets); + if (write_sz < 0 || write_sz >= mem_sz) + goto out; + mem_sz -= write_sz + 1; + mem += write_sz + 1; + ++n; + + env[n] = mem; + write_sz = snprintf(mem, mem_sz, "PACKETS_RCVD=%" PRIu64, + rx_packets); + if (write_sz < 0 || write_sz >= mem_sz) + goto out; ++n; } |