aboutgitcodebugslistschat
diff options
context:
space:
mode:
-rw-r--r--tcp.c4
-rw-r--r--udp.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/tcp.c b/tcp.c
index 713248f..d043123 100644
--- a/tcp.c
+++ b/tcp.c
@@ -3213,9 +3213,9 @@ static void tcp_sock_init6(const struct ctx *c, int ns,
void tcp_sock_init(const struct ctx *c, int ns, sa_family_t af,
const void *addr, const char *ifname, in_port_t port)
{
- if (af == AF_INET || af == AF_UNSPEC)
+ if ((af == AF_INET || af == AF_UNSPEC) && c->ifi4)
tcp_sock_init4(c, ns, addr, ifname, port);
- if (af == AF_INET6 || af == AF_UNSPEC)
+ if ((af == AF_INET6 || af == AF_UNSPEC) && c->ifi6)
tcp_sock_init6(c, ns, addr, ifname, port);
}
diff --git a/udp.c b/udp.c
index 42a17a7..ff7f993 100644
--- a/udp.c
+++ b/udp.c
@@ -1129,7 +1129,7 @@ void udp_sock_init(const struct ctx *c, int ns, sa_family_t af,
c->udp.fwd_in.f.delta[port]);
}
- if (af == AF_INET || af == AF_UNSPEC) {
+ if ((af == AF_INET || af == AF_UNSPEC) && c->ifi4) {
if (!addr && c->mode == MODE_PASTA)
bind_addr = &c->ip4.addr;
else
@@ -1162,7 +1162,7 @@ void udp_sock_init(const struct ctx *c, int ns, sa_family_t af,
}
}
- if (af == AF_INET6 || af == AF_UNSPEC) {
+ if ((af == AF_INET6 || af == AF_UNSPEC) && c->ifi6) {
if (!addr && c->mode == MODE_PASTA)
bind_addr = &c->ip6.addr;
else