]> hackdaworld.org Git - my-code/hdw-sniff.git/commitdiff
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 8f11c82f946f8815f46be13b3d031d094e882916..e49ec34ce7a03383a89e570730dcf44fa3a86bd1 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++)