Add a define for the ifru_space union member.

Copy the entire sockaddr to the buffer to be written to user space,
according to its length, not just the part that fits in struct
sockaddr.

This fixes the 'bad MAC address' problem in dhclient.
This commit is contained in:
gdt 2007-09-13 18:54:57 +00:00
parent f77e123027
commit 2f4541505a
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.200 2007/09/11 19:31:22 gdt Exp $ */
/* $NetBSD: if.c,v 1.201 2007/09/13 18:54:57 gdt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.200 2007/09/11 19:31:22 gdt Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.201 2007/09/13 18:54:57 gdt Exp $");
#include "opt_inet.h"
@ -1669,7 +1669,7 @@ ifconf(u_long cmd, void *data)
if (ifrp != NULL)
{
ifr.ifr_addr = *sa;
memcpy(&ifr.ifr_space, sa, sa->sa_len);
if (space >= sz) {
error = copyout(&ifr, ifrp, sz);
if (error != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.126 2007/09/02 00:24:18 dyoung Exp $ */
/* $NetBSD: if.h,v 1.127 2007/09/13 18:54:57 gdt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -552,6 +552,7 @@ struct ifreq {
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_space ifr_ifru.ifru_space /* sockaddr_storage */
#define ifr_flags ifr_ifru.ifru_flags /* flags */
#define ifr_metric ifr_ifru.ifru_metric /* metric */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */