bird: implement ospf.allowedUpstreams6

This commit is contained in:
Astro 2022-09-18 01:37:57 +02:00
parent 7be3b761e6
commit f8c1c17a1d
2 changed files with 16 additions and 3 deletions

View File

@ -394,6 +394,11 @@ let
default = []; default = [];
description = "Accept default routes from these OSPF routers, in order of preference"; description = "Accept default routes from these OSPF routers, in order of preference";
}; };
ospf.allowedUpstreams6 = mkOption {
type = with types; listOf str;
default = config.site.hosts.${name}.ospf.allowedUpstreams;
description = "Accept IPv6 default routes from these OSPF3 routers, in order of preference";
};
ospf.upstreamInstance = mkOption { ospf.upstreamInstance = mkOption {
type = with types; nullOr int; type = with types; nullOr int;
default = null; default = null;

View File

@ -227,7 +227,11 @@ in
builtins.mapAttrs (net: _: builtins.mapAttrs (net: _:
# Enable OSPF only on interfaces with a secret. # Enable OSPF only on interfaces with a secret.
lib.optionalString (config.site.net.${net}.ospf.secret != null) '' lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
interface "${net}" instance ${toString config.site.hosts.${upstream}.ospf.upstreamInstance} { interface "${net}" instance ${
builtins.replaceStrings [ "-" ] [ "_" ] (
toString config.site.hosts.${upstream}.ospf.upstreamInstance
)
} {
hello 10; hello 10;
wait 20; wait 20;
authentication cryptographic; authentication cryptographic;
@ -333,7 +337,11 @@ in
builtins.mapAttrs (net: _: builtins.mapAttrs (net: _:
# Enable OSPF only on interfaces with a secret. # Enable OSPF only on interfaces with a secret.
lib.optionalString (config.site.net.${net}.ospf.secret != null) '' lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
interface "${net}" instance ${toString config.site.hosts.${upstream}.ospf.upstreamInstance} { interface "${net}" instance ${
builtins.replaceStrings [ "-" ] [ "_" ] (
toString config.site.hosts.${upstream}.ospf.upstreamInstance
)
} {
hello 10; hello 10;
wait 20; wait 20;
authentication cryptographic; authentication cryptographic;
@ -347,7 +355,7 @@ in
} }
''; '';
n = n + 1; n = n + 1;
}) { text = ""; n = 0; } hostConf.ospf.allowedUpstreams }) { text = ""; n = 0; } hostConf.ospf.allowedUpstreams6
).text} ).text}
# Zentralwerk DN42 # Zentralwerk DN42