diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2020-06-21 19:21:51 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2020-06-22 10:09:35 +0300 |
| commit | a2719d0e88ac2d459238f90281cbafe09d088d79 (patch) | |
| tree | e940c5a41260e58bf65cbca61a6718ba2a423129 /lib | |
| parent | 8803809f0b51319606b339db00684f1f0eddfc0f (diff) | |
zebra: show interfaces from all VRFs in "show interface ..." commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/if.c | 11 | ||||
| -rw-r--r-- | lib/if.h | 3 |
2 files changed, 13 insertions, 1 deletions
@@ -383,6 +383,17 @@ struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id) return RB_FIND(if_name_head, &vrf->ifaces_by_name, &if_tmp); } +struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf) +{ + struct interface if_tmp; + + if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ) + return NULL; + + strlcpy(if_tmp.name, name, sizeof(if_tmp.name)); + return RB_FIND(if_name_head, &vrf->ifaces_by_name, &if_tmp); +} + struct interface *if_lookup_by_name_all_vrf(const char *name) { struct vrf *vrf; @@ -522,7 +522,9 @@ extern struct interface *if_lookup_prefix(const struct prefix *prefix, size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz, struct interface ***result, vrf_id_t vrf_id); +struct vrf; extern struct interface *if_lookup_by_name_all_vrf(const char *ifname); +extern struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf); extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id); extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id); extern struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id, @@ -551,7 +553,6 @@ extern bool if_is_loopback_or_vrf(const struct interface *ifp); extern int if_is_broadcast(const struct interface *ifp); extern int if_is_pointopoint(const struct interface *ifp); extern int if_is_multicast(const struct interface *ifp); -struct vrf; extern void if_terminate(struct vrf *vrf); extern void if_dump_all(void); extern const char *if_flag_dump(unsigned long); |
