From: Alexander Mikhalitsyn Date: Mon, 8 Apr 2024 10:21:21 +0000 (+0200) Subject: lxc/network: handle non-existing sysctl /disable_ipv6 X-Git-Tag: v6.0.1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd8d5b747fc7256be97df6381e1f6e6451f8e00c;p=thirdparty%2Flxc.git lxc/network: handle non-existing sysctl /disable_ipv6 Skip writting to /proc/sys/net/ipv6/conf//disable_ipv6 if it does not exist. Fixes: #4431 Signed-off-by: Alexander Mikhalitsyn --- diff --git a/src/lxc/network.c b/src/lxc/network.c index 09666a76c..2a6ba6cb4 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -722,15 +722,15 @@ static int netdev_configure_server_veth(struct lxc_handler *handler, struct lxc_ if (disable_ipv6_fd < 0 && errno != ENOENT) { SYSERROR("Failed to disable IPv6 link-local addresses for veth pair \"%s\"", veth1); goto out_delete; + } else if (disable_ipv6_fd >= 0) { + err = write(disable_ipv6_fd, "1", 1); + if (err < 0) { + SYSERROR("Failed to disable IPv6 link-local addresses for veth pair \"%s\"", veth1); + goto out_delete; + } + close(disable_ipv6_fd); } - err = write(disable_ipv6_fd, "1", 1); - if (err < 0) { - SYSERROR("Failed to disable IPv6 link-local addresses for veth pair \"%s\"", veth1); - goto out_delete; - } - close(disable_ipv6_fd); - if (!lxc_nic_exists(netdev->link)) { SYSERROR("Failed to attach \"%s\" to bridge \"%s\", bridge interface doesn't exist", veth1, netdev->link); goto out_delete;