Hi All,

I was trying to create a function (for testing purpose) which displays the 
header information for Ethernet, IP and TCP using a Linux machine. The problem 
i am having is, whenever i read any packet from the saved pcap file, it 
displays the IP header size (ip->ip_hl) is 5 (some times less than 5).

Part of the code is given below

static int pack_count=1;        //Packet Count
struct ether_header *ethHeader; //Ethernet Header
struct ip *ipHeader;    //IP Header
struct tcphdr *tcpHeader;       //TCP Header
char *payload;  //Payload
unsigned int size_ip;   //Size of the IP Header
unsigned int size_tcp;  //Size of the TCP Header
char protoname[20];

ethHeader=(struct ether_header*)packet;
ipHeader=(struct ip*)(packet+ETHER_SIZE);

size_ip=ipHeader->ip_hl;
printf("Packet Count is: %d \n",pack_count);
pack_count++;

printf("=================IP Header Details ============== \n");
printf("IP Header Length is: %d \n",ipHeader->ip_hl);



Please help me.



Regards,
Shameem

_________________________________________________________________
Windows Live Messenger. Multitasking at its finest.
http://www.microsoft.com/india/windows/windowslive/messenger.aspx-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

Reply via email to