]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, lib, zebra: Refactor ifname2ifindex to be VRF aware
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 11 Mar 2017 12:52:59 +0000 (07:52 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 15 Mar 2017 14:43:31 +0000 (10:43 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_network.c
bgpd/bgp_zebra.c
lib/if.c
lib/if.h
zebra/zebra_routemap.c

index b85dcf6c41854b494b1e948eac0fc9e8af01721f..46ae882b2ec59e7cd40dd5e545c4fa50eed4c404 100644 (file)
@@ -617,7 +617,7 @@ bgp_connect (struct peer *peer)
     }
 
   if (peer->conf_if || peer->ifname)
-    ifindex = ifname2ifindex (peer->conf_if ? peer->conf_if : peer->ifname);
+    ifindex = ifname2ifindex (peer->conf_if ? peer->conf_if : peer->ifname, peer->bgp->vrf_id);
 
   if (bgp_debug_neighbor_events(peer))
     zlog_debug ("%s [Event] Connect start to %s fd %d",
index 32ad87cb7a46a0b298f43e347660af8298106c55..64c20f3184140687f6013e7d4525806ffd671c5e 100644 (file)
@@ -1509,7 +1509,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
           if (!ifindex)
            {
              if (mpinfo->peer->conf_if || mpinfo->peer->ifname)
-               ifindex = ifname2ifindex (mpinfo->peer->conf_if ? mpinfo->peer->conf_if : mpinfo->peer->ifname);
+               ifindex = ifname2ifindex (mpinfo->peer->conf_if ? mpinfo->peer->conf_if : mpinfo->peer->ifname, bgp->vrf_id);
              else if (mpinfo->peer->nexthop.ifp)
                ifindex = mpinfo->peer->nexthop.ifp->ifindex;
            }
index f4f7ad7749a1a481f55a222293e075497f219567..6dbadb868c1c1fcdf1b3f7710e2c1187a5f6150e 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -256,7 +256,7 @@ ifindex2ifname (ifindex_t ifindex, vrf_id_t vrf_id)
 }
 
 ifindex_t
-ifname2ifindex_vrf (const char *name, vrf_id_t vrf_id)
+ifname2ifindex (const char *name, vrf_id_t vrf_id)
 {
   struct interface *ifp;
 
@@ -264,12 +264,6 @@ ifname2ifindex_vrf (const char *name, vrf_id_t vrf_id)
                                                    : IFINDEX_INTERNAL;
 }
 
-ifindex_t
-ifname2ifindex (const char *name)
-{
-  return ifname2ifindex_vrf (name, VRF_DEFAULT);
-}
-
 /* Interface existance check by interface name. */
 struct interface *
 if_lookup_by_name (const char *name, vrf_id_t vrf_id)
index bee783d930fc83c144cb99534e79193f28e4f69d..7d88a9edf971cdbce2604fa5ae08a72f8e51456d 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -452,8 +452,7 @@ extern const char *ifindex2ifname (ifindex_t, vrf_id_t vrf_id);
 /* Please use ifname2ifindex instead of if_nametoindex where possible;
    ifname2ifindex uses internal interface info, whereas if_nametoindex must
    make a system call. */
-extern ifindex_t ifname2ifindex(const char *ifname);
-extern ifindex_t ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id);
+extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id);
 
 /* Connected address functions. */
 extern struct connected *connected_new (void);
index 6b81f66a26e7bff4521bbe86b6d491a258289d18..847da529523d671314f34c70f55ee51792c3969f 100644 (file)
@@ -189,7 +189,7 @@ route_match_interface (void *rule, struct prefix *prefix,
       nh_data = object;
       if (!nh_data || !nh_data->nexthop)
        return RMAP_NOMATCH;
-      ifindex = ifname2ifindex_vrf (ifname, nh_data->vrf_id);
+      ifindex = ifname2ifindex (ifname, nh_data->vrf_id);
       if (ifindex == 0)
        return RMAP_NOMATCH;
       if (nh_data->nexthop->ifindex == ifindex)