diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-08-11 15:12:25 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-08-13 17:30:10 +0200 |
commit | 8271a2ed57331f211c781bb551efe52e380902ae (patch) | |
tree | a903cc316f773e4e70726fd7f61e229444c5d5ce | |
parent | 05f606ab0b85fdca083e1dfe71331353c4efe02e (diff) | |
download | passt-8271a2ed57331f211c781bb551efe52e380902ae.tar passt-8271a2ed57331f211c781bb551efe52e380902ae.tar.gz passt-8271a2ed57331f211c781bb551efe52e380902ae.tar.bz2 passt-8271a2ed57331f211c781bb551efe52e380902ae.tar.lz passt-8271a2ed57331f211c781bb551efe52e380902ae.tar.xz passt-8271a2ed57331f211c781bb551efe52e380902ae.tar.zst passt-8271a2ed57331f211c781bb551efe52e380902ae.zip |
epoll: Tiny cleanup to udp_sock_handler()
Move the test for c->no_udp into the function itself, rather than in the
dispatching switch statement to better localize the UDP specific logic, and
make for greated consistency with other handler functions.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | passt.c | 3 | ||||
-rw-r--r-- | udp.c | 2 |
2 files changed, 2 insertions, 3 deletions
@@ -325,8 +325,7 @@ loop: tcp_sock_handler(&c, ref, eventmask, &now); break; case EPOLL_TYPE_UDP: - if (!c.no_udp) - udp_sock_handler(&c, ref, eventmask, &now); + udp_sock_handler(&c, ref, eventmask, &now); break; case EPOLL_TYPE_ICMP: icmp_sock_handler(&c, ref); @@ -756,7 +756,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events, struct mmsghdr *mmh_recv; int i, m; - if (!(events & EPOLLIN)) + if (c->no_udp || !(events & EPOLLIN)) return; if (v6) { |