mirror of
https://passt.top/passt
synced 2025-06-09 00:55:35 +02:00
tcp: Separate helpers to create ns listening sockets
tcp_sock_init*() can create either sockets listening on the host, or in the pasta network namespace (with @ns==1). There are, however, a number of differences in how these two cases work in practice though. "ns" sockets are only used in pasta mode, and they always lead to spliced connections only. The functions are also only ever called in "ns" mode with a NULL address and interface name, and it doesn't really make sense for them to be called any other way. Later changes will introduce further differences in behaviour between these two cases, so it makes more sense to use separate functions for creating the ns listening sockets than the regular external/host listening sockets. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
433604a581
commit
73d3a3e84e
3 changed files with 93 additions and 49 deletions
6
conf.c
6
conf.c
|
@ -209,7 +209,7 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg,
|
|||
|
||||
for (i = 0; i < PORT_EPHEMERAL_MIN; i++) {
|
||||
if (optname == 't')
|
||||
tcp_sock_init(c, 0, AF_UNSPEC, NULL, NULL, i);
|
||||
tcp_sock_init(c, AF_UNSPEC, NULL, NULL, i);
|
||||
else if (optname == 'u')
|
||||
udp_sock_init(c, 0, AF_UNSPEC, NULL, NULL, i);
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg,
|
|||
bitmap_set(fwd->map, i);
|
||||
|
||||
if (optname == 't')
|
||||
tcp_sock_init(c, 0, af, addr, ifname, i);
|
||||
tcp_sock_init(c, af, addr, ifname, i);
|
||||
else if (optname == 'u')
|
||||
udp_sock_init(c, 0, af, addr, ifname, i);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg,
|
|||
fwd->delta[i] = mapped_range.first - orig_range.first;
|
||||
|
||||
if (optname == 't')
|
||||
tcp_sock_init(c, 0, af, addr, ifname, i);
|
||||
tcp_sock_init(c, af, addr, ifname, i);
|
||||
else if (optname == 'u')
|
||||
udp_sock_init(c, 0, af, addr, ifname, i);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue