[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 04085) Re: mip6d portability issues
- To: usagi-users@xxxxxxxxxxxxxxxxx
- Subject: (usagi-users 04085) Re: mip6d portability issues
- From: Jozsef Kovacs <jozsef.kovacs@xxxxxxxxx>
- Date: Sat, 15 Nov 2008 17:11:18 +0100
- In-reply-to: <479D68F2-42D2-4EEC-9C79-D5EE054BA47B@xxxxxxxxxxxxxxxxxx>
- References: <491397C4.7090808@xxxxxxxxx> <479D68F2-42D2-4EEC-9C79-D5EE054BA47B@xxxxxxxxxxxxxxxxxx>
- Reply-to: usagi-users@xxxxxxxxxxxxxxxxx
- User-agent: Thunderbird 18.104.22.168 (Windows/20080914)
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.
Romain KUNTZ wrote:
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.