|
|
|
@ -145,13 +145,13 @@ in
|
|
|
|
|
ipv4 {
|
|
|
|
|
export where net = 0.0.0.0/0;
|
|
|
|
|
};
|
|
|
|
|
area ${config.site.net.core.hosts4.${hostName}} {
|
|
|
|
|
area 0 {
|
|
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
|
builtins.attrValues (
|
|
|
|
|
builtins.mapAttrs (net: _:
|
|
|
|
|
# Enable OSPF only on interfaces with a secret.
|
|
|
|
|
lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
|
|
|
|
|
interface "${net}" instance 1 {
|
|
|
|
|
interface "${net}" instance ${toString hostConf.ospf.upstreamInstance} {
|
|
|
|
|
authentication cryptographic;
|
|
|
|
|
password "${config.site.net.${net}.ospf.secret}";
|
|
|
|
|
};
|
|
|
|
@ -164,28 +164,28 @@ in
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${(
|
|
|
|
|
builtins.foldl' ({ text, instance }: upstream: {
|
|
|
|
|
builtins.foldl' ({ text, n }: upstream: {
|
|
|
|
|
text = ''
|
|
|
|
|
${text}
|
|
|
|
|
|
|
|
|
|
# OSPFv2 to receive a default route
|
|
|
|
|
# OSPFv2 to receive a default route from ${upstream}
|
|
|
|
|
protocol ospf v2 ZW4_${upstream} {
|
|
|
|
|
ipv4 {
|
|
|
|
|
export filter {
|
|
|
|
|
preference = preference + 100 - ${toString instance};
|
|
|
|
|
import filter {
|
|
|
|
|
preference = preference + ${toString (100 - n)};
|
|
|
|
|
accept;
|
|
|
|
|
};
|
|
|
|
|
${lib.optionalString (builtins.match "anon.*" hostName != null) ''
|
|
|
|
|
table vpn4_table;
|
|
|
|
|
''}
|
|
|
|
|
};
|
|
|
|
|
area ${config.site.net.core.hosts4.${upstream}} {
|
|
|
|
|
area 0 {
|
|
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
|
builtins.attrValues (
|
|
|
|
|
builtins.mapAttrs (net: _:
|
|
|
|
|
# Enable OSPF only on interfaces with a secret.
|
|
|
|
|
lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
|
|
|
|
|
interface "${net}" instance ${toString instance} {
|
|
|
|
|
interface "${net}" instance ${toString config.site.hosts.${upstream}.ospf.upstreamInstance} {
|
|
|
|
|
authentication cryptographic;
|
|
|
|
|
password "${config.site.net.${net}.ospf.secret}";
|
|
|
|
|
};
|
|
|
|
@ -196,8 +196,8 @@ in
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
instance = instance + 1;
|
|
|
|
|
}) { text = ""; instance = 2; } config.site.hosts.${hostName}.ospf.allowedUpstreams
|
|
|
|
|
n = n + 1;
|
|
|
|
|
}) { text = ""; n = 0; } hostConf.ospf.allowedUpstreams
|
|
|
|
|
).text}
|
|
|
|
|
|
|
|
|
|
# OSPFv3 for site-local IPv6
|
|
|
|
@ -245,13 +245,13 @@ in
|
|
|
|
|
ipv6 {
|
|
|
|
|
export where net = ::/0;
|
|
|
|
|
};
|
|
|
|
|
area ${config.site.net.core.hosts4.${hostName}} {
|
|
|
|
|
area 0 {
|
|
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
|
builtins.attrValues (
|
|
|
|
|
builtins.mapAttrs (net: _:
|
|
|
|
|
# Enable OSPF only on interfaces with a secret.
|
|
|
|
|
lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
|
|
|
|
|
interface "${net}" instance 1 {
|
|
|
|
|
interface "${net}" instance ${toString hostConf.ospf.upstreamInstance} {
|
|
|
|
|
authentication cryptographic;
|
|
|
|
|
password "${config.site.net.${net}.ospf.secret}";
|
|
|
|
|
};
|
|
|
|
@ -263,26 +263,26 @@ in
|
|
|
|
|
}
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${lib.optionalString (builtins.match "anon.*" hostName != null) (
|
|
|
|
|
builtins.foldl' ({ text, instance }: upstream: {
|
|
|
|
|
${lib.optionalString (builtins.match "anon.*" hostName == null) (
|
|
|
|
|
builtins.foldl' ({ text, n }: upstream: {
|
|
|
|
|
text = ''
|
|
|
|
|
${text}
|
|
|
|
|
|
|
|
|
|
# OSPFv3 to receive a default route
|
|
|
|
|
# OSPFv3 to receive a default route from ${upstream}
|
|
|
|
|
protocol ospf v3 ZW6_${upstream} {
|
|
|
|
|
ipv6 {
|
|
|
|
|
export filter {
|
|
|
|
|
preference = preference + 100 - ${toString instance};
|
|
|
|
|
import filter {
|
|
|
|
|
preference = preference + ${toString (100 - n)};
|
|
|
|
|
accept;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
area ${config.site.net.core.hosts4.${upstream}} {
|
|
|
|
|
area 0 {
|
|
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
|
builtins.attrValues (
|
|
|
|
|
builtins.mapAttrs (net: _:
|
|
|
|
|
# Enable OSPF only on interfaces with a secret.
|
|
|
|
|
lib.optionalString (config.site.net.${net}.ospf.secret != null) ''
|
|
|
|
|
interface "${net}" instance ${toString instance} {
|
|
|
|
|
interface "${net}" instance ${toString config.site.hosts.${upstream}.ospf.upstreamInstance} {
|
|
|
|
|
authentication cryptographic;
|
|
|
|
|
password "${config.site.net.${net}.ospf.secret}";
|
|
|
|
|
};
|
|
|
|
@ -293,8 +293,8 @@ in
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
instance = instance + 1;
|
|
|
|
|
}) { text = ""; instance = 2; } config.site.hosts.${hostName}.ospf.allowedUpstreams
|
|
|
|
|
n = n + 1;
|
|
|
|
|
}) { text = ""; n = 0; } hostConf.ospf.allowedUpstreams
|
|
|
|
|
).text}
|
|
|
|
|
|
|
|
|
|
# Zentralwerk DN42
|
|
|
|
|