]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Stop prepending peer-as if self-originated and lastas configured
authorDon Slice <dslice@nvidia.com>
Wed, 11 Aug 2021 12:45:23 +0000 (08:45 -0400)
committerDon Slice <dslice@nvidia.com>
Fri, 13 Aug 2021 19:25:48 +0000 (15:25 -0400)
Problem seen where if "set aspath-prepend last-as" configured and
applied outbound, we prepend the peer's asn which causes our self-
originated routes to be denied.

Signed-off-by: Don Slice <dslice@nvidia.com>
bgpd/bgp_routemap.c

index 09dd71c0205db663675e758b911b9a6a659b6ed8..a85dccae2f355a1f5a0cca2d7a8dee9e7ddf0fdb 100644 (file)
@@ -2038,9 +2038,8 @@ route_set_aspath_prepend(void *rule, const struct prefix *prefix, void *object)
                aspath_prepend(aspath, new);
        } else {
                as_t as = aspath_leftmost(new);
-               if (!as)
-                       as = path->peer->as;
-               new = aspath_add_seq_n(new, as, (uintptr_t)rule);
+               if (as)
+                       new = aspath_add_seq_n(new, as, (uintptr_t)rule);
        }
 
        path->attr->aspath = new;
@@ -5208,7 +5207,7 @@ DEFUN_YANG (set_aspath_prepend_lastas,
            SET_STR
            "Transform BGP AS_PATH attribute\n"
            "Prepend to the as-path\n"
-           "Use the peer's AS-number\n"
+           "Use the last AS-number in the as-path\n"
            "Number of times to insert\n")
 {
        int idx_num = 4;