Skip to content

Commit f86e8ba

Browse files
pks-tastro
authored andcommitted
fix: only disable IPv6 when present
When the host has IPv6 disabled via "ipv6.disable=1" completely the service to setup up a macvtap interface fails because it tries to write to the nonexistant "/proc/sys/net/ipv6" directory. Fix this by checking for its presence first.
1 parent 5f0ab79 commit f86e8ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nixos-modules/microvm/interfaces.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ in
4848
fi
4949
${pkgs.iproute2}/bin/ip link add link '${macvtap.link}' name '${id}' address '${mac}' type macvtap mode '${macvtap.mode}'
5050
${pkgs.iproute2}/bin/ip link set '${id}' allmulticast on
51-
echo 1 > "/proc/sys/net/ipv6/conf/${id}/disable_ipv6"
51+
if [ -f "/proc/sys/net/ipv6/conf/${id}/disable_ipv6" ]; then
52+
echo 1 > "/proc/sys/net/ipv6/conf/${id}/disable_ipv6"
53+
fi
5254
${pkgs.iproute2}/bin/ip link set '${id}' up
5355
${pkgs.coreutils-full}/bin/chown '${user}:${group}' /dev/tap$(< "/sys/class/net/${id}/ifindex")
5456
'') macvtapInterfaces;

0 commit comments

Comments
 (0)