All of lore.kernel.org
 help / color / mirror / Atom feed
From: k8 s <uint32@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: struct iphdr in include/linux/ip.h (probably bug in headerfile)
Date: Tue, 21 Jun 2005 12:45:20 +0530	[thread overview]
Message-ID: <699a19ea05062100157c17c09c@mail.gmail.com> (raw)

Hello,

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

How does Endianness affect BIT ORDER 
IT affetc only  BYTE ORDER
------------------------------------------------------------------------
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8    ihl:4,
                version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
        __u8    version:4,
                ihl: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;
ip->version=4
ip->ihl=5
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

             reply	other threads:[~2005-06-21  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-21  7:15 k8 s [this message]
2005-06-21 11:48 ` struct iphdr in include/linux/ip.h (probably bug in headerfile) Andreas Schwab
2005-06-21 12:27 ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=699a19ea05062100157c17c09c@mail.gmail.com \
    --to=uint32@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.