From 86b273150a47c6f5783db865d1385675f5c4e5a6 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 26 Jul 2021 14:10:29 +0200 Subject: tcp, udp: Allow binding ports in init namespace to both tap and loopback Traffic with loopback source address will be forwarded to the direct loopback connection in the namespace, and the tap interface is used for the rest. Signed-off-by: Stefano Brivio --- util.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 1c11474..90d7f7c 100644 --- a/util.h +++ b/util.h @@ -115,11 +115,17 @@ void debug(const char *format, ...); #include #include +enum bind_type { + BIND_ANY = 0, + BIND_LOOPBACK, + BIND_EXT, +}; + struct ctx; char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto); -int sock_l4(struct ctx *c, int af, uint8_t proto, uint16_t port, int lo, - uint32_t data); +int sock_l4(struct ctx *c, int af, uint8_t proto, uint16_t port, + enum bind_type bind_addr, uint32_t data); int timespec_diff_ms(struct timespec *a, struct timespec *b); void bitmap_set(uint8_t *map, int bit); void bitmap_clear(uint8_t *map, int bit); -- cgit v1.2.3