From 17b9c93563aa00bcf63da3ff23b6d657f4be7608 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 29 Sep 2024 15:21:51 +0300 Subject: [PATCH] modules/wireguard: ignore errors when add ip route --- modules/nixos/services/vpn/wireguard/client.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nixos/services/vpn/wireguard/client.nix b/modules/nixos/services/vpn/wireguard/client.nix index 14868e1..32661ec 100644 --- a/modules/nixos/services/vpn/wireguard/client.nix +++ b/modules/nixos/services/vpn/wireguard/client.nix @@ -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 );