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