diff options
Diffstat (limited to 'flow.c')
| -rw-r--r-- | flow.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -197,7 +197,7 @@ static int flowside_sock_splice(void *arg) ns_enter(a->c); - a->fd = sock_l4(a->c, a->type, a->sa, NULL); + a->fd = sock_l4(a->c, a->type, a->sa, NULL, false); a->err = errno; return 0; @@ -208,12 +208,13 @@ static int flowside_sock_splice(void *arg) * @type: Socket epoll type * @pif: Interface for this socket * @side: Flowside to create a socket for + * @exclusive: Don't set SO_REUSEADDR (see sock_l4_()), PIF_HOST only * * Return: socket fd of protocol @proto bound to our address and port from @side * (if specified). */ int flowside_sock_l4(const struct ctx *c, enum epoll_type type, uint8_t pif, - const struct flowside *side) + const struct flowside *side, bool exclusive) { const char *ifname = NULL; union sockaddr_inany sa; @@ -231,12 +232,19 @@ int flowside_sock_l4(const struct ctx *c, enum epoll_type type, uint8_t pif, else if (sa.sa_family == AF_INET6) ifname = c->ip6.ifname_out; - return sock_l4(c, type, &sa, ifname); + return sock_l4(c, type, &sa, ifname, exclusive); case PIF_SPLICE: { struct flowside_sock_args args = { .c = c, .type = type, .sa = &sa, }; + + /* Exclusive binds are only for host-side sockets of flows + * initiated from the tap interface, which never target the + * namespace + */ + assert(!exclusive); + NS_CALL(flowside_sock_splice, &args); errno = args.err; return args.fd; |
