dn42: fix wireguard pointopoint route

This commit is contained in:
Astro 2020-04-24 20:54:50 +02:00
parent 07779f2ff8
commit 2a039a3b3c
1 changed files with 3 additions and 2 deletions

View File

@ -79,8 +79,10 @@ in {
builtins.mapAttrs (name: conf: { builtins.mapAttrs (name: conf: {
inherit (conf.wireguard) listenPort privateKey; inherit (conf.wireguard) listenPort privateKey;
ips = [ "${address4}/32" "${address6}/64" ]; ips = [ "${address4}/32" "${address6}/64" ];
allowedIPsAsRoutes = false;
postSetup = '' postSetup = ''
${pkgs.iproute}/bin/ip route add ${conf.address4}/32 dev ${name} ${pkgs.iproute}/bin/ip addr del ${address4}/32 dev ${name}
${pkgs.iproute}/bin/ip addr add ${address4} dev ${name} ${conf.address4}/32
''; '';
peers = [ ({ peers = [ ({
inherit (conf.wireguard) publicKey; inherit (conf.wireguard) publicKey;
@ -89,7 +91,6 @@ in {
} // (lib.optionalAttrs (conf.wireguard ? endpoint) { } // (lib.optionalAttrs (conf.wireguard ? endpoint) {
inherit (conf.wireguard) endpoint; inherit (conf.wireguard) endpoint;
})) ]; })) ];
allowedIPsAsRoutes = false;
}) wireguardNeighbors; }) wireguardNeighbors;
}; };