From 11fce2a4a5f0e68bc8b651d73dbd17c77c5b5d12 Mon Sep 17 00:00:00 2001 From: gaoyuheng Date: Sat, 23 May 2026 18:06:55 +0800 Subject: [PATCH] 10 --- bird/function/dn42.conf | 21 ++++----------------- bird/template/dn42.conf | 24 +++++++++++------------- ip-policy-rules | 2 -- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/bird/function/dn42.conf b/bird/function/dn42.conf index b1efe32..cd4e342 100644 --- a/bird/function/dn42.conf +++ b/bird/function/dn42.conf @@ -1,22 +1,9 @@ -define DN42_PREFIXES_V4 = [ - 172.20.0.0/14+ -]; -define DN42_PREFIXES_V6 = [ - fd00::/8+ -]; - function is_dn42_prefix() { - case net.type { - NET_IP4: return net ~ DN42_PREFIXES_V4; - NET_IP6: return net ~ DN42_PREFIXES_V6; - else: print "is_dn42_prefix: unexpected net.type ", net.type, " ", net; return false; - } + return net ~ [ + 172.20.0.0/14+ + ]; } function is_dn42_self_net() { - case net.type { - NET_IP4: return net ~ is_dn42_self_IPv4; - NET_IP6: return net ~ is_dn42_self_IPv6; - else: print "is_dn42_prefix: unexpected net.type ", net.type, " ", net; return false; - } + return net ~ is_dn42_self_IPv4; } \ No newline at end of file diff --git a/bird/template/dn42.conf b/bird/template/dn42.conf index 9cf236b..06cc71c 100644 --- a/bird/template/dn42.conf +++ b/bird/template/dn42.conf @@ -20,6 +20,17 @@ template bgp dn42_up1_new { ipv6 {import none;export none;}; } +template bgp dn42_ds { + graceful restart; + local as DN42_ASN; + ipv4 { + table dn42v4; + import filter {if !function_inet6_downstream_import() then reject; accept; }; + export filter {if !function_inet6_downstream_export() then reject; accept; }; + }; + ipv6 {import none;export none;}; +} + template bgp dn42_ibgp_new { graceful restart; local as DN42_ASN; @@ -33,17 +44,4 @@ template bgp dn42_ibgp_new { export filter {if !function_dn42_ibgp_export() then reject; accept; }; }; ipv6 {import none;export none;}; -} - - -template bgp dn42_ibgp_mp_new { - graceful restart; - local as DN42_ASN; - med metric; - ipv4 { - table dn42v4; - import filter {if !function_dn42_ibgp_import() then reject; accept; }; - export filter {if !function_dn42_ibgp_export() then reject; accept; }; - }; - ipv6 {import none;export none;}; } \ No newline at end of file diff --git a/ip-policy-rules b/ip-policy-rules index b748351..cbf1aa2 100644 --- a/ip-policy-rules +++ b/ip-policy-rules @@ -24,8 +24,6 @@ trigger() { #空格来分隔不同的前缀 ALL_TUNNEL_SUBNETS="44.32.191.0/24" BASE_PRIORITY=200 -LAN_SUBNET_V4="172.20.0.0/14" -LAN_SUBNET_V6_FD="fd00::/8" TUNNEL_SUBNET_V6="2000::/3" add_rules() {