[Openswan dev] ARM unaligned bug

D. Hugh Redelmeier hugh at mimosa.com
Tue Jan 19 18:00:23 EST 2010

| From: D. Hugh Redelmeier <hugh at mimosa.com>

| Here's a version that attempts to do this right.  I have not even
| compiled the code let alone tested it so it is surely wrong.

A problem with this code:  It will work (I hope) even if the struct
itself is not aligned, but it won't work with "surprising" padding
inside the struct isakmp_hdr.

Each use of offsetof needs to be replaced with something else

offsetof(struct isakmp_generic, isag_length) should be replaced by 2
offsetof(struct isakmp_generic, isag_np) should be replaced by 0

These magic constants need to be described, defined, and computed
in a cleaner way.  But they can be read out of the RFC.

More information about the Dev mailing list