(usagi-users 04082) mip6d portability issues

Jozsef Kovacs <[email protected]> Fri, 07 Nov 2008 02:20:04 +0100
Newsgroups gmane.linux.ipv6.usagi.users
Message-ID <[email protected]>
Dear all,

I have encountered some problems porting mip6d to a different 
architecture. The daemon showed incorrect behavior in movement.c: 
md_create_router()

<code>
if (olen < sizeof(struct nd_opt_hdr) + iface->hwalen)
    goto free_rtr;
</code>

nd_opt_hdr is not a packed struct (defined in netinet/icmp6.h) and it's 
not guaranteed that the length of the struct (two uint8_t fields) will 
be 2 bytes on every architecture, thereby dropping a completely valid RA 
packet. In my case on an arm device the size of the struct was 4bytes.

By fixing this the daemon worked correctly, but there still might be 
some hidden bugs caused by sizeof(struct) checks.

Regards,
Jozsef