1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-19 16:05:35 +02:00

epoll: Split listening Unix domain socket into its own type

tap_handler() actually handles events on three different types of object:
the /dev/tap character device (pasta), a connected Unix domain socket
(passt) or a listening Unix domain socket (passt).

The last, in particular, really has no handling in common with the others,
so split it into its own epoll type and directly dispatch to the relevant
handler from the top level.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-08-11 15:12:28 +10:00 committed by Stefano Brivio
parent 485b5fb8f9
commit eda4f1997e
4 changed files with 15 additions and 16 deletions

View file

@ -64,6 +64,7 @@ char *epoll_type_str[EPOLL_TYPE_MAX + 1] = {
[EPOLL_TYPE_ICMPV6] = "ICMPv6 socket",
[EPOLL_TYPE_NSQUIT] = "namespace inotify",
[EPOLL_TYPE_TAP] = "tap device",
[EPOLL_TYPE_TAP_LISTEN] = "listening qemu socket",
};
/**
@ -317,7 +318,10 @@ loop:
switch (ref.type) {
case EPOLL_TYPE_TAP:
tap_handler(&c, ref.fd, events[i].events, &now);
tap_handler(&c, events[i].events, &now);
break;
case EPOLL_TYPE_TAP_LISTEN:
tap_listen_handler(&c, eventmask);
break;
case EPOLL_TYPE_NSQUIT:
pasta_netns_quit_handler(&c, quit_fd);