Networking Forums

Networking Forums > Computer Networking > Linux Networking > Setting custom TCP header options

Reply
Thread Tools Display Modes

Setting custom TCP header options

 
 
grant_holler@yahoo.com
Guest
Posts: n/a

 
      09-18-2006, 06:14 AM
Hi All,

I am familiar with setting the well known TCP options by way of
setsockopt(), but how about setting arbitrary options in the 44 bytes
available for the options in the TCP header? Is there a function call I
can use to insert say :

<my_option_int><my_option_len_int><my_option_dat a> into the TCP header?
and have the stack take care of the rest (checksum etc).

I know i can consrtuct the iphdr and tcphdr myself and tell the kernel
the headers are included, but if i do that, I will now be responsible
for completing the TCP handshake & for some work that I'd like the
stack to take care of.

Is is there an API call to insert such TCP options? or do i really need
to get into the kernel now.

thanks,

grant.

 
Reply With Quote
 
 
 
 
sunil.maryala@gmail.com
Guest
Posts: n/a

 
      09-20-2006, 12:28 AM
Hi,

I think you ca use "sysctl" and modify these options.

thanks,
sunil
(E-Mail Removed) wrote:
> Hi All,
>
> I am familiar with setting the well known TCP options by way of
> setsockopt(), but how about setting arbitrary options in the 44 bytes
> available for the options in the TCP header? Is there a function call I
> can use to insert say :
>
> <my_option_int><my_option_len_int><my_option_dat a> into the TCP header?
> and have the stack take care of the rest (checksum etc).
>
> I know i can consrtuct the iphdr and tcphdr myself and tell the kernel
> the headers are included, but if i do that, I will now be responsible
> for completing the TCP handshake & for some work that I'd like the
> stack to take care of.
>
> Is is there an API call to insert such TCP options? or do i really need
> to get into the kernel now.
>
> thanks,
>
> grant.


 
Reply With Quote
 
grant_holler@yahoo.com
Guest
Posts: n/a

 
      09-20-2006, 04:54 AM
thanks sunil. I took a look at sysctl, but it seems sysctl currently
(i'm working with linux 2.4.24 kernel) will only let you set the known
tcp options listed in the tcp 7 manpage. what i'd really like to do is
set a custom (non documented TCP option). So, for example, tell the
kernel, "here's put these 8 bytes into the TCP header as options and
carry on as usual". is there a way to write custom TCP options?

thanks,

grant.


(E-Mail Removed) wrote:
> Hi,
>
> I think you ca use "sysctl" and modify these options.
>
> thanks,
> sunil
> (E-Mail Removed) wrote:
> > Hi All,
> >
> > I am familiar with setting the well known TCP options by way of
> > setsockopt(), but how about setting arbitrary options in the 44 bytes
> > available for the options in the TCP header? Is there a function call I
> > can use to insert say :
> >
> > <my_option_int><my_option_len_int><my_option_dat a> into the TCP header?
> > and have the stack take care of the rest (checksum etc).
> >
> > I know i can consrtuct the iphdr and tcphdr myself and tell the kernel
> > the headers are included, but if i do that, I will now be responsible
> > for completing the TCP handshake & for some work that I'd like the
> > stack to take care of.
> >
> > Is is there an API call to insert such TCP options? or do i really need
> > to get into the kernel now.
> >
> > thanks,
> >
> > grant.


 
Reply With Quote
 
Tejas Kokje
Guest
Posts: n/a

 
      09-20-2006, 06:24 AM
(E-Mail Removed) wrote:
> Hi All,
>
> I am familiar with setting the well known TCP options by way of
> setsockopt(), but how about setting arbitrary options in the 44 bytes
> available for the options in the TCP header? Is there a function call I
> can use to insert say :
>
> <my_option_int><my_option_len_int><my_option_dat a> into the TCP header?
> and have the stack take care of the rest (checksum etc).
>
> I know i can consrtuct the iphdr and tcphdr myself and tell the kernel
> the headers are included, but if i do that, I will now be responsible
> for completing the TCP handshake & for some work that I'd like the
> stack to take care of.
>
> Is is there an API call to insert such TCP options? or do i really need
> to get into the kernel now.
>
> thanks,
>
> grant.


Hi Grant,

I think only way to support custom TCP option is the get your hands
dirty with kernel code. The other way, as you suggested, is to use
SOCK_RAW i.e raw socket But in case of raw sockets you have to do TCP
handshake/shutdown.

Even if setsockopt() API provided a way to set custom TCP option, how
will you make the peer TCP understand that option. Peer TCP will just
ignore the option which it does not understand.

I believe, you will have to extend kernel TCP/IP stack to support your
option. It might help if you post your motivation for having custom TCP
option. Why do you really want it ?

Thanks,
Tejas Kokje

 
Reply With Quote
 
grant_holler@yahoo.com
Guest
Posts: n/a

 
      09-20-2006, 10:34 AM
thanks tejas. I had a feeling i may need to get into the kernel for
this, but i just wanted to pass it by the folks in this newgroup to
make sure there wasn't an existing way of doing it in the standard 2.4
kernel. thanks for the info. I'll dive into the kernel, then

grant.


Tejas Kokje wrote:
> (E-Mail Removed) wrote:
> > Hi All,
> >
> > I am familiar with setting the well known TCP options by way of
> > setsockopt(), but how about setting arbitrary options in the 44 bytes
> > available for the options in the TCP header? Is there a function call I
> > can use to insert say :
> >
> > <my_option_int><my_option_len_int><my_option_dat a> into the TCP header?
> > and have the stack take care of the rest (checksum etc).
> >
> > I know i can consrtuct the iphdr and tcphdr myself and tell the kernel
> > the headers are included, but if i do that, I will now be responsible
> > for completing the TCP handshake & for some work that I'd like the
> > stack to take care of.
> >
> > Is is there an API call to insert such TCP options? or do i really need
> > to get into the kernel now.
> >
> > thanks,
> >
> > grant.

>
> Hi Grant,
>
> I think only way to support custom TCP option is the get your hands
> dirty with kernel code. The other way, as you suggested, is to use
> SOCK_RAW i.e raw socket But in case of raw sockets you have to do TCP
> handshake/shutdown.
>
> Even if setsockopt() API provided a way to set custom TCP option, how
> will you make the peer TCP understand that option. Peer TCP will just
> ignore the option which it does not understand.
>
> I believe, you will have to extend kernel TCP/IP stack to support your
> option. It might help if you post your motivation for having custom TCP
> option. Why do you really want it ?
>
> Thanks,
> Tejas Kokje


 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      09-20-2006, 08:04 PM
> I believe, you will have to extend kernel TCP/IP stack to support
> your option. It might help if you post your motivation for having
> custom TCP option. Why do you really want it ?


Indeed, that would be good to know. Those custom TCP options are
unlikely to pass any firewalls. The remote TCP stack would also have
to understand the options and/or have a way to pass them to the user.

If the applications on both sides are the things generating and
consuming the options, then ostensibly the applications could just
send the information contained in the options in the application-level
data stream.

The TCP options fields were meant only to communicate information
between peer TCP instances, they weren't meant as an additional
communication channel between TCP users.

rick jones
--
portable adj, code that compiles under more than one compiler
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
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
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
IP header Compression Dave Windows Networking 1 10-11-2003 01:44 PM



1 2 3 4 5 6 7 8 9 10 11