]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
clarify un-HDLC logging a bit
authorDaniel Lenski <dlenski@gmail.com>
Wed, 10 Feb 2021 07:09:31 +0000 (23:09 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 29 Mar 2021 02:27:01 +0000 (19:27 -0700)
Leftover bytes due to concatenated packet shouldn't be reported as part of
the un-HDLC size reduction.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
ppp.c

diff --git a/ppp.c b/ppp.c
index ede3d8af334c5482308cab715a69515c2de0e659..55a04148360912305c3e4f659fe608af7fb5366a 100644 (file)
--- 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;
        }
 }