From 49631a38a6ec550fb9254f2f9e4a049eea02ed6d Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 21 Jul 2021 17:44:39 +0200 Subject: tcp, udp: Split IPv4 and IPv6 bound port sets Allow to bind IPv4 and IPv6 ports to tap, namespace or init separately. Port numbers of TCP ports that are bound in a namespace are also bound for UDP for convenience (e.g. iperf3), and IPv4 ports are always bound if the corresponding IPv6 port is bound (socket might not have the IPV6_V6ONLY option set). This will also be configurable later. Signed-off-by: Stefano Brivio --- tcp.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'tcp.h') diff --git a/tcp.h b/tcp.h index 6a9aa4a..52f4bb0 100644 --- a/tcp.h +++ b/tcp.h @@ -38,18 +38,24 @@ union tcp_epoll_ref { * @hash_secret: 128-bit secret for hash functions, ISN and hash table * @tap_conn_count: Count of tap connections in connection table * @splice_conn_count: Count of spliced connections in connection table - * @port_to_tap: Ports bound host/init-side, packets to guest/tap - * @port_to_init: Ports bound namespace-side, spliced to init - * @port_to_ns: Ports bound init-side, spliced to namespace + * @port4_to_tap: IPv4 ports bound host/init-side, packets to guest/tap + * @port6_to_tap: IPv6 ports bound host/init-side, packets to guest/tap + * @port4_to_init: IPv4 ports bound namespace-side, spliced to init + * @port6_to_init: IPv6 ports bound namespace-side, spliced to init + * @port4_to_ns: IPv4 ports bound init-side, spliced to namespace + * @port6_to_ns: IPv6 ports bound init-side, spliced to namespace * @timer_run: Timestamp of most recent timer run */ struct tcp_ctx { uint64_t hash_secret[2]; int tap_conn_count; int splice_conn_count; - uint8_t port_to_tap [USHRT_MAX / 8]; - uint8_t port_to_init [USHRT_MAX / 8]; - uint8_t port_to_ns [USHRT_MAX / 8]; + uint8_t port4_to_tap [USHRT_MAX / 8]; + uint8_t port6_to_tap [USHRT_MAX / 8]; + uint8_t port4_to_init [USHRT_MAX / 8]; + uint8_t port6_to_init [USHRT_MAX / 8]; + uint8_t port4_to_ns [USHRT_MAX / 8]; + uint8_t port6_to_ns [USHRT_MAX / 8]; struct timespec timer_run; }; -- cgit v1.2.3