]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Store distance received from a redistribute statement 9324/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 6 Aug 2021 15:24:18 +0000 (11:24 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 8 Aug 2021 00:27:45 +0000 (20:27 -0400)
When bgp receives the admin distance from a redistribution statement
let's store that distance for later usage.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_attr.c
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_zebra.c

index 0870748f7e24b167ae8f777c41353571bf6314d7..fb97fea72d72fedc5a9be25e72d424a70209687e 100644 (file)
@@ -789,9 +789,9 @@ static void attr_show_all_iterator(struct hash_bucket *bucket, struct vty *vty)
                inet_ntop(AF_INET6, &attr->srv6_vpn->sid, sid_str, BUFSIZ);
 
        vty_out(vty,
-               "\tflags: %" PRIu64" med: %u local_pref: %u origin: %u weight: %u label: %u sid: %s\n",
-               attr->flag, attr->med, attr->local_pref, attr->origin,
-               attr->weight, attr->label, sid_str);
+               "\tflags: %" PRIu64" distance: %u med: %u local_pref: %u origin: %u weight: %u label: %u sid: %s\n",
+               attr->flag, attr->distance, attr->med, attr->local_pref,
+               attr->origin, attr->weight, attr->label, sid_str);
 }
 
 void attr_show_all(struct vty *vty)
index d314da31d8dbdcda83cf322a2ef0f216d97cd4f1..502add7c2b37309f55245b8f56d83e3993e25269 100644 (file)
@@ -8211,9 +8211,9 @@ void cli_show_bgp_global_afi_safi_unicast_aggregate_route(
 /* Redistribute route treatment. */
 void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
                          const union g_addr *nexthop, ifindex_t ifindex,
-                         enum nexthop_types_t nhtype, uint32_t metric,
-                         uint8_t type, unsigned short instance,
-                         route_tag_t tag)
+                         enum nexthop_types_t nhtype, uint8_t distance,
+                         uint32_t metric, uint8_t type,
+                         unsigned short instance, route_tag_t tag)
 {
        struct bgp_path_info *new;
        struct bgp_path_info *bpi;
@@ -8260,6 +8260,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
        attr.nh_ifindex = ifindex;
 
        attr.med = metric;
+       attr.distance = distance;
        attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC);
        attr.tag = tag;
 
index 3e3b018e830bc42a97b74f075b7bde50efa319be..aabd006d97ffc78aae915be2f053919c019a4849 100644 (file)
@@ -641,9 +641,9 @@ extern bool bgp_maximum_prefix_overflow(struct peer *, afi_t, safi_t, int);
 
 extern void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
                                 const union g_addr *nexthop, ifindex_t ifindex,
-                                enum nexthop_types_t nhtype, uint32_t metric,
-                                uint8_t type, unsigned short instance,
-                                route_tag_t tag);
+                                enum nexthop_types_t nhtype, uint8_t distance,
+                                uint32_t metric, uint8_t type,
+                                unsigned short instance, route_tag_t tag);
 extern void bgp_redistribute_delete(struct bgp *, struct prefix *, uint8_t,
                                    unsigned short);
 extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short);
index fa290743c70780f4ccaad84cffa3de8e42ce699e..51763a0e1ae379925184c445e2080170d9840261 100644 (file)
@@ -517,8 +517,8 @@ static int zebra_read_route(ZAPI_CALLBACK_ARGS)
 
                /* Now perform the add/update. */
                bgp_redistribute_add(bgp, &api.prefix, &nexthop, ifindex,
-                                    nhtype, api.metric, api.type, api.instance,
-                                    api.tag);
+                                    nhtype, api.distance, api.metric, api.type,
+                                    api.instance, api.tag);
        } else {
                bgp_redistribute_delete(bgp, &api.prefix, api.type,
                                        api.instance);