Networking Forums

Networking Forums > Computer Networking > Linux Networking > Problem with capturing the icmp and udp packets

Reply
Thread Tools Display Modes

Problem with capturing the icmp and udp packets

 
 
vbhanu.iitk@gmail.com
Guest
Posts: n/a

 
      08-30-2005, 10:42 PM
Hi all,

I am writing a small code that would capture and read some information
that is contaiend in the packets. What i am doing is described to some
extent here:

char buf[MAX_BUFFER];
bread = recvfrom(sockfd, buf, MAX_BUFFER, 0, (struct sockaddr *)&llh,
&lenllh);
eth_hdr = (struct ethhdr *) buf;
ip_hdr = (struct iphdr *) ((char *) eth_hdr + 14);
char *tl_pkt;
tl_pkt = buf + (4*ip_hdr->ihl);

Till here it is working fine and also if the ip_hdr->protocol is
IPPROTO_TCP then it is working fine but if this is of the type
IPPROTO_ICMP and from here i call a function void capture_udp(char
*tl_pktu); it is giving a SEGMENTATION FAULT here. I have a printf line
as the first statement in this function but even taht is not working.

Some one please please explain as to what is wrong here.

Thanking you

Bhanu

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ICMP and port 16384 problem RobR Network Routers 8 02-05-2006 12:43 AM
Router generates INVALID icmp packets Mikhail Zotov Linux Networking 6 03-18-2005 08:15 AM
ICMP packets on IP 172.30.166.36:137 Kaptain Krunch Network Routers 1 09-26-2004 05:44 PM
Problem of blocking ICMP packet while calculating Path MTU Rajat Linux Networking 2 05-08-2004 02:27 PM
ICMP redirect problem Matej Rizman Linux Networking 0 02-16-2004 02:10 PM



1 2 3 4 5 6 7 8 9 10 11