commit:     e04d54da670198ce0aff2fe1577fbd3c44b15c26
Author:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 28 18:51:30 2024 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Wed Aug 28 18:54:05 2024 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e04d54da

Disable IPv6 on subdevices for bonding and bridges

Rather than shelling out to the `sysctl` command like the PR does,
let's write directly to `/proc/sys` after checking that it exists.

This likely needs work to do the same thing on BSD.

Closes: https://bugs.gentoo.org/515640
Closes: https://github.com/gentoo/netifrc/pull/55
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 net/bonding.sh | 2 ++
 net/bridge.sh  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/bonding.sh b/net/bonding.sh
index e3fcaa7..bb8b061 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -133,6 +133,8 @@ bonding_pre_start()
                for IFACE in ${slaves}; do
                        _delete_addresses
                        _down
+                       local 
disable_ipv6="/proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6"
+                       [ -f "${disable_ipv6}" ] && printf '1\n' > 
"${disable_ipv6}"
                done
        fi
        )

diff --git a/net/bridge.sh b/net/bridge.sh
index a380f6a..cea8a49 100644
--- a/net/bridge.sh
+++ b/net/bridge.sh
@@ -152,6 +152,8 @@ bridge_pre_start()
                                return 1
                        fi
                        # The interface is known to exist now
+                       local 
disable_ipv6="/proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6"
+                       [ -f "${disable_ipv6}" ] && printf '1\n' > 
"${disable_ipv6}"
                        _up
                        if ${do_iproute2}; then
                                _netns ip link set "${x}" master "${BR_IFACE}"

Reply via email to