]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, ospfd: Refactor if_lookup_by_name_len
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 11 Mar 2017 12:09:21 +0000 (07:09 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 15 Mar 2017 14:32:09 +0000 (10:32 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/if.c
lib/if.h
lib/zclient.c
ospfd/ospf_zebra.c

index c4deeb79209e7a95d620c6f496c54610de79bfff..633c949ca3e42852de9d99ff57b2eb78720c84dc 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -315,7 +315,7 @@ if_lookup_by_name (const char *name)
 }
 
 struct interface *
-if_lookup_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id)
+if_lookup_by_name_len (const char *name, size_t namelen, vrf_id_t vrf_id)
 {
   struct listnode *node;
   struct interface *ifp;
@@ -331,12 +331,6 @@ if_lookup_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id)
   return NULL;
 }
 
-struct interface *
-if_lookup_by_name_len(const char *name, size_t namelen)
-{
-  return if_lookup_by_name_len_vrf (name, namelen, VRF_DEFAULT);
-}
-
 /* Lookup interface by IPv4 address. */
 struct interface *
 if_lookup_exact_address (void *src, int family, vrf_id_t vrf_id)
@@ -466,7 +460,7 @@ if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int v
   struct vrf *vrf;
   struct listnode *node;
 
-  ifp = if_lookup_by_name_len_vrf (name, namelen, vrf_id);
+  ifp = if_lookup_by_name_len (name, namelen, vrf_id);
   if (ifp)
     return ifp;
 
@@ -705,7 +699,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id)
   struct interface *ifp;
   size_t seppos = 0;
 
-  if ( (ifp = if_lookup_by_name_len_vrf (name, nlen, vrf_id)) != NULL)
+  if ( (ifp = if_lookup_by_name_len (name, nlen, vrf_id)) != NULL)
     return ifp;
   
   /* hunt the primary interface name... */
index 72d78c5d5ce25e13ed1dfe3a0e1ef21e855d5109..7a1274c31ed569bc1193b2834e4f239bdb823aa9 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -417,12 +417,10 @@ extern struct interface *if_get_by_name_vrf (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_lookup_by_name_len(const char *ifname,
-                                              size_t namelen);
 extern struct interface *if_get_by_name_len(const char *ifname,size_t namelen);
 
-extern struct interface *if_lookup_by_name_len_vrf(const char *ifname,
-                                size_t namelen, vrf_id_t vrf_id);
+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,
                                size_t namelen, vrf_id_t vrf_id, int vty);
 
index 990bf7906ecb9d2fb3898931d93376886e98a825..2a4816625e0f8da6002ae35e188ea15df5898e79 100644 (file)
@@ -1092,9 +1092,9 @@ zebra_interface_state_read (struct stream *s, vrf_id_t vrf_id)
   stream_get (ifname_tmp, s, INTERFACE_NAMSIZ);
 
   /* Lookup this by interface index. */
-  ifp = if_lookup_by_name_len_vrf (ifname_tmp,
-                                   strnlen (ifname_tmp, INTERFACE_NAMSIZ),
-                                   vrf_id);
+  ifp = if_lookup_by_name_len (ifname_tmp,
+                               strnlen (ifname_tmp, INTERFACE_NAMSIZ),
+                               vrf_id);
   if (ifp == NULL)
     {
       zlog_warn ("INTERFACE_STATE: Cannot find IF %s in VRF %d",
index b0ff5d0e3c7973fbfe619f1567c2b1ac170676d4..cb14273eed6aaf28dc7425c1ed86bc217854cc4d 100644 (file)
@@ -165,7 +165,8 @@ zebra_interface_if_lookup (struct stream *s, vrf_id_t vrf_id)
 
   /* And look it up. */
   return if_lookup_by_name_len(ifname_tmp,
-                              strnlen(ifname_tmp, INTERFACE_NAMSIZ));
+                               strnlen(ifname_tmp, INTERFACE_NAMSIZ),
+                               VRF_DEFAULT);
 }
 
 static int