From: hackbard Date: Fri, 6 Sep 2002 22:37:09 +0000 (+0000) Subject: added ip header support X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=3cd7e5c91cc95ead863814a848096315c9a326c1;p=my-code%2Fhdw-sniff.git added ip header support --- diff --git a/hdw-sniff.c b/hdw-sniff.c index 8f11c82..e49ec34 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -26,6 +26,7 @@ int main(int argc, char *argv[]) { const u_char *package; struct pcap_pkthdr pcap_header; struct ethhdr *e_hdr; + struct ip *ip_hdr; struct ieee802_11_hdr *w_hdr; /* parse the arguments */ @@ -73,7 +74,9 @@ int main(int argc, char *argv[]) { printf("%x%s",*(e_hdr->h_source+i),((i==ETH_ALEN-1)?"\n":":")); if(ntohs(e_hdr->h_proto)==ETH_P_IP) { printf("ip protocol: "); - // printf(" + ip_hdr=(struct ip *)(package+sizeof(struct ethhdr)); + printf("version = %x ",ntohs(ip_hdr->ip_v:4)); + printf("header length = %x\n",ntohs(ip_hdr->ip_hl:4)); } printf("rest:\n"); for(i=sizeof(struct ethhdr);i