From: Lev Stipakov Date: Tue, 21 Jan 2025 16:10:25 +0000 (+0100) Subject: mudp.c: keep offset value when resetting buffer X-Git-Tag: v2.7_alpha1~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfa5f0bdfe89d181f7b5f7af2ba34ab9357a1d13;p=thirdparty%2Fopenvpn.git mudp.c: keep offset value when resetting buffer dco-win requires control packets to be prepended with sockaddr. For that, an offset value in buffer must be kept. Doing it always doesn't harm and makes code cleaner compared to adding "if (dco_win_server)" condition. Change-Id: I145573555aaace5e94774b5f977d032d3747ed72 Signed-off-by: Lev Stipakov Acked-by: Frank Lichtenheld Message-Id: <20250121161025.37545-1-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30519.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 4f2bbd7a4..5f43db9b7 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -54,7 +54,9 @@ send_hmac_reset_packet(struct multi_context *m, struct context *c = &m->top; - buf_reset_len(&c->c2.buffers->aux_buf); + /* dco-win server requires prepend with sockaddr, so preserve offset */ + ASSERT(buf_init(&c->c2.buffers->aux_buf, buf.offset)); + buf_copy(&c->c2.buffers->aux_buf, &buf); m->hmac_reply = c->c2.buffers->aux_buf; m->hmac_reply_dest = &m->top.c2.from;