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

(usagi-users 04085) Re: mip6d portability issues



Hi Romain,

I simply replaced the sizeof part to a predefined size. It's ugly, but I didn't want to modify the headers as they are part of *libc and not mip6d. None of the structs in netinet/* are packed. I think the correct fix would be to stop checking data taken from the network against struct sizes assuming they will have the correct size.

Regards,
Jozsef
Romain KUNTZ wrote:
Hi Jozsef,

On 2008/11/07, at 2:20, Jozsef Kovacs wrote:
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.

We think this is a header file bug: structures should be packed in order to avoid such issues. We will investigate that on our side in order to check if a change in the header file is possible. That would avoid to implement workarounds in the userland code.

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

Do you mean that you have just added a "packed" attribute to the structure in the header file? Or modified the userland code? Please send us a patch of your fix if you don't mind.

Regards,