added ip header support
authorhackbard <hackbard>
Fri, 6 Sep 2002 22:37:09 +0000 (22:37 +0000)
committerhackbard <hackbard>
Fri, 6 Sep 2002 22:37:09 +0000 (22:37 +0000)
hdw-sniff.c

index 8f11c82..e49ec34 100644 (file)
@@ -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<pcap_header.caplen;i++)