summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
diff options
context:
space:
mode:
authorajs <ajs>2005-04-02 22:50:38 +0000
committerajs <ajs>2005-04-02 22:50:38 +0000
commita349198fd3e4e5692cdc91223f8153cb53c086ce (patch)
treee5b366a8ab7ab9ed1c9670faf1f18eef26877ade /zebra/kernel_socket.c
parentf695b01ff8e9aebc46bdf41f104ad4abbb0ef59e (diff)
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions. * if.c: (if_lookup_by_name_len, if_get_by_name_len) New functions. (if_get_by_name) Tighten up code. (interface) Use new function if_get_by_name_len. * zclient.c: (zebra_interface_add_read) Use new if_get_by_name_len function. (zebra_interface_state_read) Use new if_lookup_by_name_len function. * kernel_socket.c: (ifm_read) Use new if_lookup_by_name_len function to save a memcpy. * if_ioctl_solaris.c: (interface_list_ioctl) Fix subtle bug with new if_get_by_name_len function. * ospf_interface.c: (ospf_vl_new) Use strnlen to fix call to if_create.
Diffstat (limited to 'zebra/kernel_socket.c')
-rw-r--r--zebra/kernel_socket.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index cdc6822c..12125630 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -235,7 +235,6 @@ ifm_read (struct if_msghdr *ifm)
struct sockaddr_dl *sdl = NULL;
void *cp;
unsigned int i;
- char ifname[IFNAMSIZ];
/* paranoia: sanity check structure */
if (ifm->ifm_msglen < sizeof(struct if_msghdr))
@@ -309,6 +308,9 @@ ifm_read (struct if_msghdr *ifm)
/*
* paranoia: sanity check name length. nlen does not include
* trailing zero, but IFNAMSIZ max length does.
+ *
+ * XXX Is this test correct? Should it be '>=' or '>'? And is it even
+ * necessary now that we are using if_lookup_by_name_len?
*/
if (sdl->sdl_nlen >= IFNAMSIZ)
{
@@ -316,9 +318,7 @@ ifm_read (struct if_msghdr *ifm)
return -1;
}
- memcpy (ifname, sdl->sdl_data, sdl->sdl_nlen);
- ifname[sdl->sdl_nlen] = '\0';
- ifp = if_lookup_by_name (ifname);
+ ifp = if_lookup_by_name_len (sdl->sdl_data, sdl->sdl_nlen);
}
/*