[lxc-devel] [lxc/master] disable ipv6 upon creating a bridge in lxc-net.in and enable it on user specifications

AndrewElvisDeng on Github lxc-bot at linuxcontainers.org
Sat Dec 5 23:35:52 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 390 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201205/c3048b5f/attachment.bin>
-------------- next part --------------
From f22affcce77bb35f1f961cb154f5141370cd1815 Mon Sep 17 00:00:00 2001
From: Andrew Deng <adeng1433 at gmail.com>
Date: Sat, 5 Dec 2020 17:32:56 -0600
Subject: [PATCH] disable ipv6 upon creating a bridge in lxc-net.in and enable
 it on user specifications

Signed-off-by: Andrew Deng <adeng1433 at gmail.com>
---
 config/init/common/lxc-net.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in
index a7dfa6f199..923b1ccd10 100644
--- a/config/init/common/lxc-net.in
+++ b/config/init/common/lxc-net.in
@@ -78,6 +78,7 @@ start() {
     [ ! -d /sys/class/net/${LXC_BRIDGE} ] && ip link add dev ${LXC_BRIDGE} type bridge
     echo 1 > /proc/sys/net/ipv4/ip_forward
     echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/accept_dad || true
+    echo 1 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/disable_ipv6
 
     # if we are run from systemd on a system with selinux enabled,
     # the mkdir will create /run/lxc as init_var_run_t which dnsmasq
@@ -93,6 +94,7 @@ start() {
 
     LXC_IPV6_ARG=""
     if [ -n "$LXC_IPV6_ADDR" ] && [ -n "$LXC_IPV6_MASK" ] && [ -n "$LXC_IPV6_NETWORK" ]; then
+        echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/disable_ipv6
         echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
         echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/autoconf
         ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK}


More information about the lxc-devel mailing list