mirror of
https://github.com/quantum5/bird-filter.git
synced 2025-04-24 09:01:57 -04:00
46 lines
1 KiB
Plaintext
46 lines
1 KiB
Plaintext
function is_aspa_invalid_customer() {
|
|
int prev_asn = MY_ASN;
|
|
|
|
for int cur_asn in bgp_path do {
|
|
if prev_asn != cur_asn && is_aspa_invalid_pair(prev_asn, cur_asn) then
|
|
return true;
|
|
prev_asn = cur_asn;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function is_aspa_invalid_peer() {
|
|
int prev_asn = bgp_path.first;
|
|
|
|
for int cur_asn in bgp_path do {
|
|
if prev_asn != cur_asn && is_aspa_invalid_pair(prev_asn, cur_asn) then
|
|
return true;
|
|
prev_asn = cur_asn;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function is_aspa_invalid_upstream() {
|
|
int prev_asn = MY_ASN;
|
|
int max_up_ramp = bgp_path.len;
|
|
int min_down_ramp = 0;
|
|
int i = 0;
|
|
|
|
for int cur_asn in bgp_path do {
|
|
if prev_asn != cur_asn then {
|
|
if is_aspa_invalid_pair(cur_asn, cur_asn) && max_up_ramp > i then
|
|
max_up_ramp = i;
|
|
|
|
if is_aspa_invalid_pair(prev_asn, cur_asn) then
|
|
min_down_ramp = i;
|
|
}
|
|
|
|
prev_asn = cur_asn;
|
|
i = i + 1;
|
|
}
|
|
|
|
return min_down_ramp > max_up_ramp;
|
|
}
|