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
bread = recvfrom(sockfd, buf, MAX_BUFFER, 0, (struct sockaddr *)&llh,
eth_hdr = (struct ethhdr *) buf;
ip_hdr = (struct iphdr *) ((char *) eth_hdr + 14);
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.