Subject: unaligned data object from SIOCGIFCONF
To: None <>
From: Jun-ichiro itojun Hagino <>
List: tech-net
Date: 02/20/2000 01:35:24
	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".

	If this raises too many problem for old binaries (those which does not
	copy data object from SIOCGIFCONF, and try to access the content
	directly with pointer), I can think of several solutions:

	(solution 1)
	- change SIOCGIFCONF to new number
	- old number should remain as OSIOCGIFCONF, which returns
	  non-large sockaddr (= not IPv6)
	(solution 2)
	- add 4-byte padding after sockaddr_in6
		this may violate RFC2553 3.3
	(solution 3 - not really a solution)
	- it was bug in the userland tools that tries to use pointers to
	  access packed struct.  they should have copied them.
	  actually the alignment assumption breaks with sockaddr_dl,
	  and several other sockaddr variants.  so IPv6 is not the wrong guy.

	I was notified from <> of the problem in ypbind
	and other places, and put fixes there - but I'm now wondering if how
	many of them needs fixes.
	I think solution 3 is the right way ("broken userland programs should
	be bitten"), but if it bites too many userland programs, we may better
	pick solution 1.  Thoughts? comments?