Networking Forums

Networking Forums > Computer Networking > Linux Networking > add field to skb header

Reply
Thread Tools Display Modes

add field to skb header

 
 
Daniel
Guest
Posts: n/a

 
      08-24-2003, 01:46 PM
Hi

I want to add a "serial number" to outgoing IP packets.
I'm working in the 2.4.20 kernel.

This serial number will be added to every IP packet, transmitted through
the ethernet NIC, and then decoded on the receiving end.

The question is, how can I add a field to the IP header ?
For the moment, ignore the problem of an unmodified kernel getting these
packets- The specifics of my work ensure that the receiving machine does
have my modified kernel installed.

Can I simply add a "__u32 SerialNum" to the "struct iphdr" and expect it
to work?
Do I need to allocate more space? Where? How?
Do I need to change the sending routines to handle this? How?

Maybe there's a better way to add a field to a packet (such as adding a
new header) ?

Thanks in advance for taking the guesswork out of kernel programming,
Daniel
 
Reply With Quote
 
 
 
 
Tauno Voipio
Guest
Posts: n/a

 
      08-24-2003, 06:37 PM

"Daniel" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi
>
> I want to add a "serial number" to outgoing IP packets.
> I'm working in the 2.4.20 kernel.
>
> This serial number will be added to every IP packet, transmitted through
> the ethernet NIC, and then decoded on the receiving end.
>
> The question is, how can I add a field to the IP header ?
> For the moment, ignore the problem of an unmodified kernel getting these
> packets- The specifics of my work ensure that the receiving machine does
> have my modified kernel installed.
>
> Can I simply add a "__u32 SerialNum" to the "struct iphdr" and expect it
> to work?
> Do I need to allocate more space? Where? How?
> Do I need to change the sending routines to handle this? How?
>
> Maybe there's a better way to add a field to a packet (such as adding a
> new header) ?


If you change the IP header, you'll probably break the protocols running on
top of the IP (like ICMP, TCP, UDP).

Why are you not able to use the standard ways of packet identification?

There is already a sequence number in the IP header.

Before changing, please read the RFC's of the protocols affected.

HTH

Tauno Voipio
tauno voipio @ iki fi



 
Reply With Quote
 
Daniel
Guest
Posts: n/a

 
      08-25-2003, 05:18 PM
>Tauno Voipio wrote:
> If you change the IP header, you'll probably break the protocols running on
> top of the IP (like ICMP, TCP, UDP).
>

Why would upper protocols break? More importantly, how can I prevent
such problems?

What I planned to do is:
In the sender- take the packet after IP is done with it (my code resides
on the first line of dev_queue_xmit()), add the serial number to it, and
send it to the Ethernet level

In the receiver- Just before IP starts handling the packet, take the
serial number from the header and do what I need to do with it. When IP
is done, it will send the packet to the layer 4 protocols, but of course
without the IP header, so I don't know why this can cause problems.
In the IP, I'll try to manipulate the layer 4 pointers so they point to
the correct place.

> Why are you not able to use the standard ways of packet identification?
>
> There is already a sequence number in the IP header.
>


I need more than "identification"; I need to ensure order between
packets.
Is there any guarantee that the IP identification field imposes order on
the packet? In other words, can I rely on each packet's Identification
field to be exactly 1 more than the last packet (With wrap-around
calculation)? I read the relevant parts of the IP RFC and it doesn't
mention this issue. But perhaps the Linux implementation does impose
order?

> Before changing, please read the RFC's of the protocols affected.
>


In any case, the question of how to add a field to a header is still
interesting to me...

> HTH
>
> Tauno Voipio
> tauno voipio @ iki fi
>

Regards,
Daniel

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve TOS from IP Header aquadisco Linux Networking 0 04-03-2008 02:19 PM
Key in GRE header Dubert Linux Networking 0 08-31-2005 08:22 AM
host header : dns bill tie Windows Networking 1 07-28-2005 02:31 PM
linux cooked header to ethernet header conversion makwak Linux Networking 0 05-10-2005 12:36 PM
Setting DF bit in IP header. Rajat Linux Networking 0 06-29-2004 02:04 PM



1 2 3 4 5 6 7 8 9 10 11