i am using a fairly standard way of calculating the ip from the captured packet but the problem is it shows me a class A ip instead of a classC ip.I am sending the code someone pleaseeeee help....
leo.
_________________________________________________
const struct sniff_ethernet *ethernet;
const struct sniff_ip *ip;
const struct sniff_tcp *tcp;
const char *payload;
int size_ethernet = sizeof(struct sniff_ethernet);
int size_ip = sizeof(struct sniff_ip);
int size_tcp = sizeof(struct sniff_tcp);
ethernet = (struct sniff_ethernet*)(packet);
ip = (struct sniff_ip*)(packet + size_ethernet);
tcp = (struct sniff_tcp*)(packet + size_ethernet + size_ip);
payload = (u_char *)(packet + size_ethernet + size_ip + size_tcp);
printf("Packet number %d has just been sniffed of length:%d\n", count,header->len);
printf("\tFrom: %s:%d\n", inet_ntoa(ip->ip_src), ntohs(tcp->th_sport));
printf("\tTo: %s:%d\n", inet_ntoa(ip->ip_dst), ntohs(tcp->th_dport));
printf("\tPayload: %s\n", payload);
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
