]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_mpath.c
bgpd: VRF-Lite fix best path selection
[mirror_frr.git] / bgpd / bgp_mpath.c
index 42077d4e8e7f544d741335386f8f8b1f40fcfe55..ba66bf3b6e2a0f91c8fd0b4f59cdfb0234f4d2c0 100644 (file)
@@ -181,6 +181,20 @@ int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
                }
        }
 
+       /*
+        * If both nexthops are same then check
+        * if they belong to same VRF
+        */
+       if (!compare && bpi1->attr->nh_type != NEXTHOP_TYPE_BLACKHOLE) {
+               if (bpi1->extra && bpi1->extra->bgp_orig && bpi2->extra
+                   && bpi2->extra->bgp_orig) {
+                       if (bpi1->extra->bgp_orig->vrf_id
+                           != bpi2->extra->bgp_orig->vrf_id) {
+                               compare = 1;
+                       }
+               }
+       }
+
        return compare;
 }