From 79f2200b27f4e5e9b72a97ce7f418676e22166c9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Jun 2017 20:12:54 +0800 Subject: [PATCH] PPP, PPPoS: Fix update SNMP ifoutoctets counter in pppos_output_last() Current code does not correctly update ifoutoctets counter because nb->tot_len is always 0. Fix it by setting nb->tot_len to actual payload length so we can update ifoutoctets correctly. Signed-off-by: Axel Lin Signed-off-by: Sylvain Rochet --- src/netif/ppp/pppos.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 7bf40f21..e0f0d26f 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -217,6 +217,9 @@ pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p) return ERR_MEM; } + /* Set nb->tot_len to actual payload length */ + nb->tot_len = p->len; + /* If the link has been idle, we'll send a fresh flag character to * flush any noise. */ err = ERR_OK; @@ -262,6 +265,9 @@ pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u16_t protocol) return ERR_MEM; } + /* Set nb->tot_len to actual payload length */ + nb->tot_len = pb->tot_len; + /* If the link has been idle, we'll send a fresh flag character to * flush any noise. */ err = ERR_OK;