update
This commit is contained in:
@@ -1,74 +1,15 @@
|
|||||||
filter filter_inet4_bgp_import {
|
|
||||||
if is_self_net_inet4() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
bgp_large_community.add((LOCAL_ASN,200,0));
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet4_bgp_export {
|
|
||||||
if !is_self_net_inet4() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
if source != RTS_STATIC then reject;
|
|
||||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet6_bgp_import {
|
|
||||||
if is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
bgp_large_community.add((LOCAL_ASN,200,0));
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet6_bgp_export {
|
|
||||||
if !is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
if source != RTS_STATIC then reject;
|
|
||||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet4_ibgp_import {
|
|
||||||
if is_self_net_inet4() then reject;
|
|
||||||
if is_bogon_prefix() then reject;
|
|
||||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet4_ibgp_export {
|
|
||||||
if is_self_net_inet4() then reject;
|
|
||||||
if is_bogon_prefix() then reject;
|
|
||||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet6_ibgp_import {
|
|
||||||
if is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() then reject;
|
|
||||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter filter_inet6_ibgp_export {
|
|
||||||
if is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() then reject;
|
|
||||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
|
||||||
accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template bgp tpl_inet_up {
|
template bgp tpl_inet_up {
|
||||||
graceful restart;
|
graceful restart;
|
||||||
local as LOCAL_ASN;
|
local as LOCAL_ASN;
|
||||||
ipv4 {
|
ipv4 {
|
||||||
table inet4;
|
table inet4;
|
||||||
import filter filter_inet4_bgp_import;
|
import filter {if !function_inet4_bgp_import() then reject; accept; };
|
||||||
export filter filter_inet4_bgp_export;
|
export filter {if !function_inet4_bgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
ipv6 {
|
ipv6 {
|
||||||
table inet6;
|
table inet6;
|
||||||
import filter filter_inet6_bgp_import;
|
import filter {if !function_inet6_bgp_import() then reject; accept; };
|
||||||
export filter filter_inet6_bgp_export;
|
export filter {if !function_inet6_bgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +18,8 @@ template bgp tpl_inet4_up {
|
|||||||
local as LOCAL_ASN;
|
local as LOCAL_ASN;
|
||||||
ipv4 {
|
ipv4 {
|
||||||
table inet4;
|
table inet4;
|
||||||
import filter filter_inet4_bgp_import;
|
import filter {if !function_inet4_bgp_import() then reject; accept; };
|
||||||
export filter filter_inet4_bgp_export;
|
export filter {if !function_inet4_bgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,8 +28,8 @@ template bgp tpl_inet6_up {
|
|||||||
local as LOCAL_ASN;
|
local as LOCAL_ASN;
|
||||||
ipv6 {
|
ipv6 {
|
||||||
table inet6;
|
table inet6;
|
||||||
import filter filter_inet6_bgp_import;
|
import filter {if !function_inet6_bgp_import() then reject; accept; };
|
||||||
export filter filter_inet6_bgp_export;
|
export filter {if !function_inet6_bgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,15 +42,15 @@ template bgp tpl_inet_ibgp {
|
|||||||
table inet4;
|
table inet4;
|
||||||
next hop self;
|
next hop self;
|
||||||
gateway direct;
|
gateway direct;
|
||||||
import filter filter_inet4_ibgp_import;
|
import filter {if !function_inet4_ibgp_import() then reject; accept; };
|
||||||
export filter filter_inet4_ibgp_export;
|
export filter {if !function_inet4_ibgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
ipv6 {
|
ipv6 {
|
||||||
table inet6;
|
table inet6;
|
||||||
next hop self;
|
next hop self;
|
||||||
gateway direct;
|
gateway direct;
|
||||||
import filter filter_inet6_ibgp_import;
|
import filter {if !function_inet6_ibgp_import() then reject; accept; };
|
||||||
export filter filter_inet6_ibgp_export;
|
export filter {if !function_inet6_ibgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,8 +63,8 @@ template bgp tpl_inet4_ibgp {
|
|||||||
table inet4;
|
table inet4;
|
||||||
next hop self;
|
next hop self;
|
||||||
gateway direct;
|
gateway direct;
|
||||||
import filter filter_inet4_ibgp_import;
|
import filter {if !function_inet4_ibgp_import() then reject; accept; };
|
||||||
export filter filter_inet4_ibgp_export;
|
export filter {if !function_inet4_ibgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +77,7 @@ template bgp tpl_inet6_ibgp {
|
|||||||
table inet6;
|
table inet6;
|
||||||
next hop self;
|
next hop self;
|
||||||
gateway direct;
|
gateway direct;
|
||||||
import filter filter_inet6_ibgp_import;
|
import filter {if !function_inet6_ibgp_import() then reject; accept; };
|
||||||
export filter filter_inet6_ibgp_export;
|
export filter {if !function_inet6_ibgp_export() then reject; accept; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
57
bird/template/inet_filter_func.conf
Normal file
57
bird/template/inet_filter_func.conf
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
function function_inet4_bgp_import() {
|
||||||
|
if is_self_net_inet4() then return false;
|
||||||
|
if is_bogon_prefix() || (bgp_path.len > 100) then return false;
|
||||||
|
bgp_large_community.add((LOCAL_ASN,200,0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet4_bgp_export() {
|
||||||
|
if !is_self_net_inet4() then return false;
|
||||||
|
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||||
|
if source != RTS_STATIC then reject;
|
||||||
|
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet6_bgp_import() {
|
||||||
|
if is_self_net_inet6() then return false;
|
||||||
|
if is_bogon_prefix() || (bgp_path.len > 100) then return false;
|
||||||
|
bgp_large_community.add((LOCAL_ASN,200,0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet6_bgp_export() {
|
||||||
|
if !is_self_net_inet6() then return false;
|
||||||
|
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||||
|
if source != RTS_STATIC then reject;
|
||||||
|
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet4_ibgp_import() {
|
||||||
|
if is_self_net_inet4() then return false;
|
||||||
|
if is_bogon_prefix() then return false;
|
||||||
|
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet4_ibgp_export() {
|
||||||
|
if is_self_net_inet4() then return false;
|
||||||
|
if is_bogon_prefix() then return false;
|
||||||
|
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet6_ibgp_import() {
|
||||||
|
if is_self_net_inet6() then reject;
|
||||||
|
if is_bogon_prefix() then reject;
|
||||||
|
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function function_inet6_ibgp_export() {
|
||||||
|
if is_self_net_inet6() then reject;
|
||||||
|
if is_bogon_prefix() then reject;
|
||||||
|
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
template bgp tpl_inet6_ixp {
|
|
||||||
graceful restart;
|
|
||||||
local as LOCAL_ASN;
|
|
||||||
ipv6 {
|
|
||||||
table inet6;
|
|
||||||
import filter {
|
|
||||||
if is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
accept;
|
|
||||||
};
|
|
||||||
export filter {
|
|
||||||
if !is_self_net_inet6() then reject;
|
|
||||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
|
||||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
|
||||||
accept;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -6,9 +6,6 @@ git clone https://git.nia.ink/brnet/bird_config.git
|
|||||||
rm /etc/bird/template -rf
|
rm /etc/bird/template -rf
|
||||||
mv ./bird_config/bird/template /etc/bird/template
|
mv ./bird_config/bird/template /etc/bird/template
|
||||||
|
|
||||||
rm /etc/bird/function/unet.conf -f
|
|
||||||
mv ./bird_config/bird/function/unet.conf /etc/bird/function/unet.conf
|
|
||||||
|
|
||||||
|
|
||||||
chmod -R 755 /etc/bird
|
chmod -R 755 /etc/bird
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user