Skip to content

Commit 5b39f29

Browse files
authored
force disable IPv6 if IPV6_METHOD = none (#9277)
* Enhance IPv6 disabling logic in install script Updated verb_ip6 to check both IPV6_METHOD and DISABLEIPV6 variables. Added disabling for all, default, and loopback interfaces, improved messaging, and redirected sysctl output to /dev/null for cleaner logs. * Improve IPv6 disabling logic in install scripts Updated both alpine-install.func and install.func to enhance IPv6 disabling by checking IPV6_METHOD and adding more sysctl settings. Also improved messaging and removed suppression of sysctl output in install.func.
1 parent 7349060 commit 5b39f29

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

misc/alpine-install.func

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ load_functions
1313
verb_ip6() {
1414
set_std_mode # Set STD mode based on VERBOSE
1515

16-
if [ "$DISABLEIPV6" == "yes" ]; then
16+
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then
17+
msg_info "Disabling IPv6"
1718
$STD sysctl -w net.ipv6.conf.all.disable_ipv6=1
19+
$STD sysctl -w net.ipv6.conf.default.disable_ipv6=1
20+
$STD sysctl -w net.ipv6.conf.lo.disable_ipv6=1
1821
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
22+
echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf
23+
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf
1924
$STD rc-update add sysctl default
25+
msg_ok "Disabled IPv6"
2026
fi
2127
}
2228

misc/install.func

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ load_functions
1515
verb_ip6() {
1616
set_std_mode # Set STD mode based on VERBOSE
1717

18-
if [ "$DISABLEIPV6" == "yes" ]; then
19-
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
18+
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then
19+
msg_info "Disabling IPv6"
20+
$STD echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
21+
$STD echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf
22+
$STD echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf
2023
$STD sysctl -p
24+
msg_ok "Disabled IPv6"
2125
fi
2226
}
2327

0 commit comments

Comments
 (0)