1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-17 20:55:34 +02:00

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 <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-07-26 14:10:29 +02:00
parent f4aaa471a1
commit 86b273150a
6 changed files with 144 additions and 64 deletions

10
util.h
View file

@ -115,11 +115,17 @@ void debug(const char *format, ...);
#include <linux/ip.h>
#include <limits.h>
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);