LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-03-2004, 01:01 PM   #1
bluefiord02
LQ Newbie
 
Registered: Nov 2003
Posts: 11

Rep: Reputation: 0
modify tcpip stack


Hi guys,

I am an electrical student with not much knowldege about software world.
I hope I will get answers to my basic questions from here.
I have to do a project work to compare the time spend at TCP, IP, and ethernet layers in sending and receiving traffic (ethernet over tcp/ip). I understand that I can modify the OS to get the needed results. But I dont know where to start from. I have to work on RH linux. How are the protocols imlemented in RH linux? Is the source included in the OS? which are the files to start from? If I modify them, does it mean that I have to reinstall the kernel or can i just recompile and 'install the protocols ' (whatever that means) ? Or should I do raw socket programming instead? Which is a better idea?

cheers
bf2
 
Old 04-03-2004, 11:55 PM   #2
urzumph
Member
 
Registered: Jan 2004
Location: Australia
Distribution: Debian
Posts: 168

Rep: Reputation: 30
Quote:
(1) I understand that I can modify the OS to get the needed results.
(2) But I dont know where to start from. I have to work on RH linux.
(3) How are the protocols imlemented in RH linux?
(4) Is the source included in the OS? which are the files to start from?
(5) If I modify them, does it mean that I have to reinstall the kernel or can i just recompile and 'install the protocols ' (whatever that means) ?
(6) Or should I do raw socket programming instead? Which is a better idea?
1 : I don't know how much of your results you can get out of it - I thought that some of the ethernet stuff was handed by the network card onboard, rather than the OS on top (I don't have any information to prove or disprove that, it's just a guess), but if I am wrong about that, then yes you can get all the information out. Yes, you can modify the source.

2 : Well, the only part of the OS that will help with that is the kernel - you should look at the tcp/ip part of the kernel, as well as perhaps the driver for your network card. (might be able to get the ethernet stuff out of there)

3 : They are implimented in the net section of the kernel (At least TCP/IP is, I don't know about ethernet) - perhaps you should find a book / guide to kernel hacking to help you with this.

4 : Yes the source should be included. Try the cd it came with. I don't have a lot of experiance with redhat, but it should be in there. It might be a source rpm - .src.rpm

5 : Unless tcp/ip is built as a module (which seems unlikely) then you will need to either
1) Make all the changes, re-compile and re-install the whole kernel
The only problem with this is that you have to re-compile the whole kernel every time you want to change your code.
2) Make all the changes, re-compile as a module, install the kernel,
and when you need to change your code, re-compile your module and use rmmod & insmod to insert the new module

Of course, that makes the assumption that you can compile tcp/ip as a module, which I am not sure you can do. (some things you can, others you can't)

6 : raw socket programming would work except for ethernet. I am pretty sure that the ethernet stuff is taken care of by the time it gets to the application, so that won't help for the ethernet part.

The other thing you may look at is tcpdump - that should allow you to see what is going on, at least at the tcp/ip side of things.
 
Old 04-04-2004, 01:58 AM   #3
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Well first off, you have it backwards bluefiord02. You don't send Ethernet traffic over TCP/IP, you send TCP/IP traffic over Ethernet. It sounds like you could use a crash course in the OSI and TCP/IP networking models (as always, I suggest Stevens' TCP/IP, Volume 1: The Protocols).

Next, from what you say--"compare the time spend at TCP, IP, and ethernet layers in sending and receiving traffic"--it does not sound like your project requires modifying the TCP/IP stack, it sounds like it involves monitoring how the system handles TCP/IP. Specifically, you need to know how much time is spent handling Ethernet (the datalink layer) and IP (the network layer), vs. TCP|UDP (the transport layer). As a generalization, the first two are usually handled by the kernel while the latter is handled by a userland daemon. What you really want to do is write a client/server application that will inform you how much time it spend in "system mode" and how much in "user mode", i.e ring 0 and ring 1.

Hopefully now you understand what you're trying to do. If I told you much more, it would be doing your homework for you, which is against board rules.
 
Old 04-04-2004, 03:41 AM   #4
bluefiord02
LQ Newbie
 
Registered: Nov 2003
Posts: 11

Original Poster
Rep: Reputation: 0
Thank a lot urzumph and chort. Still the idea of playing with the kernel scares me.

Chort, yes, I meant tcp/ip traffic over ethernet and not the other way. Carelessness!! Believe me, steven's is my current bible.

Yes, the main idea is to measure how much time is spent on each layer. So one method I figured out is to insert some time reading method into the code in the kernel that handles the protocols. That is why all the talk about modifying the protocol stack. Or then 'do everything' in an application, using raw socket.

But what you mentioned sounds little more trivial. Could you please elaborate a little bit more on this :

Quote:
What you really want to do is write a client/server application that will inform you how much time it spend in "system mode" and how much in "user mode", i.e ring 0 and ring 1.
what is a ring? (The project is to get some results ant not figuring out what to do. so if I get some suggestions on what to do from some experts, it is no way foul . )
 
  


Reply


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
Difference b/t Kernel stack and User stack hazzyb Linux - Software 2 09-29-2008 07:40 PM
rc.tcpip for Linux rnsimmons Linux - Newbie 2 11-15-2005 09:02 AM
TCPIP and security consty Linux - Security 3 09-16-2005 10:42 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:54 AM.

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