Merge pull request #29753 from andir/wireguard-allowed-ips-as-route-optional

networking.wireguard: added `allowedIpsAsRoutes` boolean to control p…
This commit is contained in:
Jörg Thalheim 2017-09-25 20:32:11 +01:00 committed by GitHub
commit 08b827ae8e

View file

@ -95,6 +95,14 @@ let
type = with types; listOf (submodule peerOpts);
};
allowedIPsAsRoutes = mkOption {
example = false;
default = true;
type = types.bool;
description = ''
Determines whether to add allowed IPs as routes or not.
'';
};
};
};
@ -217,11 +225,11 @@ let
"${ipCommand} link set up dev ${name}"
(map (peer:
(lib.optional (values.allowedIPsAsRoutes != false) (map (peer:
(map (allowedIP:
"${ipCommand} route replace ${allowedIP} dev ${name} table ${values.table}"
) peer.allowedIPs)
) values.peers)
) values.peers))
values.postSetup
]);