1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-16 12:25:34 +02:00

pif: Record originating pif in listening socket refs

For certain socket types, we record in the epoll ref whether they're
sockets in the namespace, or on the host.  We now have the notion of "pif"
to indicate what "place" a socket is associated with, so generalise the
simple one-bit 'ns' to a pif id.

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-11-07 12:40:15 +11:00 committed by Stefano Brivio
parent 125c5e52a5
commit 732e249376
6 changed files with 28 additions and 23 deletions

5
tcp.c
View file

@ -2964,6 +2964,7 @@ static int tcp_sock_init_af(const struct ctx *c, int af, in_port_t port,
{
union tcp_listen_epoll_ref tref = {
.port = port + c->tcp.fwd_in.delta[port],
.pif = PIF_HOST,
};
int s;
@ -3025,7 +3026,7 @@ static void tcp_ns_sock_init4(const struct ctx *c, in_port_t port)
{
union tcp_listen_epoll_ref tref = {
.port = port + c->tcp.fwd_out.delta[port],
.ns = true,
.pif = PIF_SPLICE,
};
struct in_addr loopback = { htonl(INADDR_LOOPBACK) };
int s;
@ -3051,7 +3052,7 @@ static void tcp_ns_sock_init6(const struct ctx *c, in_port_t port)
{
union tcp_listen_epoll_ref tref = {
.port = port + c->tcp.fwd_out.delta[port],
.ns = true,
.pif = PIF_SPLICE,
};
int s;