summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to 'zebra')
-rw-r--r--zebra/ChangeLog7
-rw-r--r--zebra/if_ioctl_solaris.c4
-rw-r--r--zebra/kernel_socket.c8
3 files changed, 14 insertions, 5 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog
index 572d2687..924f0f0a 100644
--- a/zebra/ChangeLog
+++ b/zebra/ChangeLog
@@ -1,5 +1,12 @@
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+ * 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.
+
+2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
* interface.c: (if_new_intern_ifindex) Remove obsolete function.
(if_delete_update) After distributing the interface deletion message,
set ifp->ifindex to IFINDEX_INTERNAL.
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 38ac5a71..aa01b073 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -138,7 +138,9 @@ calculate_lifc_len: /* must hold privileges to enter here */
for (n = 0; n < lifconf.lifc_len; n += sizeof (struct lifreq))
{
- ifp = if_get_by_name (lifreq->lifr_name);
+ ifp = if_get_by_name_len(lifreq->lifr_name,
+ strnlen(lifreq->lifr_name,
+ sizeof(lifreq->lifr_name)));
if (lifreq->lifr_addr.ss_family == AF_INET)
ifp->flags |= IFF_IPV4;
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);
}
/*