Re: Re: Basic understanding about sk_buff packet handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 15, 2004 at 07:00:43AM -0000, bunty  wrote:
>  
> hi Micha,
>       Thanks for ur reply that relaxes me that i can do that. Actually what i
> want i told u that to add 2 four bytes fields of my own of each packet. So as
> per ur suggestion i can use it in cb varialble. Now what i want to know
> Whether kernel passes whole skb or only packet  with data and headers.
> cause as part of my project i want those fields at next host to recalculate the
> checksum of my own on data only. so those fields should  be accessible to me at
> next host.
> can it be possible?
> Parag.
> 

Kernel doesn't pass the whole skb. It leaves some room at the top of
the data block for each protocol layer to push its protocol header in
there above the data (some of them also below the data). What is
finally passed to the hardware driver (such as the ethernet driver) is
only the data block without the skb to dump out onto the line.

It you want to add data to be sent you need to either look at the
protocol specifications to see if one of the layers allows you to add
some data to the header (I think tcp or ip can do it but I no longer
remember) or you will need to add another protocol layer either in
usermode or in the kernel to add another protocol layer who's header
contains the data you want.

> On Thu, 15 Apr 2004 Micha Feigin wrote :
> >On Wed, Apr 14, 2004 at 03:06:53PM -0000, bunty  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?
> >
> >No, we did it in my previous job. Didn't affect the kernel packet
> >processing. We actually attached a whole extra structure to it. skbufs
> >are in-kernel only. You can look at the cb field BTW it may be good for
> >what you want.
> >
> > > 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?
> >
> >it doesn't affect net packet size you only affect the in-kernel
> >structure. You don't have room in the protocol IIRC to add anything the
> >network packet.
> >
> > > 3) Which is best to include my 2 fields in sk_buff or include its total
> value
> > > at end of data part?
> >
> >Don't add it at the end of the data part, you don't know where the end
> >is and when and where it moves around. This will also effect the
> >allocation sizes since skbuffs are allocated on the slabs IIRC which
> >works on 2^n sizes.
> >
> > > 4) When kernel passes the packet to dest host all sk_buff fields are also
> > > transferred or only packet header and data?
> >
> >Only the packet header and the data. As far as I recall when the data
> >is allocated the head pointer isn't pointing to the exact start of the
> >data buffer to allow room to attach the header before the data is sent
> >to the net. Thats why you have both a data and a head pointers.
> >I think the data is dependent on the protocol (when the skbuff is
> >allocated the about requested is asked for).
> >
> > > parag.
> > >
> > >
> > >
> > > +++++++++++++++++++++++++++++++++++++++++++
> > > This Mail Was Scanned By Mail-seCure System
> > > at the Tel-Aviv University CC.
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:      http://mail.nl.linux.org/kernelnewbies/
> >FAQ:          http://kernelnewbies.org/faq/
> >
> 
> 
> _[_h_t_t_p_:_/_/_a_d_s_._r_e_d_i_f_f_._c_o_m_/_R_e_a_l_M_e_d_i_a_/_a_d_s_/_a_d_s_t_r_e_a_m___n_x_._c_g_i_/_w_w_w_._r_e_d_i_f_f_m_a_i_l_._c_o_m_/
> _i_n_b_o_x_._h_t_m_@_B_o_t_t_o_m_]
> +++++++++++++++++++++++++++++++++++++++++++
> This Mail Was Scanned By Mail-seCure System
> at the Tel-Aviv University CC.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux