struct iphdr in include/linux/ip.h (probably bug in headerfile)

From: k8 s
Date: Tue Jun 21 2005 - 04:13:07 EST


The following definition in linux/include/ip.h is creating problems.

How does Endianness affect BIT ORDER
IT affetc only BYTE ORDER
struct iphdr {
__u8 ihl:4,
#elif defined (__BIG_ENDIAN_BITFIELD)
__u8 version:4,
Here I have a network device which works on both little endian and big
endian machines.
I found out that the driver of the device was saying unrecognizable
packet when i assign
strcut iphdr *ip;
on bigendian machines.
It is because the two fields are swapped and start of the iphdr is 5
instead of 4.
The device is seeing 5 at the version and saying neither ipv4 nor ipv6
packet found.
I had to do the following to remove the error

*((unsigned char*)ip) = 0x45;

Had anyone noticed IT

S Kartikeyan
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at