View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 04-19-2006, 02:02 AM   #1
Registered: Mar 2006
Posts: 34

Rep: Reputation: 15
packet traversal through network


im trying to find how actually the packet travel through the network that is im trying to find at which place TCP header,IP header,ETHERNET header........

i think ehternet header is added in a function called eth_header() at linux/net/ethernet/eth.c but im not sure of it i tried to print ethernet header in a function eth_header() but it was not successfull

can any one tell me wr actually headers are added....

else send me some links that i can go through....

Old 04-19-2006, 12:53 PM   #2
Registered: Sep 2005
Posts: 41

Rep: Reputation: 15
I think this might help: www dot xml dot com/ldd/chapter/book/ch14.html#t5 - (the forum won't let me do URLS until I have a few more posts ) The ethernet headers are a bit app-specific, but you might want to look over the skbuff implementation. I think that's probably closer to what you're trying to find out.

What exactly did you mean you tried to "print" the header? I'm assuming you modified one of the enet functions a bit... do you have the code?
Old 04-20-2006, 12:30 AM   #3
Registered: Mar 2006
Posts: 34

Original Poster
Rep: Reputation: 15
i was trying to madify th eth.c file(linux/net/ethernet/eth.c ) to print ethernet header here is my diff code:

-- eth_prev.c 2001-03-03 00:32:15.000000000 +0530
+++ eth.c 2006-04-17 14:31:39.000000000 +0530
@@ -60,7 +60,7 @@
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/checksum.h>
+#define ethheader
extern int __init netdev_boot_setup(char *str);

__setup("ether=", netdev_boot_setup);
@@ -112,6 +112,12 @@ int eth_header(struct sk_buff *skb, stru
return dev->hard_header_len;

+ #ifdef ethheader
+ printk("\n\n\n************ETHERNET ADDRESS****************");
+ printk("\nh_dest:%u.%u.%u.%u",NIPQUAD(skb->mac.ethernet->h_dest));
+ printk("\nh_proto:%d",skb->mac.ethernet->h_proto);
return -dev->hard_header_len;


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
identify a network packet alaios Linux - Networking 4 04-19-2006 07:54 PM
How to capture network packet jerrytw Programming 1 01-06-2005 10:28 AM
why i see same packet twice on network interface? cranium2004 Linux - Networking 6 11-26-2004 09:42 AM
send packet at network Jamesminh Programming 1 10-01-2004 10:04 AM
network packet size PTBmilo Linux - Networking 0 02-20-2003 07:11 PM

All times are GMT -5. The time now is 10:18 PM.

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