summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_updgrp.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-07-04 13:42:19 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-07-04 13:42:19 +0200
commit0dfe25697f5299326046fcfb66f2c6beca7c423c (patch)
tree081c260eff7eca95aef125f7197cd3f3a2a7e59b /bgpd/bgp_updgrp.c
parentMerge pull request #16333 from opensourcerouting/fix/nits (diff)
downloadfrr-0dfe25697f5299326046fcfb66f2c6beca7c423c.tar.xz
frr-0dfe25697f5299326046fcfb66f2c6beca7c423c.zip
bgpd: Implement `neighbor X remote-as auto`
In some cases (large scale) it's desired to avoid changing configurations, but let the BGP to automatically handle ASN changes. `auto` means the peering can be iBGP or eBGP. It will be automatically detected and adjusted from the OPEN message. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_updgrp.c')
-rw-r--r--bgpd/bgp_updgrp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 124e7a388..b717793a4 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -343,7 +343,12 @@ static unsigned int updgrp_hash_key_make(const void *p)
key = 0;
- key = jhash_1word(peer->sort, key); /* EBGP or IBGP */
+ /* `remote-as auto` technically uses identical peer->sort.
+ * After OPEN message is parsed, this is updated accordingly, but
+ * we need to call the peer_sort() here also to properly create
+ * separate subgroups.
+ */
+ key = jhash_1word(peer_sort((struct peer *)peer), key);
key = jhash_1word(peer->sub_sort, key); /* OAD */
key = jhash_1word((peer->flags & PEER_UPDGRP_FLAGS), key);
key = jhash_1word((flags & PEER_UPDGRP_AF_FLAGS), key);