LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   packet traversal through network (http://www.linuxquestions.org/questions/linux-kernel-70/packet-traversal-through-network-436644/)

venkatesh111 04-19-2006 02:02 AM

packet traversal through network
 
hi,

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....


thanks

rick.2g 04-19-2006 12:53 PM

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?

venkatesh111 04-20-2006 12:30 AM

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_source:%u.%u.%u.%u",NIPQUAD(skb->mac.ethernet->h_source));
+ printk("\nh_proto:%d",skb->mac.ethernet->h_proto);
+#endif
return -dev->hard_header_len;
}


All times are GMT -5. The time now is 10:41 AM.