(i==15?"|\n":"|"));
printf(" | v | t | s-t |t|f|m|r|p|m|w|o|\n");
/* frame type */
- if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0)
- strcpy(tmp_buf,"beacon");
- else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ATIM)>0)
- strcpy(tmp_buf,"announcement traffic indication message");
- else if((w_hdr->frame_ctl & IEEE802_11_STYPE_DISASSOC)>0)
- strcpy(tmp_buf,"disassociation");
- else if((w_hdr->frame_ctl & IEEE802_11_STYPE_AUTH)>0)
- strcpy(tmp_buf,"authentification");
- else if((w_hdr->frame_ctl & IEEE802_11_STYPE_DEAUTH)>0)
- strcpy(tmp_buf,"deauthentification");
- else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_REQ)>0)
+ /* management */
+ if(!(w_hdr->frame_ctl & 0x0c)) {
+ if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_REQ)>0)
strcpy(tmp_buf,"association request");
else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_RESP)>0)
strcpy(tmp_buf,"association response");
strcpy(tmp_buf,"probe request");
else if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_RESP)>0)
strcpy(tmp_buf,"probe response");
- else strcpy(tmp_buf,"unknown yet!");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0)
+ strcpy(tmp_buf,"beacon");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ATIM)>0)
+ strcpy(tmp_buf,"announcement traffic indication message");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_DISASSOC)>0)
+ strcpy(tmp_buf,"disassociation");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_AUTH)>0)
+ strcpy(tmp_buf,"authentification");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_DEAUTH)>0)
+ strcpy(tmp_buf,"deauthentification");
+ else strcpy(tmp_buf,"impossible situation \%) - go mail the author.");
+ }
+ else strcpy(tmp_buf,"control & monitor frame types not supported yet");
/* print out frame type */
printf("=> %s\n",tmp_buf);
printf("service = %x ",ntohs(ip_hdr->tos));
printf("total_length(dec.) = %d \n",ntohs(ip_hdr->tot_len));
printf("source_ip: ");
- for(i=3;i>=0;--i) {
+ for(i=0;i<=3;++i) {
printf("%d%s",
- ip_hdr->saddr&0xff<<i,
- (i==0?"\n":"."));
+ (ip_hdr->saddr&(0xff<<(8*i)))>>(8*i),
+ (i==3?"\n":"."));
}
printf("destination_ip: ");
- for(i=3;i>=0;--i) {
+ for(i=0;i<=3;++i) {
printf("%d%s",
- ip_hdr->daddr&0xff<<i,
- (i==0?"\n":"."));
+ (ip_hdr->daddr&(0xff<<(8*i)))>>(8*i),
+ (i==3?"\n":"."));
}
printf("ip_id = %x ",ntohs(ip_hdr->id));
printf("ip_offset = %x \n",ntohs(ip_hdr->frag_off));