diff options
author | pennae <82953136+pennae@users.noreply.github.com> | 2022-03-24 08:10:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 08:10:23 +0000 |
commit | 67281c4d2918368eb57fa03ffcb93dcaf08c7edb (patch) | |
tree | 82783aaeccc17877515bdbd369975b6a3e323be7 /nixos/modules | |
parent | d641d4074c23a7545756d02344b6b645aa85b9cd (diff) | |
parent | 19bb72c07070597f75f78ecc8673afde75fd7a4b (diff) | |
download | nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar.gz nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar.bz2 nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar.lz nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar.xz nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.tar.zst nixlib-67281c4d2918368eb57fa03ffcb93dcaf08c7edb.zip |
Merge pull request #165285 from jpathy/patch-2
networking.greTunnels: Add ttl option
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/tasks/network-interfaces-scripted.nix | 2 | ||||
-rw-r--r-- | nixos/modules/tasks/network-interfaces-systemd.nix | 2 | ||||
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 11 |
3 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 19f2be2c4a25..b0f160c1dbf9 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -535,6 +535,7 @@ let createGreDevice = n: v: nameValuePair "${n}-netdev" (let deps = deviceDependency v.dev; + ttlarg = if lib.hasPrefix "ip6" v.type then "hoplimit" else "ttl"; in { description = "GRE Tunnel Interface ${n}"; wantedBy = [ "network-setup.service" (subsystemDevice n) ]; @@ -551,6 +552,7 @@ let ip link add name "${n}" type ${v.type} \ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \ ${optionalString (v.local != null) "local \"${v.local}\""} \ + ${optionalString (v.ttl != null) "${ttlarg} ${toString v.ttl}"} \ ${optionalString (v.dev != null) "dev \"${v.dev}\""} ip link set "${n}" up ''; diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 8a5e1b5af114..8654539b6629 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -318,6 +318,8 @@ in Remote = gre.remote; }) // (optionalAttrs (gre.local != null) { Local = gre.local; + }) // (optionalAttrs (gre.ttl != null) { + TTL = gre.ttl; }); }; networks = mkIf (gre.dev != null) { diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 01980b80f1cf..60b5a48b2e62 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -1020,12 +1020,14 @@ in local = "10.0.0.22"; dev = "enp4s0f0"; type = "tap"; + ttl = 255; }; gre6Tunnel = { remote = "fd7a:5634::1"; local = "fd7a:5634::2"; dev = "enp4s0f0"; type = "tun6"; + ttl = 255; }; } ''; @@ -1063,6 +1065,15 @@ in ''; }; + ttl = mkOption { + type = types.nullOr types.int; + default = null; + example = 255; + description = '' + The time-to-live/hoplimit of the connection to the remote tunnel endpoint. + ''; + }; + type = mkOption { type = with types; enum [ "tun" "tap" "tun6" "tap6" ]; default = "tap"; |