modules/wireguard: ignore errors when add ip route

This commit is contained in:
Dmitriy Pleshevskiy 2024-09-29 15:21:51 +03:00
parent e813ce3c9a
commit 17b9c93563
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -54,7 +54,7 @@ in
addr=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $3; exit}'`
interface=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $5; exit}'`
'' + lib.concatLines (map
(addr: "${pkgs.iproute}/bin/ip route add ${addr} via $addr dev $interface")
(addr: "${pkgs.iproute}/bin/ip route add ${addr} via $addr dev $interface || true")
addrsViaDefaultInterface
);
@ -62,7 +62,7 @@ in
addr=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $3; exit}'`
interface=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $5; exit}'`
'' + lib.concatLines (map
(addr: "${pkgs.iproute}/bin/ip route del ${addr} via $addr dev $interface")
(addr: "${pkgs.iproute}/bin/ip route del ${addr} via $addr dev $interface || true")
addrsViaDefaultInterface
);