Re: pkg/36974 (xorp doesn't compile targeted at arm)

On Tue, May 12, 2009 at 02:02:33PM +0000, obache%NetBSD.org@localhost wrote:
> Synopsis: xorp doesn't compile targeted at arm
>
> State-Changed-From-To: open->feedback
> State-Changed-By: obache%NetBSD.org@localhost
> State-Changed-When: Tue, 12 May 2009 14:02:32 +0000
> State-Changed-Why:
> Updated to 1.6. Would you try to build the version?
Same as 1.5:
cc1plus: warnings being treated as errors
ipvx.cc: In member function 'size_t IPvX::copy_out(sockaddr_in&) const':
ipvx.cc:370: warning: cast from 'sockaddr_in*' to 'sockaddr_in6*' increases requ
ired alignment of target type
ipvx.cc: In member function 'size_t IPvX::copy_in(const sockaddr_in&)':
ipvx.cc:501: warning: cast from 'const sockaddr_in*' to 'const sockaddr_in6*' in
creases required alignment of target type
gmake[3]: *** [ipvx.lo] Error 1
OK, I was brave and looked at the code.
What they do is simply wrong... IPv6 cases bolted on IPv4-code as an
afterthought. So they assume they could add a few AF_INET6 cases even
when sockaddr_in is used, in case parts of the code are still wrong.
Only this doesn't work, because of different size in addition to
different alignment restrictions.
They should have used struct sockaddr in the old days, with casting
it to sockaddr_in where necessary; then they could have globally
s/struct sockaddr/struct sockaddr_storage/ for the modern days.
Lukem@ pointed out, that in Stevens, Unix Network Programming, Volume 1
page 72/73 all this stuff is explained (e.g. fig 3.6).
<lukem> `` If any socket address structures that the systems upports have
+alignment requirements, the sockaddr_storage proivides the strictest
+alignment requirement. ''
Regards,
-is