summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_routemap.c2
-rw-r--r--lib/if.c18
-rw-r--r--lib/if.h1
-rw-r--r--zebra/zebra_ptm.c2
4 files changed, 21 insertions, 2 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 311ebb3635..9833e4e86b 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -949,7 +949,7 @@ route_match_interface (void *rule, struct prefix *prefix,
if (!info || !info->attr)
return RMAP_NOMATCH;
- ifp = if_lookup_by_name ((char *)rule);
+ ifp = if_lookup_by_name_all_vrf ((char *)rule);
if (ifp == NULL || ifp->ifindex != info->attr->nh_ifindex)
return RMAP_NOMATCH;
diff --git a/lib/if.c b/lib/if.c
index cf88b031b3..443cd419be 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -291,6 +291,24 @@ if_lookup_by_name_vrf (const char *name, vrf_id_t vrf_id)
}
struct interface *
+if_lookup_by_name_all_vrf (const char *name)
+{
+ struct interface *ifp;
+ struct vrf *vrf = NULL;
+ vrf_iter_t iter;
+
+ for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
+ {
+ vrf = vrf_iter2vrf (iter);
+ ifp = if_lookup_by_name_vrf (name, vrf->vrf_id);
+ if (ifp)
+ return ifp;
+ }
+
+ return NULL;
+}
+
+struct interface *
if_lookup_by_name (const char *name)
{
return if_lookup_by_name_vrf (name, VRF_DEFAULT);
diff --git a/lib/if.h b/lib/if.h
index 797a68bf82..f9c4cd5063 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -287,6 +287,7 @@ extern struct interface *if_lookup_prefix_vrf (struct prefix *prefix,
extern struct interface *if_lookup_by_name (const char *ifname);
extern struct interface *if_get_by_name (const char *ifname);
+extern struct interface *if_lookup_by_name_all_vrf (const char *ifname);
extern struct interface *if_lookup_by_name_vrf (const char *ifname,
vrf_id_t vrf_id);
extern struct interface *if_get_by_name_vrf (const char *ifname,
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index f32fedd9f6..bd4c03d1d1 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -492,7 +492,7 @@ zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt)
}
if (strcmp(ZEBRA_PTM_INVALID_PORT_NAME, port_str)) {
- ifp = if_lookup_by_name(port_str);
+ ifp = if_lookup_by_name_all_vrf(port_str);
if (!ifp) {
zlog_err("%s: %s not found in interface list", __func__, port_str);