68bacfe10f592b8b595d82e62eaa1b0b1d790463
howto/BGP-communities.md
| ... | ... | @@ -124,7 +124,7 @@ just above `update_flags` in `dn42_export_filter` function |
| 124 | 124 | |
| 125 | 125 | ## Example configuration for BIRD2 |
| 126 | 126 | ```conf |
| 127 | -function update_latency(int link_latency) { |
|
| 127 | +function update_latency(int link_latency) -> int { |
|
| 128 | 128 | bgp_community.add((64511, link_latency)); |
| 129 | 129 | if (64511, 9) ~ bgp_community then { bgp_community.delete([(64511, 1..8)]); return 9; } |
| 130 | 130 | else if (64511, 8) ~ bgp_community then { bgp_community.delete([(64511, 1..7)]); return 8; } |
| ... | ... | @@ -138,7 +138,7 @@ function update_latency(int link_latency) { |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | -function update_bandwidth(int link_bandwidth) { |
|
| 141 | +function update_bandwidth(int link_bandwidth) -> int { |
|
| 142 | 142 | bgp_community.add((64511, link_bandwidth)); |
| 143 | 143 | if (64511, 21) ~ bgp_community then { bgp_community.delete([(64511, 22..29)]); return 21; } |
| 144 | 144 | else if (64511, 22) ~ bgp_community then { bgp_community.delete([(64511, 23..29)]); return 22; } |
| ... | ... | @@ -151,7 +151,7 @@ function update_bandwidth(int link_bandwidth) { |
| 151 | 151 | else return 29; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -function update_crypto(int link_crypto) { |
|
| 154 | +function update_crypto(int link_crypto) -> int { |
|
| 155 | 155 | bgp_community.add((64511, link_crypto)); |
| 156 | 156 | if (64511, 31) ~ bgp_community then { bgp_community.delete([(64511, 32..34)]); return 31; } |
| 157 | 157 | else if (64511, 32) ~ bgp_community then { bgp_community.delete([(64511, 33..34)]); return 32; } |
| ... | ... | @@ -159,13 +159,13 @@ function update_crypto(int link_crypto) { |
| 159 | 159 | else return 34; |
| 160 | 160 | } |
| 161 | 161 | #Remove the following function if you do not want to advertize your region in the BGP community. |
| 162 | -function update_geo_flags() { |
|
| 162 | +function update_geo_flags() -> bool { |
|
| 163 | 163 | if is_self_net() || is_self_net_v6() then { |
| 164 | 164 | bgp_community.add((64511, DN_REGION_GEO)); |
| 165 | 165 | bgp_community.add((64511, DN_REGION_COUNTRY)); |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | -function update_flags(int link_latency; int link_bandwidth; int link_crypto) |
|
| 168 | +function update_flags(int link_latency; int link_bandwidth; int link_crypto) -> bool |
|
| 169 | 169 | int dn42_latency; |
| 170 | 170 | int dn42_bandwidth; |
| 171 | 171 | int dn42_crypto; |