Skip to content

Commit

Permalink
fix: only disable IPv6 when present
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pks-t authored and astro committed Dec 6, 2024
1 parent 5f0ab79 commit f86e8ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nixos-modules/microvm/interfaces.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ in
fi
${pkgs.iproute2}/bin/ip link add link '${macvtap.link}' name '${id}' address '${mac}' type macvtap mode '${macvtap.mode}'
${pkgs.iproute2}/bin/ip link set '${id}' allmulticast on
echo 1 > "/proc/sys/net/ipv6/conf/${id}/disable_ipv6"
if [ -f "/proc/sys/net/ipv6/conf/${id}/disable_ipv6" ]; then
echo 1 > "/proc/sys/net/ipv6/conf/${id}/disable_ipv6"
fi
${pkgs.iproute2}/bin/ip link set '${id}' up
${pkgs.coreutils-full}/bin/chown '${user}:${group}' /dev/tap$(< "/sys/class/net/${id}/ifindex")
'') macvtapInterfaces;
Expand Down

0 comments on commit f86e8ba

Please sign in to comment.