Subject: Re: dhcpd
To: Greg Troxel <gdt@ir.bbn.com>
From: Hisashi T Fujinaka <htodd@twofifty.com>
List: current-users
Date: 09/12/2007 20:48:14
On Wed, 12 Sep 2007, Greg Troxel wrote:

> If anyone wants to try this change, I think it will fix dhcp, but I
> haven't even compiled it.  (The code looks like it has more problems -
> lending weight to the 'all users of SIOCGIFCONF shoudl be converted to
> getifaddrs.)  The if being changed will never be taken in -current.
>
> Index: dist/dhcp/common/discover.c
> ===================================================================
> RCS file: /cvsroot/src/dist/dhcp/common/discover.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 discover.c
> --- dist/dhcp/common/discover.c	31 May 2007 02:58:10 -0000	1.9
> +++ dist/dhcp/common/discover.c	13 Sep 2007 00:07:07 -0000
> @@ -235,7 +235,7 @@ void discover_interfaces (state)
>
> 		memcpy(&ifcpy, (caddr_t)ic.ifc_req + i, sizeof(struct ifreq));
> #ifdef HAVE_SA_LEN
> -		if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr)) {
> +		if (ifp -> ifr_addr.sa_len > sizeof (ifp.ifr_ifru)) {
> 			if (sizeof(struct ifreq) + ifp->ifr_addr.sa_len >
> 			    sizeof(ifcpy))
> 				break;

Hmm, what I get is:
#   compile  common/discover.o
/usr/src/obj.i386/tooldir.NetBSD-4.99.31-i386/bin/i386--netbsdelf-gcc -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional  -Werror  -fno-strict-aliasing -fstack-protector -Wstack-protector --param ssp-buffer-size=1   -I/usr/src/dist/dhcp -I/usr/src/dist/dhcp/includes -Wno-unused  -D_FORTIFY_SOURCE=2  -nostdinc -isystem /usr/include -c    /usr/src/dist/dhcp/common/discover.c -o discover.o
/usr/src/dist/dhcp/common/discover.c: In function 'discover_interfaces':
/usr/src/dist/dhcp/common/discover.c:238: error: request for member 'ifr_ifru' in something not a structure or union
*** Error code 1

-- 
Hisashi T Fujinaka - htodd@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte