aboutgitcodebugslistschat
path: root/udp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-01 16:44:20 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-09 15:40:04 +0200
commit8e9333616ac3dd37dfb2261f08dd0b16018d0686 (patch)
tree110db1a96a4cf66e3371ee77faf129aafe738c12 /udp.c
parent04d62bb0130f2ac176bbf5d702c6952b7b4fa6ff (diff)
downloadpasst-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar.gz
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar.bz2
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar.lz
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar.xz
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.tar.zst
passt-8e9333616ac3dd37dfb2261f08dd0b16018d0686.zip
udp: Fix retry mechanism on partial sendmmsg()
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/udp.c b/udp.c
index e3bb1e6..77da549 100644
--- a/udp.c
+++ b/udp.c
@@ -645,7 +645,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
struct timespec *now)
{
int iov_in_msg, msg_i = 0, ret;
- ssize_t n, msglen, missing;
+ ssize_t n, msglen, missing = 0;
struct mmsghdr *tap_mmh;
struct msghdr *cur_mh;
unsigned int i;
@@ -829,7 +829,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
*
* In pictures, given this example:
*
- * iov #0 iov #2 iov #3 iov #4
+ * iov #0 iov #1 iov #2 iov #3
* tap_mmh[ret - 1].msg_hdr: .... ...... ..... ......
* tap_mmh[ret - 1].msg_len: 7 .... ...
*
@@ -845,7 +845,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
missing = msglen - tap_mmh[ret - 1].msg_len;
}
- if (missing) {
+ if (missing > 0) {
uint8_t **iov_base;
int first_offset;