Re: Re: Re: Re: Re: Re: can i increase alloc_skb size in TCP layer?

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

 



On Sat, May 15, 2004 at 03:58:31AM -0000, bunty  wrote:
>  
> hi Micha,
>           What exatly i want that each IP,TCP,ICMP packet that goes out of
> machine should include my own 8 byte data checksum that i want to include along
> with total packet at Ip layer.
>           what it helps? It helps to know other computer that somebody has
> changed data in packet which doesnot have any checksum at Ip layer.
> I think you will now understand what i want to do ? Now whatever i ask you
> uptill now is related with same but considering only ICMP implementation.
> 
> regards,
> parag.
> 

Checksumming should be done at user level and not kernel level, but if
you are trying to achieve kernel level checksumming of TCP,UDP,ICMP the
correct way to do it I believe is to add another protocol between
TCP,UDP,ICMP and IP. You will have to mark it in the protocol field of
the IP header so the kernel will know up which stack to send the packet
and add hooks into both the IP layer for incoming packets to handle
that protocol type and into the TCP,UDP,ICMP layers for outgoing
packets to send it through your protocol layer.

ICMP will be most problematic since it is mostly part of the IP
protocol and not a separate layer.

You will probably want to do it as a module or add a proc interface so
you can disable this feature, otherwise you will lose network
connection to computers not aware of your protocol.

I looked into the IP specifications and there are a few protocol IDs
that may work (although most values are taken):

34  	Third Party Connect Protocol.
61  	Any host internal protocol.
63  	Any local network.

You will need to google about these to make sure they don't mean
something special or are already used by the kernel.

or 136-252 are also free.

I didn't find a good reference yet, but it doesn't look like you can
stick it into the IP option field, but you may want to look into that
option too (it will be the easiest to implement if its possible).
Maybe you can use the stream ID value or the security value.

Look at the IP rfc for more information on whats possible.

http://www.ietf.org/rfc/rfc791.txt

> On Sat, 15 May 2004 Micha Feigin wrote :
> >On Fri, May 14, 2004 at 10:10:38AM -0000, bunty  wrote:
> > >
> > > hi Michia,
> > >            so i have to implement a new protocol in between ICMP and IP
> > > protocol. so for that i have to implement a function that takes control
> from
> > > ICMP and gives to IP layer. but still dont you feel that there should be
> > > problem again of space. Because how does it knoes total space to be
> alloacted
> > > for packet with new protocol layer.
> > > regards,
> > > parag.
> > >
> >
> >You would actually want to implement a protocol that sits above ICMP,
> >since your protocol will be aware of ICMP, but not the other way
> >around.
> >
> >Your protocol would implement a new socket type so the entry function
> >would be in your protocol, it would add its header and then send call
> >ICMP to handle the data further.
> >
> >I am not sure though how to get incoming packets to pass through your
> >protocol handler. You should probably look at the specs or the code for
> >incoming packets to see how the kernel is aware of the next protocol
> >layer, you may need to modify the ICMP code for that.
> >
> >Any reason why you want this in kernel space and not user space?
> >
> > >
> > > On Thu, 13 May 2004 Micha Feigin wrote :
> > > >On Thu, May 13, 2004 at 07:21:25AM -0000, bunty  wrote:
> > > > >
> > > > > hi,
> > > > >      i acually increase icmp header length but when i build kernel i
> > > > > am getting iph hook: happy cracking which is because of ip packet
> > > > > header is not completely add to skb so its iphdr's len became  short
> > > > > for that i want to know where should i change the space allocated for
> > > > > packet i change the same sock_alloc_send_skb length by the value i
> > > > > want it should be increased?
> > > > >
> > > >
> > > >I'm afraid I don't know the answer to that. Some googling seems to show
> > > >that icmp is part of IP so you may have to enlarge the size of the IP
> > > >header to allow for the extra data or maybe play with the value of
> > > >skb->nh.iph.
> > > >
> > > >You should look at the specs first to see if they allow that though.
> > > >
> > > >I think the right (although maybe not the easiest) method is to add
> > > >another protocol layer either at the level of tcp/ip (level 4 i think)
> > > >or above them, depending on where you want the data.
> > > >
> > > >Try having a look for example at:
> > > >http://www.freesoft.org/CIE/Course/Section3/7.htm
> > > >http://www.onlamp.com/pub/a/bsd/2001/04/04/FreeBSD_Basics.html
> > > >http://www.freesoft.org/CIE/Course/Section3/index.htm
> > > >
> > > >
> > > > > regards,
> > > > > parag.
> > > > >
> > > > >
> > > > > _[_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.
> > >
> > >
> > > _[_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/
> >
> 
> 
> _[_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