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 == 0.
Bugzilla: https://bugs.passt.top/show_bug.cgi?id=19
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 = packet_get(p, i, 0, sizeof(*uh), &len);
if (!uh_send)
return p->count;
+
+ mm[i].msg_hdr.msg_name = sa;
+ mm[i].msg_hdr.msg_namelen = sl;
+ count++;
+
if (!len)
continue;
m[i].iov_base = (char *)(uh_send + 1);
m[i].iov_len = len;
- mm[i].msg_hdr.msg_name = sa;
- mm[i].msg_hdr.msg_namelen = sl;
-
mm[i].msg_hdr.msg_iov = m + i;
mm[i].msg_hdr.msg_iovlen = 1;
-
- count++;
}
count = sendmmsg(s, mm, count, MSG_NOSIGNAL);
--
2.37.3