[plug] Basic understanding about sk_buff packet handling

Brad Campbell brad at wasp.net.au
Wed Apr 14 23:54:32 WST 2004

Parag Nemade wrote:
> hello,
>               As a part of my kernel project i come to
> some problems regardiong sk_buff structure
> 1) i want to add two fields of each 4 bytes in sk_buff
> structure what is the effect of it on kernel packet
> processing? Is there any -ve effect?

Nope only the one I mention below.. Oh and the overhead associated with shunting packet data around. 
(memcpy and friends)

> 2) if i am going to increase it by 8 bytes then what
> will happen to net packet size and its data part? Is
> that all will fit in sk_buff?

You need to reduce the MTU on your virtual interfaces so that once you add your data to the packet 
you don't exceed the mtu of the real interface.

> 3) Which is best to include my 2 fields in sk_buff or
> include its total value at end of data part?

You need to add it to the data segment.. See below

> 4) When kernel passes the packet to dest host all
> sk_buff fields are also transferred or only packet
> header and data?

Only header and data. The kernel assembles the sk_buf in the network stack from data recieved over 
the pipe. Most of the fields are generated at each end.

Perhaps you should be changing the packet type so that it does not inadvertently find its way into 
another network stack by mistake. That way only your interface will accept the packet.


More information about the plug mailing list