From: Daniel Lenski Date: Wed, 10 Feb 2021 07:09:31 +0000 (-0800) Subject: clarify un-HDLC logging a bit X-Git-Tag: v8.20~327^2~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e71cd923c8b2abd884c21704d473ccb2f9cbfc20;p=users%2Fdwmw2%2Fopenconnect.git clarify un-HDLC logging a bit Leftover bytes due to concatenated packet shouldn't be reported as part of the un-HDLC size reduction. Signed-off-by: Daniel Lenski --- diff --git a/ppp.c b/ppp.c index ede3d8af..55a04148 100644 --- a/ppp.c +++ b/ppp.c @@ -112,8 +112,8 @@ static int unhdlc_in_place(struct openconnect_info *vpninfo, unsigned char *byte vpn_progress(vpninfo, PRG_TRACE, _("HDLC initial flag sequence (0x7e) is missing\n")); - for (; inp < endp; inp++) { - unsigned char c = *inp; + while (inp < endp) { + unsigned char c = *inp++; if (c == 0x7e) goto done; else if (escape) { @@ -142,7 +142,7 @@ static int unhdlc_in_place(struct openconnect_info *vpninfo, unsigned char *byte outp -= 2; /* FCS */ if (next) - *next = inp+1; /* Pointing at the byte AFTER final 0x7e */ + *next = inp; /* Pointing at the byte AFTER final 0x7e */ if (fcs != PPPGOODFCS16) { vpn_progress(vpninfo, PRG_INFO, @@ -151,8 +151,8 @@ static int unhdlc_in_place(struct openconnect_info *vpninfo, unsigned char *byte return -EINVAL; } else { vpn_progress(vpninfo, PRG_TRACE, - _("Un-HDLC'ed packet (%d bytes -> %ld), FCS=0x%04x\n"), - len, outp - bytes, fcs); + _("Un-HDLC'ed packet (%ld bytes -> %ld), FCS=0x%04x\n"), + inp - bytes, outp - bytes, fcs); return outp - bytes; } }