1
0
mirror of https://passt.top/passt synced 2024-10-01 03:25:48 +00:00

udp: Fix retry mechanism on partial sendmmsg()

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-01 16:44:20 +02:00
parent 04d62bb013
commit 8e9333616a

6
udp.c
View File

@ -645,7 +645,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
struct timespec *now) struct timespec *now)
{ {
int iov_in_msg, msg_i = 0, ret; int iov_in_msg, msg_i = 0, ret;
ssize_t n, msglen, missing; ssize_t n, msglen, missing = 0;
struct mmsghdr *tap_mmh; struct mmsghdr *tap_mmh;
struct msghdr *cur_mh; struct msghdr *cur_mh;
unsigned int i; 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: * 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_hdr: .... ...... ..... ......
* tap_mmh[ret - 1].msg_len: 7 .... ... * 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; missing = msglen - tap_mmh[ret - 1].msg_len;
} }
if (missing) { if (missing > 0) {
uint8_t **iov_base; uint8_t **iov_base;
int first_offset; int first_offset;