forked from Mirror/frr
bgpd, lib, zebra: Refactor ifname2ifindex to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
baaea325e6
commit
128c2be2a1
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
8
lib/if.c
8
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)
|
||||
|
|
3
lib/if.h
3
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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue