Loading nixos/modules/tasks/network-interfaces-scripted.nix +5 −5 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ let script = '' # Remove Dead Interfaces echo "Removing old bridge ${n}..." ip link show "${n}" >/dev/null 2>&1 && ip link del "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link del "${n}" echo "Adding bridge ${n}..." ip link add name "${n}" type bridge Loading Loading @@ -459,7 +459,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add link "${v.interface}" name "${n}" type macvlan \ ${optionalString (v.mode != null) "mode ${v.mode}"} ip link set "${n}" up Loading Loading @@ -517,7 +517,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add name "${n}" type sit \ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \ ${optionalString (v.local != null) "local \"${v.local}\""} \ Loading Loading @@ -551,7 +551,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add name "${n}" type ${v.type} \ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \ ${optionalString (v.local != null) "local \"${v.local}\""} \ Loading Loading @@ -579,7 +579,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add link "${v.interface}" name "${n}" type vlan id "${toString v.id}" # We try to bring up the logical VLAN interface. If the master Loading nixos/tests/networking.nix +25 −0 Original line number Diff line number Diff line Loading @@ -998,6 +998,31 @@ let machine.fail("ip address show wlan0 | grep -q ${testMac}") ''; }; naughtyInterfaceNames = let ifnames = [ # flags of ip-address "home" "temporary" "optimistic" "bridge_slave" "flush" # flags of ip-route "up" "type" "nomaster" "address" # other "very_loong_name" "lowerUpper" "-" ]; in { name = "naughtyInterfaceNames"; nodes.machine = { pkgs, ... }: { networking.useNetworkd = networkd; networking.bridges = listToAttrs (flip map ifnames (name: { inherit name; value.interfaces = []; })); }; testScript = '' machine.start() machine.wait_for_unit("network.target") for ifname in ${builtins.toJSON ifnames}: machine.wait_until_succeeds(f"ip link show dev '{ifname}' | grep -q '{ifname}'") ''; }; caseSensitiveRenaming = { name = "CaseSensitiveRenaming"; nodes.machine = { pkgs, ... }: { Loading Loading
nixos/modules/tasks/network-interfaces-scripted.nix +5 −5 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ let script = '' # Remove Dead Interfaces echo "Removing old bridge ${n}..." ip link show "${n}" >/dev/null 2>&1 && ip link del "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link del "${n}" echo "Adding bridge ${n}..." ip link add name "${n}" type bridge Loading Loading @@ -459,7 +459,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add link "${v.interface}" name "${n}" type macvlan \ ${optionalString (v.mode != null) "mode ${v.mode}"} ip link set "${n}" up Loading Loading @@ -517,7 +517,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add name "${n}" type sit \ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \ ${optionalString (v.local != null) "local \"${v.local}\""} \ Loading Loading @@ -551,7 +551,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add name "${n}" type ${v.type} \ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \ ${optionalString (v.local != null) "local \"${v.local}\""} \ Loading Loading @@ -579,7 +579,7 @@ let path = [ pkgs.iproute2 ]; script = '' # Remove Dead Interfaces ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link show dev "${n}" >/dev/null 2>&1 && ip link delete "${n}" ip link add link "${v.interface}" name "${n}" type vlan id "${toString v.id}" # We try to bring up the logical VLAN interface. If the master Loading
nixos/tests/networking.nix +25 −0 Original line number Diff line number Diff line Loading @@ -998,6 +998,31 @@ let machine.fail("ip address show wlan0 | grep -q ${testMac}") ''; }; naughtyInterfaceNames = let ifnames = [ # flags of ip-address "home" "temporary" "optimistic" "bridge_slave" "flush" # flags of ip-route "up" "type" "nomaster" "address" # other "very_loong_name" "lowerUpper" "-" ]; in { name = "naughtyInterfaceNames"; nodes.machine = { pkgs, ... }: { networking.useNetworkd = networkd; networking.bridges = listToAttrs (flip map ifnames (name: { inherit name; value.interfaces = []; })); }; testScript = '' machine.start() machine.wait_for_unit("network.target") for ifname in ${builtins.toJSON ifnames}: machine.wait_until_succeeds(f"ip link show dev '{ifname}' | grep -q '{ifname}'") ''; }; caseSensitiveRenaming = { name = "CaseSensitiveRenaming"; nodes.machine = { pkgs, ... }: { Loading