]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #12584 from pguibert6WIND/bgp_imported_distance
authorRuss White <russ@riw.us>
Tue, 17 Jan 2023 15:16:46 +0000 (10:16 -0500)
committerGitHub <noreply@github.com>
Tue, 17 Jan 2023 15:16:46 +0000 (10:16 -0500)
bgpd: imported vpn entries get appropriate distance

bgpd/bgp_route.c
tests/topotests/bgp_vpnv4_gre/r1/bgpd.conf
tests/topotests/bgp_vpnv4_gre/r1/ipv4_routes.json

index 40f29dac5c28771f2e0ec0e64f96ffdb621d78e2..2595bd1d36b628a87e468878017c409fba507666 100644 (file)
@@ -15012,6 +15012,7 @@ uint8_t bgp_distance_apply(const struct prefix *p, struct bgp_path_info *pinfo,
        struct bgp_distance *bdistance;
        struct access_list *alist;
        struct bgp_static *bgp_static;
+       struct bgp_path_info *bpi_ultimate;
 
        if (!bgp)
                return 0;
@@ -15021,6 +15022,12 @@ uint8_t bgp_distance_apply(const struct prefix *p, struct bgp_path_info *pinfo,
        if (pinfo->attr->distance)
                return pinfo->attr->distance;
 
+       /* get peer origin to calculate appropriate distance */
+       if (pinfo->sub_type == BGP_ROUTE_IMPORTED) {
+               bpi_ultimate = bgp_get_imported_bpi_ultimate(pinfo);
+               peer = bpi_ultimate->peer;
+       }
+
        /* Check source address.
         * Note: for aggregate route, peer can have unspec af type.
         */
index 0e2d3a82487bf617dfbeb7bac9997207abf43480..295811bfd02a5e51afd1a0605c81929059ab32a8 100644 (file)
@@ -14,6 +14,7 @@ router bgp 65500 vrf vrf1
  bgp router-id 192.0.2.1
  address-family ipv4 unicast
   redistribute connected
+  distance bgp 21 201 41
   label vpn export 101
   rd vpn export 444:1
   rt vpn both 52:100
index 5f2732aab0b094315ab0ee0917f204e10a96ea07..e57e21bb12be5da760efa9b1df0764d7dc7c6153 100644 (file)
@@ -7,7 +7,7 @@
             "vrfName": "vrf1",
             "selected": true,
             "destSelected": true,
-            "distance": 20,
+            "distance": 201,
             "metric": 0,
             "nexthops": [
                 {