Subject: Re: unaligned data object from SIOCGIFCONF
To: Nathan J. Williams <nathanw@MIT.EDU>
From: None <>
List: tech-net
Date: 02/22/2000 19:11:35
>> 	With introduction of IPv6, SIOCGIFCONF can return unaligned data
>> 	object for 64bit arch (like alpha).  Situation is like this:
>> 	- SIOCGIFCONF returns packed structs
>> 	- sizeof(sockaddr_in6) % 8 != 0
>> 	- so, data object from SIOCGIFCONF can be placed at "addr % 8
>> 	!= 0".
>I notieced this problem when one of my alphas started spewing
>alignment fixups for rarpd.
>As you noted, this isn't new with IPv6, since some other sockaddr_foo
>variants aren't multiples of 8. 
>I used solution 3 ("blame the application") for rarpd. The packing
>of variable sized structures, while annoying, is the historic API, and
>applications that make assumptions of alignment of structures packed
>this way are broken. 

	I'm thinking of bringing in getifaddrs(3) from BSDI.  This is basically
	a wrapper around SIOCGIFCONF, and is under redistributable copyright.
	It will help future application writers.
	Manipulation of SIOCGIFCONF is way too complicated for normal apps.
	- alignment issue after getting the data
	- we need to try-and-error for buffer size, since we can't get the
	  necessary buffer size beforehand.
	If noone objects, I would like to bring it into libc,
	after checking with BSDI.


getifaddrs(struct ifaddrs **pif)

struct ifaddrs {
	struct ifaddrs  *ifa_next;
	char            *ifa_name;
	u_int            ifa_flags;
	struct sockaddr *ifa_addr;
	struct sockaddr *ifa_netmask;
	struct sockaddr *ifa_dstaddr;
	void            *ifa_data;