diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-11 13:34:21 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-15 15:41:07 +0100 |
commit | 07a112a1dc224df494490872894250fea12e8797 (patch) | |
tree | e88cdfa7b38efb00715302e03f9e67f584230610 /lib | |
parent | *: Refactor if_get_by_name to be VRF aware (diff) | |
download | frr-07a112a1dc224df494490872894250fea12e8797.tar.xz frr-07a112a1dc224df494490872894250fea12e8797.zip |
lib: Refactor if_get_by_name_len to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/if.c | 14 | ||||
-rw-r--r-- | lib/if.h | 4 | ||||
-rw-r--r-- | lib/zclient.c | 6 |
3 files changed, 8 insertions, 16 deletions
@@ -436,7 +436,7 @@ if_get_by_name (const char *name, vrf_id_t vrf_id) } struct interface * -if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int vty) +if_get_by_name_len (const char *name, size_t namelen, vrf_id_t vrf_id, int vty) { struct interface *ifp; struct vrf *vrf; @@ -476,12 +476,6 @@ if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int v return (if_create (name, namelen, vrf_id)); } -struct interface * -if_get_by_name_len (const char *name, size_t namelen) -{ - return if_get_by_name_len_vrf (name, namelen, VRF_DEFAULT, 0); -} - /* Does interface up ? */ int if_is_up (struct interface *ifp) @@ -690,9 +684,9 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) /* Wont catch seperator as last char, e.g. 'foo0:' but thats invalid */ if (seppos < nlen) - return if_get_by_name_len_vrf (name, seppos, vrf_id, 1); + return if_get_by_name_len (name, seppos, vrf_id, 1); else - return if_get_by_name_len_vrf (name, nlen, vrf_id, 1); + return if_get_by_name_len (name, nlen, vrf_id, 1); } #endif /* SUNOS_5 */ @@ -728,7 +722,7 @@ DEFUN (interface, #ifdef SUNOS_5 ifp = if_sunwzebra_get (ifname, sl, vrf_id); #else - ifp = if_get_by_name_len_vrf (ifname, sl, vrf_id, 1); + ifp = if_get_by_name_len (ifname, sl, vrf_id, 1); #endif /* SUNOS_5 */ if (!ifp) @@ -413,11 +413,9 @@ extern struct interface *if_get_by_name (const char *ifname, /* For these 2 functions, the namelen argument should be the precise length of the ifname string (not counting any optional trailing '\0' character). In most cases, strnlen should be used to calculate the namelen value. */ -extern struct interface *if_get_by_name_len(const char *ifname,size_t namelen); - extern struct interface *if_lookup_by_name_len(const char *ifname, size_t namelen, vrf_id_t vrf_id); -extern struct interface *if_get_by_name_len_vrf(const char *ifname, +extern struct interface *if_get_by_name_len(const char *ifname, size_t namelen, vrf_id_t vrf_id, int vty); diff --git a/lib/zclient.c b/lib/zclient.c index 2a4816625..620cd6bc4 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1066,9 +1066,9 @@ zebra_interface_add_read (struct stream *s, vrf_id_t vrf_id) stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); /* Lookup/create interface by name. */ - ifp = if_get_by_name_len_vrf (ifname_tmp, - strnlen (ifname_tmp, INTERFACE_NAMSIZ), - vrf_id, 0); + ifp = if_get_by_name_len (ifname_tmp, + strnlen (ifname_tmp, INTERFACE_NAMSIZ), + vrf_id, 0); zebra_interface_if_set_value (s, ifp); |