]> hackdaworld.org Git - my-code/hdw-sniff.git/commitdiff
fc
authorhackbard <hackbard>
Wed, 13 Nov 2002 23:47:31 +0000 (23:47 +0000)
committerhackbard <hackbard>
Wed, 13 Nov 2002 23:47:31 +0000 (23:47 +0000)
hdw-sniff.c

index 98f6c6e7d3332049b185cdb8f4b7f3d6453b6813..3aa657b608972ef18066c128753e16bdea28b41e 100644 (file)
@@ -120,6 +120,7 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                        const u_char *package) {
        
        /* local variables */
+       char tmp_buf[20];
        struct linux_wlan_ng_prism_hdr *prism_hdr;
        struct ieee802_11_hdr *w_hdr;
        struct ethhdr *e_hdr;
@@ -149,9 +150,9 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                (strncmp(my_info_struct->dev,"wlan",4)==0)) {
        printf("prism header: (%d bytes)\n",p_o);
        prism_hdr=(struct linux_wlan_ng_prism_hdr *)package;
-       printf("message code/length: %d/%d\n",ntohs(prism_hdr->msgcode),
-                                               ntohs(prism_hdr->msglen));
-       printf("device: %s\n",prism_hdr->devname);
+       printf("| message code/length: %d/%d |\t",prism_hdr->msgcode,
+                                               prism_hdr->msglen);
+       printf("device: %s |\n",prism_hdr->devname);
        /* ieee802.11 header */
        printf("ieee802.11 header: (%d bytes)\n",w_o);
        w_hdr=(struct ieee802_11_hdr *)(package+p_o);
@@ -161,16 +162,23 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                printf("%s%d%s",(i==0?"|":""),
                                (((w_hdr->frame_ctl) & (1<<i))>0?1:0),
                                (i==15?"|\n":"|"));
-               printf("fc: | v | t |  s-t  |t|f|m|r|p|m|w|o|\n");
+       printf("    | v | t |  s-t  |t|f|m|r|p|m|w|o|\n");
+       printf("debug: %d\n",(w_hdr->frame_ctl)<<15);
+       if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0) strcpy(tmp_buf,"beacon");
+       else strcpy(tmp_buf,"unknown");
+
+       printf("=> %s\n",tmp_buf);
        
-       printf("ion_id: %x\n",ntohs(w_hdr->duration_id));
+       printf("duration/id: %x\n",w_hdr->duration_id);
        printf("version check ... %s\n",
-       ((ntohs(w_hdr->frame_ctl) & IEEE802_11_FCTL_VERS)==0x00)?
+       ((w_hdr->frame_ctl & IEEE802_11_FCTL_VERS)==0x00)?
                                                        "ok":"unknown");
        }
 
        /* ieee802.3 */
        /* ethernet */
+       if((strncmp(my_info_struct->dev,"eth",3)==0) | 
+               ((w_hdr->frame_ctl & IEEE802_11_FTYPE_DATA)>0)) {
        printf("ethernet: (%d bytes)\n",e_o);
        e_hdr=(struct ethhdr *)(package+p_o+w_o);
        /* what types ? */
@@ -209,6 +217,9 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                                                ntohs(ip_hdr->protocol));
                // printf("chksum: %x\n",ntohs(ip_hdr->ip_sum));
        }
+       }
+
+       /* check what we have ... */
        printf("all dump: (hex)\n");
        for(i=p_o+w_o;i<pcap_header->caplen;i++)
                printf("%x ",*(package+i));