nixos-module/container/bird: simplify filter operations

This commit is contained in:
Astro 2021-04-30 00:16:00 +02:00
parent 67acfb140b
commit 6b6f3d5598
1 changed files with 7 additions and 7 deletions

View File

@ -40,14 +40,14 @@ in
''}
${lib.optionalString isUpstream ''
export filter {
if net ~ [ 0.0.0.0/0 ] then {
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 {
if net = 0.0.0.0/0 then {
# Learn the upstream default route
accept;
}
@ -64,7 +64,7 @@ in
''}
${lib.optionalString isUpstream ''
export filter {
if net ~ [ ::/0 ] then {
if net = ::/0 then {
# Do not set another default route on upstreams
reject;
}
@ -72,7 +72,7 @@ in
};
# Learn the upstream default route
import filter {
if net ~ [ ::/0 ] then {
if net = ::/0 then {
accept;
}
reject;
@ -90,7 +90,7 @@ in
table master4;
peer table vpn4_table;
export filter {
if net ~ [ 0.0.0.0/0 ] then {
if net = 0.0.0.0/0 then {
# Copy default route to vpn4 table
accept;
}
@ -137,7 +137,7 @@ in
ipv4 {
export all;
import filter {
if net ~ [ 0.0.0.0/0 ] then {
if net = 0.0.0.0/0 then {
${(builtins.foldl' (result: gateway: {
text = ''
${result.text}
@ -197,7 +197,7 @@ in
ipv6 {
export all;
import filter {
if net ~ [ ::/0 ] then {
if net = ::/0 then {
${(builtins.foldl' (result: gateway: {
text = ''
${result.text}