about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-09-25 20:32:11 +0100
committerGitHub <noreply@github.com>2017-09-25 20:32:11 +0100
commit08b827ae8e229ccf261bbe8d8ce730c566086187 (patch)
tree2da02abfe4da129d6957512a7bec0ee3f11ae013 /nixos
parent8ccce8de891923b40b897c11f9a494c6b3722a58 (diff)
parent846070e028a6ce6213dc4af3477dc67d73ec3364 (diff)
downloadnixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar.gz
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar.bz2
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar.lz
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar.xz
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.tar.zst
nixlib-08b827ae8e229ccf261bbe8d8ce730c566086187.zip
Merge pull request #29753 from andir/wireguard-allowed-ips-as-route-optional
networking.wireguard: added `allowedIpsAsRoutes` boolean to control p…
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/wireguard.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix
index 4f54b45639f6..27ca0bcc5747 100644
--- a/nixos/modules/services/networking/wireguard.nix
+++ b/nixos/modules/services/networking/wireguard.nix
@@ -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
           ]);