]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Set nh ifindex to VRF's interface, not the real 12636/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 15 Jan 2023 10:43:37 +0000 (12:43 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 15 Jan 2023 10:43:37 +0000 (12:43 +0200)
The kernel will lookup the real interface later.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_mplsvpn.c

index ddc9a525f9355e893729145f2f082d5f94cc38f4..ab568d1d6fc3f01d1e6c0fc4d43de925cadac009 100644 (file)
@@ -1868,6 +1868,7 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
        struct bgp_path_info *bpi_ultimate = NULL;
        int origin_local = 0;
        struct bgp *src_vrf;
+       struct interface *ifp;
 
        int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
 
@@ -1961,9 +1962,16 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
        /* If the path has accept-own community and the source VRF
         * is valid, reset next-hop to self, to allow importing own
         * routes between different VRFs on the same node.
+        * Set the nh ifindex to VRF's interface, not the real interface.
+        * Let the kernel to decide with double lookup the real next-hop
+        * interface when installing the route.
         */
-       if (src_bgp)
+       if (src_bgp) {
                subgroup_announce_reset_nhop(nhfamily, &static_attr);
+               ifp = if_get_vrf_loopback(src_vrf->vrf_id);
+               if (ifp)
+                       static_attr.nh_ifindex = ifp->ifindex;
+       }
 
        switch (nhfamily) {
        case AF_INET: