]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: recalc peer's sort after changing confed peers
authorAlexander Chernavin <achernavin@netgate.com>
Mon, 17 May 2021 09:34:03 +0000 (05:34 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 19 May 2021 18:45:56 +0000 (14:45 -0400)
Currently, when AS number of an existing BGP neighbor is added in a BGP
confederation, AS_CONFED_SEQUENCE segment attribute will be missing in
prefixes advertised to the neighbor. Also, receiving prefixes from the
neighbor will be withdrawn because of "Malformed AS path from A.B.C.D".

    neighbor 10.100.200.3 remote-as 123
    bgp confederation identifier 65001
    bgp confederation peers 123

With this change, update peer's sort after adding or removing its AS
number in a BGP confederation.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
bgpd/bgpd.c

index 5991bff752c7573ba365800caf2271414ba61cc8..6f2f2c9f34534bc9952fb3d2f336dec119962ec1 100644 (file)
@@ -671,6 +671,7 @@ int bgp_confederation_peers_add(struct bgp *bgp, as_t as)
        if (bgp_config_check(bgp, BGP_CONFIG_CONFEDERATION)) {
                for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
                        if (peer->as == as) {
+                               (void)peer_sort(peer);
                                peer->local_as = bgp->as;
                                if (BGP_IS_VALID_STATE_FOR_NOTIF(
                                            peer->status)) {
@@ -722,6 +723,7 @@ int bgp_confederation_peers_remove(struct bgp *bgp, as_t as)
        if (bgp_config_check(bgp, BGP_CONFIG_CONFEDERATION)) {
                for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
                        if (peer->as == as) {
+                               (void)peer_sort(peer);
                                peer->local_as = bgp->confed_id;
                                if (BGP_IS_VALID_STATE_FOR_NOTIF(
                                            peer->status)) {