nixos-module/container/bird: simplify filters

This commit is contained in:
Astro 2021-04-30 23:02:31 +02:00
parent 692e12f07d
commit eda2bc3b55
1 changed files with 11 additions and 51 deletions

View File

@ -39,20 +39,10 @@ in
export all; export all;
''} ''}
${lib.optionalString isUpstream '' ${lib.optionalString isUpstream ''
export filter { # Do not set another default route on upstreams
if net = 0.0.0.0/0 then { export where net != 0.0.0.0/0;
# Do not set another default route on upstreams # Learn the upstream default route
reject; import where net = 0.0.0.0/0;
}
accept;
};
import filter {
if net = 0.0.0.0/0 then {
# Learn the upstream default route
accept;
}
reject;
};
''} ''}
}; };
} }
@ -63,20 +53,10 @@ in
export all; export all;
''} ''}
${lib.optionalString isUpstream '' ${lib.optionalString isUpstream ''
export filter { # Do not set another default route on upstreams
if net = ::/0 then { export where net != ::/0;
# Do not set another default route on upstreams
reject;
}
accept;
};
# Learn the upstream default route # Learn the upstream default route
import filter { import where net = ::/0;
if net = ::/0 then {
accept;
}
reject;
};
''} ''}
}; };
} }
@ -125,12 +105,7 @@ in
# OSPFv2 for site-local IPv4 # OSPFv2 for site-local IPv4
protocol ospf v2 ZW4 { protocol ospf v2 ZW4 {
ipv4 { ipv4 {
export filter { export where net != 0.0.0.0/0;
if net = 0.0.0.0/0 then {
reject;
}
accept;
};
}; };
area 0 { area 0 {
# Enabled on these networks # Enabled on these networks
@ -174,12 +149,7 @@ in
# OSPFv2 to advertise my default route # OSPFv2 to advertise my default route
protocol ospf v2 ZW4_${hostName} { protocol ospf v2 ZW4_${hostName} {
ipv4 { ipv4 {
export filter { export where net = 0.0.0.0/0;
if net = 0.0.0.0/0 then {
accept;
}
reject;
};
}; };
area ${config.site.net.core.hosts4.${hostName}} { area ${config.site.net.core.hosts4.${hostName}} {
# Enabled on these networks # Enabled on these networks
@ -251,12 +221,7 @@ in
# OSPFv3 for site-local IPv6 # OSPFv3 for site-local IPv6
protocol ospf v3 ZW6 { protocol ospf v3 ZW6 {
ipv6 { ipv6 {
export filter { export where net != ::/0;
if net = ::/0 then {
reject;
}
accept;
};
}; };
area 0 { area 0 {
# Enabled on these networks # Enabled on these networks
@ -302,12 +267,7 @@ in
# OSPFv3 to advertise my default route # OSPFv3 to advertise my default route
protocol ospf v3 ZW6_${hostName} { protocol ospf v3 ZW6_${hostName} {
ipv6 { ipv6 {
export filter { export where net = ::/0;
if net = ::/0 then {
accept;
}
reject;
};
}; };
area ${config.site.net.core.hosts4.${hostName}} { area ${config.site.net.core.hosts4.${hostName}} {
# Enabled on these networks # Enabled on these networks