dn42: fix wireguard pointopoint routes

This commit is contained in:
Astro 2020-04-24 20:42:52 +02:00
parent 5e34762669
commit b28eb471f8
1 changed files with 5 additions and 2 deletions

View File

@ -76,9 +76,12 @@ in {
let let
wireguardNeighbors = lib.filterAttrs (_: conf: conf ? wireguard) neighbors; wireguardNeighbors = lib.filterAttrs (_: conf: conf ? wireguard) neighbors;
in in
builtins.mapAttrs (_: conf: { builtins.mapAttrs (name: conf: {
inherit (conf.wireguard) listenPort privateKey; inherit (conf.wireguard) listenPort privateKey;
ips = [ "${address4}/32" "${address6}/128" ]; ips = [ "${address4}/32" "${address6}/64" ];
postSetup = ''
${pkgs.iproute}/bin/ip route add ${address4}/32 dev ${name}
'';
peers = [ ({ peers = [ ({
inherit (conf.wireguard) publicKey; inherit (conf.wireguard) publicKey;
allowedIPs = [ "0.0.0.0/0" "::0/0" ]; allowedIPs = [ "0.0.0.0/0" "::0/0" ];