tcpdump mailing list archives

Segmentatio Fault while retrieving source and destination IP from Ip header


From: Shameem Ahamed <shameem.ahamed () hotmail com>
Date: Wed, 1 Apr 2009 22:02:07 +0530


Hi All,


I am getting segmentation fault error, while retrieving the source and destn ip from ip headers.


Code snippet is given below.

packet is the last argument to the Callback function used in pcap_loop


===========================================
struct ip *ipHeader;    //IP Header

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

printf("IP Version is: %d \n",ipHeader->ip_v);

printf("Source IP: %s \n",inet_ntoa(ipHeader->ip_src));
============================================

Regards,
Shameem

_________________________________________________________________
Twice the fun—Share photos while you chat with Windows Live Messenger.
http://www.microsoft.com/india/windows/windowslive/messenger.aspx-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: