From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: [PATCH 1/2] udp: Don't drop zero-length outbound UDP packets Date: Fri, 09 Sep 2022 14:27:13 +1000 Message-ID: <20220909042714.762832-2-david@gibson.dropbear.id.au> In-Reply-To: <20220909042714.762832-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1942385651756431031==" --===============1942385651756431031== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable udp_tap_handler() currently skips outbound packets if they have a payload length of zero. This is not correct, since in a datagram protocol zero length packets still have meaning. Adjust this to correctly forward the zero-length packets by using a msghdr with msg_iovlen =3D=3D 0. Bugzilla: https://bugs.passt.top/show_bug.cgi?id=3D19 Signed-off-by: David Gibson --- udp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udp.c b/udp.c index c4ebecc..caa852a 100644 --- a/udp.c +++ b/udp.c @@ -1075,19 +1075,19 @@ int udp_tap_handler(struct ctx *c, int af, const void= *addr, uh_send =3D packet_get(p, i, 0, sizeof(*uh), &len); if (!uh_send) return p->count; + + mm[i].msg_hdr.msg_name =3D sa; + mm[i].msg_hdr.msg_namelen =3D sl; + count++; + if (!len) continue; =20 m[i].iov_base =3D (char *)(uh_send + 1); m[i].iov_len =3D len; =20 - mm[i].msg_hdr.msg_name =3D sa; - mm[i].msg_hdr.msg_namelen =3D sl; - mm[i].msg_hdr.msg_iov =3D m + i; mm[i].msg_hdr.msg_iovlen =3D 1; - - count++; } =20 count =3D sendmmsg(s, mm, count, MSG_NOSIGNAL); --=20 2.37.3 --===============1942385651756431031==--