[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 04082) mip6d portability issues

Dear all,

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

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

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.