]> hackdaworld.org Git - my-code/hdw-sniff.git/commitdiff
introduced prism wlan ng header members
authorhackbard <hackbard>
Mon, 30 Sep 2002 00:59:35 +0000 (00:59 +0000)
committerhackbard <hackbard>
Mon, 30 Sep 2002 00:59:35 +0000 (00:59 +0000)
hdw-sniff.c

index 0afd857e01ba9c386c89b556836823a377f703c9..ab67722a20b5565004269f8ebd33dc40664de063 100644 (file)
@@ -85,9 +85,10 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                        const u_char *package) {
        
        /* local variables */
-       struct ethhdr *e_hdr;
-       struct ip *ip_hdr;
+       struct linux_wlan_ng_prism_hdr *prism_hdr;
        struct ieee802_11_hdr *w_hdr;
+       struct ip *ip_hdr;
+       struct ethhdr *e_hdr;
        struct info_struct *my_info_struct;
        int i;
 
@@ -98,23 +99,34 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
        printf("---> package %d ---- %s",my_info_struct->count,
                        ctime((const time_t*)&(pcap_header->ts.tv_sec)));
        printf("pcap header:\n");
-       printf("capture_length: %d (dec.)",pcap_header->caplen);
+       printf("capture_length: %d (dec.)\t",pcap_header->caplen);
        printf("length(off wire): %d (dec.)\n",pcap_header->len);
        
-       /* is ieee802.11 ? -- we assume yes :) */
+       /* prism wlan ng headers */
        if((my_info_struct->mmode-0x30==1) && 
                (strncmp(my_info_struct->dev,"wlan",4)==0)) {
+       printf("prism header:\n");
+       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);
+
+       /* ieee802.11 header */
        printf("ieee802.11 header:\n");
+       package+=sizeof(struct linux_wlan_ng_prism_hdr);
        w_hdr=(struct ieee802_11_hdr *)package;
        
        printf("debug:\n");
        for(i=0;i<16;i++) {
                printf("%x -> ",1<<i);
-               printf("%x\n",(w_hdr->frame_ctl & 1<<i));
+               printf("%x\n",(ntohs(w_hdr->frame_ctl) & (1<<i)));
        }
-       
        printf("frame_control: %x duration_id: %x\n",ntohs(w_hdr->frame_ctl),
                                                ntohs(w_hdr->duration_id));
+       printf("version check ... %s\n",
+       ((ntohs(w_hdr->frame_ctl) & IEEE802_11_FCTL_VERS)==0x00)?
+                                                       "ok":"unknown");
+       // printf("type: 
        /* skip ieee802.11 header */
        package=package+sizeof(struct ieee802_11_hdr);
        }