diff options
| -rw-r--r-- | conf.c | 7 | ||||
| -rw-r--r-- | passt.h | 2 | ||||
| -rw-r--r-- | util.c | 8 |
3 files changed, 16 insertions, 1 deletions
@@ -1254,7 +1254,9 @@ void conf(struct ctx *c, int argc, char **argv) int name, ret; uid_t uid; gid_t gid; - + + if (c->no_ipv6) + v4_only = true; if (c->mode == MODE_PASTA) c->no_dhcp_dns = c->no_dhcp_dns_search = 1; @@ -1682,6 +1684,9 @@ void conf(struct ctx *c, int argc, char **argv) v6_only = false; break; case '6': + if (c->no_ipv6) + die("IPv6 not available but --ipv6-only given"); + v6_only = true; v4_only = false; break; @@ -211,6 +211,7 @@ struct ip6_ctx { * @low_wmem: Low probed net.core.wmem_max * @low_rmem: Low probed net.core.rmem_max * @no_bindtodevice: Unprivileged SO_BINDTODEVICE not available + * @no_ipv6: IPv6 sockets not available * @vdev: vhost-user device * @device_state_fd: Device state migration channel * @device_state_result: Device state migration result @@ -296,6 +297,7 @@ struct ctx { int low_wmem; int low_rmem; int no_bindtodevice; + bool no_ipv6; struct vu_dev *vdev; @@ -334,6 +334,14 @@ void sock_probe_features(struct ctx *c) c->no_bindtodevice = 1; } + /* Check if IPv6 sockets are usable */ + close(s); + s = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP); + if (s < 0) { + c->no_ipv6 = true; + return; + } + close(s); } |
