passt, tap: Process data on the socket before HUP/ERR events
In the case where the client writes a packet and then closes the socket, because we receive EPOLLIN|EPOLLRDHUP together we have a choice of whether to close the socket immediately, or read the packet and then close the socket. Choose the latter. This should improve fuzzing coverage and arguably is a better choice even for regular use since dropping packets on close is bad. See-also: https://archives.passt.top/passt-dev/20221117171805.3746f53a@elisabeth/ Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
6b4e68383c
commit
190169c544
1 changed files with 3 additions and 3 deletions
6
tap.c
6
tap.c
|
@ -1106,13 +1106,13 @@ void tap_handler(struct ctx *c, int fd, uint32_t events,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))
|
|
||||||
goto reinit;
|
|
||||||
|
|
||||||
if ((c->mode == MODE_PASST && tap_handler_passt(c, now)) ||
|
if ((c->mode == MODE_PASST && tap_handler_passt(c, now)) ||
|
||||||
(c->mode == MODE_PASTA && tap_handler_pasta(c, now)))
|
(c->mode == MODE_PASTA && tap_handler_pasta(c, now)))
|
||||||
goto reinit;
|
goto reinit;
|
||||||
|
|
||||||
|
if (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))
|
||||||
|
goto reinit;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
reinit:
|
reinit:
|
||||||
if (c->one_off) {
|
if (c->one_off) {
|
||||||
|
|
Loading…
Reference in a new issue