]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
n != ppp.hlen for HDLC (will only work by coincidence if PPP header is uncompressed...
authorDaniel Lenski <dlenski@gmail.com>
Thu, 14 May 2020 21:41:19 +0000 (14:41 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 14 May 2020 23:11:04 +0000 (16:11 -0700)
See https://gitlab.com/openconnect/openconnect/-/commit/c060e713f7aba546ccc3a1e729dd6e2e21e0e43b#note_342889873

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

diff --git a/ppp.c b/ppp.c
index 0c840073a73750d95c6af1d828b0b3305b0ff481..265506ce9c0dbcfc015ecac4c19da9e87fe52a71 100644 (file)
--- a/ppp.c
+++ b/ppp.c
@@ -1001,9 +1001,11 @@ int ppp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                                                 proto == PPP_LCP ? ASYNCMAP_LCP : ppp->out_asyncmap);
                        if (!this)
                                return 1; /* XX */
-                       store_be32(this->data + n - 4, this->len - n);
+
+                       /* XX: header is simply the number of bytes on the wire (excluding itself) */
+                       store_be32(this->data - this->ppp.hlen - 4, this->len + this->ppp.hlen);
+                       this->ppp.hlen += 4;
                        free(vpninfo->current_ssl_pkt);
-                       this->ppp.hlen = -n + 4;
                        vpninfo->current_ssl_pkt = this;
                        break;
                default: