Help with TCP Options in C


 
Thread Tools Search this Thread
Top Forums Programming Help with TCP Options in C
# 1  
Old 07-24-2009
Help with TCP Options in C

Hello everybody,
It's me again, i need your help!
I was almost finishing a program when it crashed, because of TCP segments with the TCP Options enabled.

I am able to control every field of every packet i receive, except of those using TCP Options. Is there a way to determine if a packet is using TCP Options, and the Options size to reduce it to the TCP payload?

there are no more fields after Urgent Pointer (urg_ptr) in the /usr/include/linux/tcp.h file, Please, Help!!

Thank you.

---------- Post updated at 03:46 PM ---------- Previous update was at 03:27 PM ----------

I've found the solution, the TCP Offset determines the size of the header, and with no options it's normal value is twenty. If tcp->doff is greater than 20, it means that the TCP Segment has the Options field enabled, and the Options field size is the value of the offset minus 20.

Thanks anyway.
Zykl0n-B
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Too much TCP retransmitted and TCP duplicate on server Oracle Solaris 10

I have problem with oracle solaris 10 running on oracle sparc T4-2 server. Os information: 5.10 Generic_150400-03 sun4v sparc sun4v Output from tcpstat.d script TCP bytes: out outRetrans in inDup inUnorder 6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies

2. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

3. IP Networking

Doubt regarding TCP Options negotiation

Hi, I am aware that duirng the intial SYN, SYN-ACK, ACK (connection establishment) phase, both TCP ends advertize TCP options (or extended features) each would like to use for the connection. Ultimately both ends end up using TCP options commonly supported and advertized by both. My doubt... (2 Replies)
Discussion started by: jake24
2 Replies

4. Red Hat

tcp/ip problem

how the data from disk is loaded into memory and then it transfered to tcp/ip packet. how i can find how many pages are loaded into memory by that process what is the rate of context switch for that process. (5 Replies)
Discussion started by: amar20
5 Replies

5. IP Networking

TCP/IP in c (unix)

I have written a client receive (TCP/IP) program which is up all the time. It connects to the server during Beginning of the day and stays alert and reads a message whenever one comes in. the problem is after receiving a message, the client_receive program is getting a message with zero bytes.... (0 Replies)
Discussion started by: Rajeshsu
0 Replies

6. IP Networking

Tcp\ip

I have written a TCP/IP client and server program. The client sends a message to the server and then the server sends a file back to the client. The client reads the buffer and stores it another file in the client side. I need to know what are the various exceptions that I need to handle in... (0 Replies)
Discussion started by: Rajeshsu
0 Replies

7. Programming

Changing TCP/IP Options in SunOS

Due to some project requirement I am writing an application which uses Transport Layer Interface (TLI's) in Sun OS Release 5.8. The problem is in setting the tcp's TCP_KEEPIDLE or TCP_KEEPINTVL or TCP_NKEEP parameters by t_optmgmt ( ) function.I understand that in Sun OS these are referenced by... (2 Replies)
Discussion started by: S.P.Prasad
2 Replies

8. Cybersecurity

Tcp/ip

!HELLO , What is the maximum number of hosts on a TCP/IP internet? plz can u help me. :rolleyes: (2 Replies)
Discussion started by: smdakram
2 Replies
Login or Register to Ask a Question
netx(8) 						      System Manager's Manual							   netx(8)

Name
       netx - TCP/IP net exerciser

Syntax
       /usr/field/netx [ -h ] [ -tn B ] [ -pm ] nodename

Description
       The  exerciser  sets  up a stream socket connection to the server in the TCP/IP internet domain. With connection made, the exerciser writes
       random data to the server; the server loops the data back to and the data is read and verified against the data written out.

       The exerciser runs in conjunction with the server.

       The exerciser by default will use the port number of the echo service in the file. Make sure that the TCP echo service is  enabled  in  the
       file  (no `#' in front of the service). The exerciser will run until or kill -15 pid is sent to the process.  The nodename is the remote or
       local system host name running the server.

Options
       The netx options are:

       -h	 Print the help message for the command.

       -tn	 Run time in minutes (n).  The default is to run until the process receives or kill -15 pid.

       -pm	 Specify port number to use in internet domain (m < 32768).  Note that this option is not used with  the  server,  so  you  should
		 never have to use this option.

Restrictions
       If  there  is  a need to run a system exerciser over an NFS link or on a diskless system, there are some restrictions.  For exercisers that
       need to write into a file system, such as the target file system must be writable by root.  Also the directory, in which any of	the  exer-
       cisers  are  executed,  must be writable by root because temporary files are written into the current directory.  These latter restrictions
       are sometimes difficult to overcome because often NFS file systems are mounted in a way that prevents root from writing into them.  Some of
       the restrictions may be overcome by copying the exerciser to another directory and then executing it.

Examples
       The following example exercises the TCP/IP network from the local host to node keel until a or kill -15 pid is received:
       % /usr/field/netx keel
       The following example exercises the TCP/IP network from the local host to node photon for 180 minutes in the background:
       % /usr/field/netx -t180 photon &

See Also
       Guide to System Exercisers

																	   netx(8)