diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-03-23 12:38:30 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-03-23 12:38:30 -0700 |
| commit | f8962871283672835ee121737b67cb689fa3823b (patch) | |
| tree | cf5f13cdb995a0991b33bf01f9c7d6e42f652034 /lib/if.c | |
| parent | b359768d2279f9d44858e9eadb410a30d1edbe4d (diff) | |
bgpd, lib, zebra: Add ability to retrieve ifp without specifying a vrf
There are cases where we get an interface name but do not have a
corresponding vrf. We care about getting an interface pointer
so just provide a function that searches all vrf's for the ifp.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Radhicak Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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); |
