Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-11-2007, 03:05 AM   #1
LQ Newbie
Registered: Oct 2007
Posts: 3

Rep: Reputation: 0
How to modify the TCP/IP mechanism?

Please help!

I am doing an experiment on client-server TCP socket mechanism. I wanted to modify how the client and server exchange messages. Is there anyone who can give me a hint on how to do it, what kernel module should modify and other related things.

Thank you very much.

Old 10-11-2007, 09:35 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Without knowing more about what sort of changes you intend to make, it is difficult to advise you. The Berkley sockets API is pretty standard and seems to have served most peoples' objectives over the years. Why do you need to do this?
Perhaps you simply need to use the 'raw packets', PF_PACKET, mode. This allows you to format and send raw ethernet packets in whatever way you choose. The downside is that you will have to design a lot of the functionality that the existing TCP & UDP methods provide, and that the application will need to run with root privileges.
--- rod.

Last edited by theNbomr; 10-11-2007 at 09:36 AM.
Old 10-11-2007, 11:58 PM   #3
LQ Newbie
Registered: Oct 2007
Posts: 3

Original Poster
Rep: Reputation: 0
How to modify the TCP/IP mechanism?

Thanks for the reply. What I really wanted to do is to modify the handshaking procedure in establishing a TCP connection, at the same time, be able to edit the header and do some functions. So do you think this would be possible? Could it be done in user space? connect() function is responsible for three-way handshaking, but I wanted to modify it. So I thought, I need to modify the kernel. I know this would be a deviation to the TCP protocol, but this experiment is only for my research project. I am not an expert linux kernel programmer, so I dont really know where to start.

Thanks again!
Old 10-12-2007, 03:04 PM   #4
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,571

Rep: Reputation: 180Reputation: 180
The question is if you can use a simulator, like ns-2 to test your machanisms or you need to use the 'live' system. The question is not trivial...

TCP is done in the kernel space and there are only limited points you can change the packets during their pass through the kernel code. Look for netfilter hooks. They allos you to use your own modules to deal with the packets. They are not TCP-specific and are run after the TCP header is already finished, what may be a plus.

The modification of the live Linux TCP implementation is rather hard, as it's complicated piece of code and every change requires extensive testing.

Note that connect() does not have the whole handshaking, only a part of it. The other part is run as a reaction to the received packets. Depending on your needs, you may need to change quite many places (especially the state machine).


clientserver, socket, tcp, tcpip

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux change TCP kernel Parameter for TCP DELAY ACK TICKS linux_mando Linux - Networking 5 08-22-2006 08:20 AM
How to modify TCP implementation in kernel?? karanld Linux - Networking 3 03-02-2005 07:15 AM
Woody 3.0 Open Ports 1470/tcp/uaiact 1518/tcp/vpvd What for?How can I remove them? alexxxis Debian 5 07-05-2004 05:18 PM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration