2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012 Markus Amend <markus@netsniff-ng.org>
4 * Copyright 2012 Daniel Borkmann <daniel@netsniff-ng.org>
5 * Subject to the GPL, version 2.
10 #include <netinet/in.h> /* for ntohs() */
11 #include <asm/byteorder.h>
12 #include <arpa/inet.h> /* for inet_ntop() */
16 #include "dissector_80211.h"
23 /* Note: Fields are encoded in little-endian! */
24 struct ieee80211_frm_ctrl
{
28 #if defined(__LITTLE_ENDIAN_BITFIELD)
29 /* Correct order here ... */
30 __extension__ u16 proto_version
:2,
41 #elif defined(__BIG_ENDIAN_BITFIELD)
42 __extension__ u16 subtype
:4,
54 # error "Adjust your <asm/byteorder.h> defines"
60 /* Management Frame start */
61 /* Note: Fields are encoded in little-endian! */
62 struct ieee80211_mgmt
{
70 struct ieee80211_mgmt_auth
{
74 /* possibly followed by Challenge text */
78 struct ieee80211_mgmt_deauth
{
82 struct ieee80211_mgmt_assoc_req
{
85 /* followed by SSID and Supported rates */
89 struct ieee80211_mgmt_assoc_resp
{
93 /* followed by Supported rates */
97 struct ieee80211_mgmt_reassoc_resp
{
101 /* followed by Supported rates */
105 struct ieee80211_mgmt_reassoc_req
{
109 /* followed by SSID and Supported rates */
113 struct ieee80211_mgmt_disassoc
{
117 struct ieee80211_mgmt_probe_req
{
120 struct ieee80211_mgmt_beacon
{
124 /* followed by some of SSID, Supported rates,
125 * FH Params, DS Params, CF Params, IBSS Params, TIM */
129 struct ieee80211_mgmt_probe_resp
{
133 /* followed by some of SSID, Supported rates,
134 * FH Params, DS Params, CF Params, IBSS Params, TIM */
137 /* Management Frame end */
139 /* Control Frame start */
140 /* Note: Fields are encoded in little-endian! */
141 struct ieee80211_ctrl
{
144 struct ieee80211_ctrl_rts
{
150 struct ieee80211_ctrl_cts
{
155 struct ieee80211_ctrl_ack
{
160 struct ieee80211_ctrl_ps_poll
{
166 struct ieee80211_ctrl_cf_end
{
172 struct ieee80211_ctrl_cf_end_ack
{
177 /* Control Frame end */
179 /* Data Frame start */
180 /* Note: Fields are encoded in little-endian! */
181 struct ieee80211_data
{
187 /* http://www.sss-mag.com/pdf/802_11tut.pdf
188 * http://www.scribd.com/doc/78443651/111/Management-Frames
189 * http://www.wildpackets.com/resources/compendium/wireless_lan/wlan_packets
190 * http://www.rhyshaden.com/wireless.htm
193 struct element_reserved
{
197 struct element_ssid
{
202 struct element_supp_rates
{
207 struct element_fh_ps
{
215 struct element_dsss_ps
{
220 struct element_cf_ps
{
236 struct element_ibss_ps
{
241 struct element_country_tripled
{
247 struct element_country
{
249 #if defined(__LITTLE_ENDIAN_BITFIELD)
250 /* Correct order here ... */
254 #elif defined(__BIG_ENDIAN_BITFIELD)
259 # error "Adjust your <asm/byteorder.h> defines"
261 /* triplet may repeat */
262 struct element_country_tripled tripled
[0];
267 struct element_hop_pp
{
273 struct element_hop_pt
{
287 struct element_bss_load
{
294 struct element_edca_ps
{
304 struct element_tspec
{
308 #if defined(__LITTLE_ENDIAN_BITFIELD)
309 /* Correct order here ... */
310 __extension__ u32 len
:8,
321 #elif defined(__BIG_ENDIAN_BITFIELD)
322 __extension__ u32 len
:8,
334 # error "Adjust your <asm/byteorder.h> defines"
351 u16 surplus_bandw_allow
;
355 struct element_tclas
{
361 struct element_tclas_frm_class
{
367 struct element_tclas_type0
{
373 struct element_tclas_type1
{
378 struct element_tclas_type1_ip4
{
388 struct element_tclas_type1_ip6
{
396 #if defined(__LITTLE_ENDIAN_BITFIELD)
397 __extension__ u8 flow_label3
:8;
398 __extension__ u8 flow_label2
:8;
399 __extension__ u8 flow_label1
:8;
400 #elif defined(__BIG_ENDIAN_BITFIELD)
401 __extension__ u8 flow_label1
:8;
402 __extension__ u8 flow_label2
:8;
403 __extension__ u8 flow_label3
:8;
405 # error "Adjust your <asm/byteorder.h> defines"
411 struct element_tclas_type2
{
415 struct element_tclas_type3
{
421 struct element_tclas_type4
{
426 struct element_tclas_type4_ip4
{
436 struct element_tclas_type4_ip6
{
446 #if defined(__LITTLE_ENDIAN_BITFIELD)
447 __extension__ u8 flow_label3
:8;
448 __extension__ u8 flow_label2
:8;
449 __extension__ u8 flow_label1
:8;
450 #elif defined(__BIG_ENDIAN_BITFIELD)
451 __extension__ u8 flow_label1
:8;
452 __extension__ u8 flow_label2
:8;
453 __extension__ u8 flow_label3
:8;
455 # error "Adjust your <asm/byteorder.h> defines"
461 struct element_tclas_type5
{
467 struct element_schedule
{
475 struct element_chall_txt
{
480 struct element_pwr_constr
{
485 struct element_pwr_cap
{
491 struct element_tpc_req
{
495 struct element_tpc_rep
{
501 struct element_supp_ch
{
507 struct element_supp_ch_tuple
{
512 struct element_ch_sw_ann
{
519 struct element_meas_basic
{
525 struct element_meas_cca
{
531 struct element_meas_rpi
{
537 struct element_meas_ch_load
{
545 struct element_meas_noise
{
553 struct element_meas_beacon
{
563 struct element_meas_frame
{
573 struct element_meas_sta
{
581 struct element_meas_lci
{
584 u8 longitude_req_res
;
589 struct element_meas_trans_str_cat
{
598 struct element_meas_mcast_diag
{
602 u8 mcast_triggered
[0];
606 struct element_meas_loc_civic
{
609 u8 loc_srv_intv_unit
;
614 struct element_meas_loc_id
{
616 u8 loc_srv_intv_unit
;
621 struct element_meas_pause
{
626 struct element_meas_req
{
634 struct element_meas_rep
{
642 struct element_quiet
{
650 struct element_ibss_dfs
{
657 struct element_ibss_dfs_tuple
{
667 struct element_ext_supp_rates
{
672 struct element_vend_spec
{
678 static int8_t len_neq_error(u8 len
, u8 intended
)
680 if(intended
!= len
) {
681 tprintf("Length should be %u Bytes", intended
);
688 static int8_t len_lt_error(u8 len
, u8 intended
)
691 tprintf("Length should be greater %u Bytes", intended
);
698 static float data_rates(u8 id
)
700 /* XXX Why not (id / 2.f)? */
708 case 11: return 5.5f
;
709 case 12: return 6.0f
;
710 case 18: return 9.0f
;
711 case 22: return 11.0f
;
712 case 24: return 12.0f
;
713 case 27: return 13.5f
;
714 case 36: return 18.0f
;
715 case 44: return 22.0f
;
716 case 48: return 24.0f
;
717 case 54: return 27.0f
;
718 case 66: return 33.0f
;
719 case 72: return 36.0f
;
720 case 96: return 48.0f
;
721 case 108: return 54.0f
;
734 static int8_t subelements(struct pkt_buff
*pkt
, u8 len
)
740 struct subelement
*sub
;
742 sub
= (struct subelement
*) pkt_pull(pkt
, sizeof(*sub
));
746 tprintf(", Subelement ID %u, ", sub
->id
);
747 tprintf("Length %u, ", sub
->len
);
749 data
= pkt_pull(pkt
, sub
->len
);
754 for(j
=0; j
< sub
->len
; j
++)
755 tprintf("%.2x ", data
[j
]);
761 tprintf("Length error");
768 static int8_t inf_reserved(struct pkt_buff
*pkt
, u8
*id
)
772 struct element_reserved
*reserved
;
774 reserved
= (struct element_reserved
*) pkt_pull(pkt
, sizeof(*reserved
));
775 if (reserved
== NULL
)
778 tprintf("Reserved (%u, Len (%u)): ", *id
, reserved
->len
);
780 data
= pkt_pull(pkt
, reserved
->len
);
785 for (i
= 0; i
< reserved
->len
; i
++)
786 tprintf("%.2x", data
[i
]);
791 static int8_t inf_ssid(struct pkt_buff
*pkt
, u8
*id
)
794 struct element_ssid
*ssid
;
797 ssid
= (struct element_ssid
*) pkt_pull(pkt
, sizeof(*ssid
));
801 tprintf(" SSID (%u, Len (%u)): ", *id
, ssid
->len
);
803 if ((ssid
->len
- sizeof(*ssid
) + 1) > 0) {
804 ssid_name
= (char *) pkt_pull(pkt
, ssid
->len
);
805 if (ssid_name
== NULL
)
808 for (i
= 0; i
< ssid
->len
; i
++)
809 tprintf("%c",ssid_name
[i
]);
811 tprintf("Wildcard SSID");
817 static int8_t inf_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
821 struct element_supp_rates
*supp_rates
;
823 supp_rates
= (struct element_supp_rates
*)
824 pkt_pull(pkt
, sizeof(*supp_rates
));
825 if (supp_rates
== NULL
)
828 tprintf("Rates (%u, Len (%u)): ", *id
, supp_rates
->len
);
829 if (len_lt_error(supp_rates
->len
, 1))
832 if ((supp_rates
->len
- sizeof(*supp_rates
) + 1) > 0) {
833 rates
= pkt_pull(pkt
, supp_rates
->len
);
837 for (i
= 0; i
< supp_rates
->len
; i
++)
838 tprintf("%g ", (rates
[i
] & 0x80) ?
839 ((rates
[i
] & 0x3f) * 0.5) :
840 data_rates(rates
[i
]));
847 static int8_t inf_fh_ps(struct pkt_buff
*pkt
, u8
*id
)
849 struct element_fh_ps
*fh_ps
;
851 fh_ps
= (struct element_fh_ps
*) pkt_pull(pkt
, sizeof(*fh_ps
));
855 tprintf("FH Param Set (%u, Len(%u)): ", *id
, fh_ps
->len
);
856 if (len_neq_error(fh_ps
->len
, 5))
858 tprintf("Dwell Time: %fs, ", le16_to_cpu(fh_ps
->dwell_time
) * TU
);
859 tprintf("HopSet: %u, ", fh_ps
->hop_set
);
860 tprintf("HopPattern: %u, ", fh_ps
->hop_pattern
);
861 tprintf("HopIndex: %u", fh_ps
->hop_index
);
866 static int8_t inf_dsss_ps(struct pkt_buff
*pkt
, u8
*id
)
868 struct element_dsss_ps
*dsss_ps
;
870 dsss_ps
= (struct element_dsss_ps
*) pkt_pull(pkt
, sizeof(*dsss_ps
));
874 tprintf("DSSS Param Set (%u, Len(%u)): ", *id
, dsss_ps
->len
);
875 if (len_neq_error(dsss_ps
->len
, 1))
877 tprintf("Current Channel: %u", dsss_ps
->curr_ch
);
882 static int8_t inf_cf_ps(struct pkt_buff
*pkt
, u8
*id
)
884 struct element_cf_ps
*cf_ps
;
886 cf_ps
= (struct element_cf_ps
*) pkt_pull(pkt
, sizeof(*cf_ps
));
890 tprintf("CF Param Set (%u, Len(%u)): ", *id
, cf_ps
->len
);
891 if (len_neq_error(cf_ps
->len
, 6))
893 tprintf("CFP Count: %u, ", cf_ps
->cfp_cnt
);
894 tprintf("CFP Period: %u, ", cf_ps
->cfp_period
);
895 tprintf("CFP MaxDur: %fs, ", le16_to_cpu(cf_ps
->cfp_max_dur
) * TU
);
896 tprintf("CFP DurRem: %fs", le16_to_cpu(cf_ps
->cfp_dur_rem
) * TU
);
901 static int8_t inf_tim(struct pkt_buff
*pkt
, u8
*id
)
903 struct element_tim
*tim
;
905 tim
= (struct element_tim
*) pkt_pull(pkt
, sizeof(*tim
));
909 tprintf("TIM (%u, Len(%u)): ", *id
, tim
->len
);
910 if (len_lt_error(tim
->len
, 3))
912 tprintf("DTIM Count: %u, ", tim
->dtim_cnt
);
913 tprintf("DTIM Period: %u, ", tim
->dtim_period
);
914 tprintf("Bitmap Control: %u, ", tim
->bmp_cntrl
);
915 if ((tim
->len
- sizeof(*tim
) + 1) > 0) {
916 u8
*bmp
= pkt_pull(pkt
, (tim
->len
- sizeof(*tim
) + 1));
920 tprintf("Partial Virtual Bitmap: 0x");
921 for(u8 i
=0; i
< (tim
->len
- sizeof(*tim
) + 1); i
++)
922 tprintf("%.2x ", bmp
[i
]);
928 static int8_t inf_ibss_ps(struct pkt_buff
*pkt
, u8
*id
)
930 struct element_ibss_ps
*ibss_ps
;
932 ibss_ps
= (struct element_ibss_ps
*) pkt_pull(pkt
, sizeof(*ibss_ps
));
936 tprintf("IBSS Param Set (%u, Len(%u)): ", *id
, ibss_ps
->len
);
937 if (len_neq_error(ibss_ps
->len
, 2))
939 tprintf("ATIM Window: %fs", le16_to_cpu(ibss_ps
->atim_win
) * TU
);
944 static int8_t inf_country(struct pkt_buff
*pkt
, u8
*id
)
948 struct element_country
*country
;
950 country
= (struct element_country
*) pkt_pull(pkt
, sizeof(*country
));
954 tprintf("Country (%u, Len(%u)): ", *id
, country
->len
);
955 if (len_lt_error(country
->len
, 6))
957 tprintf("Country String: %c%c%c", country
->country_first
,
958 country
->country_sec
, country
->country_third
);
960 for (i
= 0; i
< (country
->len
- 3); i
+= 3) {
961 struct element_country_tripled
*country_tripled
;
963 country_tripled
= (struct element_country_tripled
*)
964 pkt_pull(pkt
, sizeof(*country_tripled
));
965 if (country_tripled
== NULL
)
968 if(country_tripled
->frst_ch
>= 201) {
969 tprintf("Oper Ext ID: %u, ", country_tripled
->frst_ch
);
970 tprintf("Operating Class: %u, ", country_tripled
->nr_ch
);
971 tprintf("Coverage Class: %u", country_tripled
->max_trans
);
973 tprintf("First Ch Nr: %u, ", country_tripled
->frst_ch
);
974 tprintf("Nr of Ch: %u, ", country_tripled
->nr_ch
);
975 tprintf("Max Transmit Pwr Lvl: %u", country_tripled
->max_trans
);
979 if(country
->len
% 2) {
980 pad
= pkt_pull(pkt
, 1);
984 tprintf(", Pad: 0x%x", *pad
);
990 static int8_t inf_hop_pp(struct pkt_buff
*pkt
, u8
*id
)
992 struct element_hop_pp
*hop_pp
;
994 hop_pp
= (struct element_hop_pp
*) pkt_pull(pkt
, sizeof(*hop_pp
));
998 tprintf("Hopping Pattern Param (%u, Len(%u)): ", *id
, hop_pp
->len
);
999 if (len_neq_error(hop_pp
->len
, 2))
1001 tprintf("Nr of Ch: %u", hop_pp
->nr_ch
);
1006 static int8_t inf_hop_pt(struct pkt_buff
*pkt
, u8
*id
)
1010 struct element_hop_pt
*hop_pt
;
1012 hop_pt
= (struct element_hop_pt
*) pkt_pull(pkt
, sizeof(*hop_pt
));
1016 tprintf("Hopping Pattern Table (%u, Len(%u)): ", *id
, hop_pt
->len
);
1017 if (len_lt_error(hop_pt
->len
, 4))
1019 tprintf("Flag: %u, ", hop_pt
->flag
);
1020 tprintf("Nr of Sets: %u, ", hop_pt
->nr_sets
);
1021 tprintf("Modules: %u, ", hop_pt
->modules
);
1022 tprintf("Offs: %u", hop_pt
->offs
);
1024 if ((hop_pt
->len
- sizeof(*hop_pt
) + 1) > 0) {
1025 rand_tabl
= pkt_pull(pkt
, (hop_pt
->len
- sizeof(*hop_pt
) + 1));
1026 if (rand_tabl
== NULL
)
1029 tprintf(", Rand table: 0x");
1030 for (i
= 0; i
< (hop_pt
->len
- sizeof(*hop_pt
) + 1); i
++)
1031 tprintf("%.2x ", rand_tabl
[i
]);
1037 static int8_t inf_req(struct pkt_buff
*pkt
, u8
*id
)
1040 struct element_req
*req
;
1043 req
= (struct element_req
*) pkt_pull(pkt
, sizeof(*req
));
1047 tprintf("Request Element (%u, Len(%u)): ", *id
, req
->len
);
1048 if ((req
->len
- sizeof(*req
) + 1) > 0) {
1049 req_ids
= pkt_pull(pkt
, (req
->len
- sizeof(*req
) + 1));
1050 if (req_ids
== NULL
)
1053 tprintf(", Requested Element IDs: ");
1054 for (i
= 0; i
< (req
->len
- sizeof(*req
) + 1); i
++)
1055 tprintf("%u ", req_ids
[i
]);
1061 static int8_t inf_bss_load(struct pkt_buff
*pkt
, u8
*id
)
1063 struct element_bss_load
*bss_load
;
1065 bss_load
= (struct element_bss_load
*) pkt_pull(pkt
, sizeof(*bss_load
));
1066 if (bss_load
== NULL
)
1069 tprintf("BSS Load element (%u, Len(%u)): ", *id
, bss_load
->len
);
1070 if (len_neq_error(bss_load
->len
, 5))
1072 tprintf("Station Count: %u, ", le16_to_cpu(bss_load
->station_cnt
));
1073 tprintf("Channel Utilization: %u, ", bss_load
->ch_util
);
1074 tprintf("Available Admission Capacity: %uus",
1075 bss_load
->avlb_adm_cap
* 32);
1080 static int8_t inf_edca_ps(struct pkt_buff
*pkt
, u8
*id
)
1082 u32 ac_be
, ac_bk
, ac_vi
, ac_vo
;
1083 struct element_edca_ps
*edca_ps
;
1085 edca_ps
= (struct element_edca_ps
*) pkt_pull(pkt
, sizeof(*edca_ps
));
1086 if (edca_ps
== NULL
)
1089 ac_be
= le32_to_cpu(edca_ps
->ac_be
);
1090 ac_bk
= le32_to_cpu(edca_ps
->ac_bk
);
1091 ac_vi
= le32_to_cpu(edca_ps
->ac_vi
);
1092 ac_vo
= le32_to_cpu(edca_ps
->ac_vo
);
1094 tprintf("EDCA Param Set (%u, Len(%u)): ", *id
, edca_ps
->len
);
1095 if (len_neq_error(edca_ps
->len
, 18))
1097 tprintf("QoS Info: 0x%x (-> EDCA Param Set Update Count (%u),"
1098 "Q-Ack (%u), Queue Re (%u), TXOP Req(%u), Res(%u)), ",
1099 edca_ps
->qos_inf
, edca_ps
->qos_inf
>> 4,
1100 (edca_ps
->qos_inf
>> 3) & 1, (edca_ps
->qos_inf
>> 2) & 1,
1101 (edca_ps
->qos_inf
>> 1) & 1, edca_ps
->qos_inf
& 1);
1102 tprintf("Reserved: 0x%x, ", edca_ps
->res
);
1103 tprintf("AC_BE Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1104 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_be
,
1105 ac_be
>> 28, (ac_be
>> 27) & 1, (ac_be
>> 25) & 3,
1106 (ac_be
>> 24) & 1, (ac_be
>> 20) & 15, (ac_be
>> 16) & 15,
1107 bswap_16(ac_be
& 0xFFFF) * 32);
1108 tprintf("AC_BK Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1109 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_bk
,
1110 ac_bk
>> 28, (ac_bk
>> 27) & 1, (ac_bk
>> 25) & 3,
1111 (ac_bk
>> 24) & 1, (ac_bk
>> 20) & 15, (ac_bk
>> 16) & 15,
1112 bswap_16(ac_bk
& 0xFFFF) * 32);
1113 tprintf("AC_VI Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1114 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_vi
,
1115 ac_vi
>> 28, (ac_vi
>> 27) & 1, (ac_vi
>> 25) & 3,
1116 (ac_vi
>> 24) & 1, (ac_vi
>> 20) & 15, (ac_vi
>> 16) & 15,
1117 bswap_16(ac_vi
& 0xFFFF) * 32);
1118 tprintf("AC_VO Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1119 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)", ac_vo
,
1120 ac_vo
>> 28, (ac_vo
>> 27) & 1, (ac_vo
>> 25) & 3,
1121 (ac_vo
>> 24) & 1, (ac_vo
>> 20) & 15, (ac_vo
>> 16) & 15,
1122 bswap_16(ac_vo
& 0xFFFF) * 32);
1127 static int8_t inf_tspec(struct pkt_buff
*pkt
, u8
*id
)
1129 u16 nom_msdu_size
, surplus_bandw_allow
;
1130 struct element_tspec
*tspec
;
1132 tspec
= (struct element_tspec
*) pkt_pull(pkt
, sizeof(*tspec
));
1136 nom_msdu_size
= le16_to_cpu(tspec
->nom_msdu_size
);
1137 surplus_bandw_allow
= le16_to_cpu(tspec
->surplus_bandw_allow
);
1139 tprintf("TSPEC (%u, Len(%u)): ", *id
, tspec
->len
);
1140 if (len_neq_error(tspec
->len
, 55))
1142 tprintf("Traffic Type: %u, ", tspec
->traffic_type
);
1143 tprintf("TSID: %u, ", tspec
->tsid
);
1144 tprintf("Direction: %u, ", tspec
->direction
);
1145 tprintf("Access Policy: %u, ", tspec
->access_policy
);
1146 tprintf("Aggregation: %u, ", tspec
->aggr
);
1147 tprintf("User Priority: %u, ", tspec
->user_prior
);
1148 tprintf("TSinfo Ack Policy: %u, ", tspec
->tsinfo_ack_pol
);
1149 tprintf("Schedule: %u, ", tspec
->schedule
);
1150 tprintf("Reserved: 0x%x, ", tspec
->res
);
1151 tprintf("Nominal MSDU Size: %uB (Fixed (%u)), ",
1152 nom_msdu_size
>> 1, nom_msdu_size
& 1);
1153 tprintf("Maximum MSDU Size: %uB, ", le16_to_cpu(tspec
->max_msdu_size
));
1154 tprintf("Minimum Service Interval: %uus, ",
1155 le32_to_cpu(tspec
->min_srv_intv
));
1156 tprintf("Maximum Service Interval: %uus, ",
1157 le32_to_cpu(tspec
->max_srv_intv
));
1158 tprintf("Inactivity Interval: %uus, ",
1159 le32_to_cpu(tspec
->inactive_intv
));
1160 tprintf("Suspension Interval: %uus, ", le32_to_cpu(tspec
->susp_intv
));
1161 tprintf("Service Start Time: %uus, ",
1162 le32_to_cpu(tspec
->srv_start_time
));
1163 tprintf("Minimum Data Rate: %ub/s, ",le32_to_cpu(tspec
->min_data_rate
));
1164 tprintf("Mean Data Rate: %ub/s, ", le32_to_cpu(tspec
->mean_data_rate
));
1165 tprintf("Peak Data Rate: %ub/s, ",le32_to_cpu(tspec
->peak_data_rate
));
1166 tprintf("Burst Size: %uB, ", le32_to_cpu(tspec
->burst_size
));
1167 tprintf("Delay Bound: %uus, ", le32_to_cpu(tspec
->delay_bound
));
1168 tprintf("Minimum PHY Rate: %ub/s, ", le32_to_cpu(tspec
->min_phy_rate
));
1169 tprintf("Surplus Bandwidth: %u.%u, ", surplus_bandw_allow
>> 13,
1170 surplus_bandw_allow
& 0x1FFF);
1171 tprintf("Medium Time: %uus", le16_to_cpu(tspec
->med_time
) * 32);
1176 static const char *class_type(u8 type
)
1179 case 0: return "Ethernet parameters";
1180 case 1: return "TCP/UDP IP parameters";
1181 case 2: return "IEEE 802.1Q parameters";
1182 case 3: return "Filter Offset parameters";
1183 case 4: return "IP and higher layer parameters";
1184 case 5: return "IEEE 802.1D/Q parameters";
1185 default: return "Reserved";
1189 static int8_t inf_tclas(struct pkt_buff
*pkt
, u8
*id
)
1191 struct element_tclas
*tclas
;
1192 struct element_tclas_frm_class
*frm_class
;
1194 tclas
= (struct element_tclas
*) pkt_pull(pkt
, sizeof(*tclas
));
1198 frm_class
= (struct element_tclas_frm_class
*)
1199 pkt_pull(pkt
, sizeof(*frm_class
));
1200 if (frm_class
== NULL
)
1203 tprintf("TCLAS (%u, Len(%u)): ", *id
, tclas
->len
);
1204 if (len_lt_error(tclas
->len
, 3))
1206 tprintf("User Priority: %u, ", tclas
->user_priority
);
1207 tprintf("Classifier Type: %s (%u), ", class_type(frm_class
->type
),
1209 tprintf("Classifier Mask: 0x%x, ", frm_class
->mask
);
1211 if(frm_class
->type
== 0) {
1212 struct element_tclas_type0
*type0
;
1214 type0
= (struct element_tclas_type0
*)
1215 pkt_pull(pkt
, sizeof(*type0
));
1219 /* I think little endian, like the rest */
1220 tprintf("Src Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1221 type0
->sa
[5], type0
->sa
[4], type0
->sa
[3],
1222 type0
->sa
[2], type0
->sa
[1], type0
->sa
[0]);
1223 tprintf("Dst Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1224 type0
->da
[5], type0
->da
[4], type0
->da
[3],
1225 type0
->da
[2], type0
->da
[1], type0
->da
[0]);
1226 tprintf("Type: 0x%x", le16_to_cpu(type0
->type
));
1228 else if(frm_class
->type
== 1) {
1229 struct element_tclas_type1
*type1
;
1231 type1
= (struct element_tclas_type1
*)
1232 pkt_pull(pkt
, sizeof(*type1
));
1236 tprintf("Version: %u, ", type1
->version
);
1237 /* big endian format follows */
1238 if(type1
->version
== 4) {
1239 struct element_tclas_type1_ip4
*type1_ip4
;
1240 char src_ip
[INET_ADDRSTRLEN
];
1241 char dst_ip
[INET_ADDRSTRLEN
];
1243 type1_ip4
= (struct element_tclas_type1_ip4
*)
1244 pkt_pull(pkt
, sizeof(*type1_ip4
));
1245 if (type1_ip4
== NULL
)
1248 inet_ntop(AF_INET
, &type1_ip4
->sa
, src_ip
, sizeof(src_ip
));
1249 inet_ntop(AF_INET
, &type1_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1251 tprintf("Src IP: %s, ", src_ip
);
1252 tprintf("Dst IP: %s, ", dst_ip
);
1253 tprintf("Src Port: %u, ", ntohs(type1_ip4
->sp
));
1254 tprintf("Dst Port: %u, ", ntohs(type1_ip4
->dp
));
1255 tprintf("DSCP: 0x%x, ", type1_ip4
->dscp
);
1256 tprintf("Proto: %u, ", type1_ip4
->proto
);
1257 tprintf("Res: 0x%x", type1_ip4
->reserved
);
1259 else if(type1
->version
== 6) {
1260 struct element_tclas_type1_ip6
*type1_ip6
;
1261 char src_ip
[INET6_ADDRSTRLEN
];
1262 char dst_ip
[INET6_ADDRSTRLEN
];
1264 type1_ip6
= (struct element_tclas_type1_ip6
*)
1265 pkt_pull(pkt
, sizeof(*type1_ip6
));
1266 if (type1_ip6
== NULL
)
1269 inet_ntop(AF_INET6
, &type1_ip6
->sa
,
1270 src_ip
, sizeof(src_ip
));
1271 inet_ntop(AF_INET6
, &type1_ip6
->da
,
1272 dst_ip
, sizeof(dst_ip
));
1274 tprintf("Src IP: %s, ", src_ip
);
1275 tprintf("Dst IP: %s, ", dst_ip
);
1276 tprintf("Src Port: %u, ", ntohs(type1_ip6
->sp
));
1277 tprintf("Dst Port: %u, ", ntohs(type1_ip6
->dp
));
1278 tprintf("Flow Label: 0x%x%x%x", type1_ip6
->flow_label1
,
1279 type1_ip6
->flow_label2
, type1_ip6
->flow_label3
);
1282 tprintf("Version (%u) not supported", type1
->version
);
1287 else if(frm_class
->type
== 2) {
1288 struct element_tclas_type2
*type2
;
1290 type2
= (struct element_tclas_type2
*)
1291 pkt_pull(pkt
, sizeof(*type2
));
1295 tprintf("802.1Q VLAN TCI: 0x%x", ntohs(type2
->vlan_tci
));
1297 else if(frm_class
->type
== 3) {
1298 struct element_tclas_type3
*type3
;
1302 type3
= (struct element_tclas_type3
*)
1303 pkt_pull(pkt
, sizeof(*type3
));
1307 len
= (tclas
->len
- 5) / 2;
1309 tprintf("Filter Offset: %u, ", type3
->offs
);
1311 if((len
& 1) || (len_lt_error(tclas
->len
, 5))) {
1312 tprintf("Length of TCLAS (%u) not correct", tclas
->len
);
1316 val
= pkt_pull(pkt
, len
);
1320 tprintf("Filter Value: 0x");
1321 for (i
= 0; i
< len
/ 2; i
++)
1322 tprintf("%x ", val
[i
]);
1324 tprintf("Filter Mask: 0x");
1325 for (i
= len
/ 2; i
< len
; i
++)
1326 tprintf("%x ", val
[i
]);
1330 else if(frm_class
->type
== 4) {
1331 struct element_tclas_type4
*type4
;
1333 type4
= (struct element_tclas_type4
*)
1334 pkt_pull(pkt
, sizeof(*type4
));
1338 tprintf("Version: %u, ", type4
->version
);
1339 /* big endian format follows */
1340 if(type4
->version
== 4) {
1341 struct element_tclas_type4_ip4
*type4_ip4
;
1342 char src_ip
[INET_ADDRSTRLEN
];
1343 char dst_ip
[INET_ADDRSTRLEN
];
1345 type4_ip4
= (struct element_tclas_type4_ip4
*)
1346 pkt_pull(pkt
, sizeof(*type4_ip4
));
1347 if (type4_ip4
== NULL
)
1350 inet_ntop(AF_INET
, &type4_ip4
->sa
, src_ip
, sizeof(src_ip
));
1351 inet_ntop(AF_INET
, &type4_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1353 tprintf("Src IP: %s, ", src_ip
);
1354 tprintf("Dst IP: %s, ", dst_ip
);
1355 tprintf("Src Port: %u, ", ntohs(type4_ip4
->sp
));
1356 tprintf("Dst Port: %u, ", ntohs(type4_ip4
->dp
));
1357 tprintf("DSCP: 0x%x, ", type4_ip4
->dscp
);
1358 tprintf("Proto: %u, ", type4_ip4
->proto
);
1359 tprintf("Res: 0x%x", type4_ip4
->reserved
);
1361 else if(type4
->version
== 6) {
1362 struct element_tclas_type4_ip6
*type4_ip6
;
1363 char src_ip
[INET6_ADDRSTRLEN
];
1364 char dst_ip
[INET6_ADDRSTRLEN
];
1366 type4_ip6
= (struct element_tclas_type4_ip6
*)
1367 pkt_pull(pkt
, sizeof(*type4_ip6
));
1368 if (type4_ip6
== NULL
)
1371 inet_ntop(AF_INET6
, &type4_ip6
->sa
,
1372 src_ip
, sizeof(src_ip
));
1373 inet_ntop(AF_INET6
, &type4_ip6
->da
,
1374 dst_ip
, sizeof(dst_ip
));
1376 tprintf("Src IP: %s, ", src_ip
);
1377 tprintf("Dst IP: %s, ", dst_ip
);
1378 tprintf("Src Port: %u, ", ntohs(type4_ip6
->sp
));
1379 tprintf("Dst Port: %u, ", ntohs(type4_ip6
->dp
));
1380 tprintf("DSCP: 0x%x, ", type4_ip6
->dscp
);
1381 tprintf("Nxt Hdr: %u, ", type4_ip6
->nxt_hdr
);
1382 tprintf("Flow Label: 0x%x%x%x", type4_ip6
->flow_label1
,
1383 type4_ip6
->flow_label2
, type4_ip6
->flow_label3
);
1386 tprintf("Version (%u) not supported", type4
->version
);
1390 else if(frm_class
->type
== 5) {
1391 struct element_tclas_type5
*type5
;
1393 type5
= (struct element_tclas_type5
*)
1394 pkt_pull(pkt
, sizeof(*type5
));
1398 tprintf("802.1Q PCP: 0x%x, ", type5
->pcp
);
1399 tprintf("802.1Q CFI: 0x%x, ", type5
->cfi
);
1400 tprintf("802.1Q VID: 0x%x", type5
->vid
);
1403 tprintf("Classifier Type (%u) not supported", frm_class
->type
);
1410 static int8_t inf_sched(struct pkt_buff
*pkt
, u8
*id
)
1412 struct element_schedule
*schedule
;
1415 schedule
= (struct element_schedule
*) pkt_pull(pkt
, sizeof(*schedule
));
1416 if (schedule
== NULL
)
1419 info
= le16_to_cpu(schedule
->inf
);
1421 tprintf("Schedule (%u, Len(%u)): ", *id
, schedule
->len
);
1422 if (len_neq_error(schedule
->len
, 12))
1425 tprintf("Aggregation: %u, ", info
>> 15);
1426 tprintf("TSID: %u, ", (info
>> 11) & 0xF);
1427 tprintf("Direction: %u, ", (info
>> 9) & 0x3);
1428 tprintf("Res: %u, ", info
& 0x1FF);
1429 tprintf("Serv Start Time: %uus, ", le32_to_cpu(schedule
->start
));
1430 tprintf("Serv Interval: %uus, ", le32_to_cpu(schedule
->serv_intv
));
1431 tprintf("Spec Interval: %fs", le32_to_cpu(schedule
->spec_intv
) * TU
);
1436 static int8_t inf_chall_txt(struct pkt_buff
*pkt
, u8
*id
)
1438 struct element_chall_txt
*chall_txt
;
1442 chall_txt
= (struct element_chall_txt
*)
1443 pkt_pull(pkt
, sizeof(*chall_txt
));
1444 if (chall_txt
== NULL
)
1447 tprintf("Challenge Text (%u, Len(%u)): ", *id
, chall_txt
->len
);
1448 if ((chall_txt
->len
- sizeof(*chall_txt
) + 1) > 0) {
1449 txt
= pkt_pull(pkt
, (chall_txt
->len
- sizeof(*chall_txt
) + 1));
1454 for (i
= 0; i
< (chall_txt
->len
- sizeof(*chall_txt
) + 1); i
++)
1455 tprintf("%x ", txt
[i
]);
1461 static int8_t inf_pwr_constr(struct pkt_buff
*pkt
, u8
*id
)
1463 struct element_pwr_constr
*pwr_constr
;
1465 pwr_constr
= (struct element_pwr_constr
*) pkt_pull(pkt
, sizeof(*pwr_constr
));
1466 if (pwr_constr
== NULL
)
1469 tprintf("Power Constraint (%u, Len(%u)): ", *id
, pwr_constr
->len
);
1470 if (len_neq_error(pwr_constr
->len
, 1))
1473 tprintf("Local Power Constraint: %udB", pwr_constr
->local_pwr_constr
);
1478 static int8_t inf_pwr_cap(struct pkt_buff
*pkt
, u8
*id
)
1480 struct element_pwr_cap
*pwr_cap
;
1482 pwr_cap
= (struct element_pwr_cap
*) pkt_pull(pkt
, sizeof(*pwr_cap
));
1483 if (pwr_cap
== NULL
)
1486 tprintf("Power Capability (%u, Len(%u)): ", *id
, pwr_cap
->len
);
1487 if (len_neq_error(pwr_cap
->len
, 2))
1490 tprintf("Min. Transm. Pwr Cap.: %ddBm, ", (int8_t)pwr_cap
->min_pwr_cap
);
1491 tprintf("Max. Transm. Pwr Cap.: %ddBm", (int8_t)pwr_cap
->max_pwr_cap
);
1496 static int8_t inf_tpc_req(struct pkt_buff
*pkt
, u8
*id
)
1498 struct element_tpc_req
*tpc_req
;
1500 tpc_req
= (struct element_tpc_req
*) pkt_pull(pkt
, sizeof(*tpc_req
));
1501 if (tpc_req
== NULL
)
1504 tprintf("TPC Request (%u, Len(%u))", *id
, tpc_req
->len
);
1505 if (len_neq_error(tpc_req
->len
, 0))
1511 static int8_t inf_tpc_rep(struct pkt_buff
*pkt
, u8
*id
)
1513 struct element_tpc_rep
*tpc_rep
;
1515 tpc_rep
= (struct element_tpc_rep
*) pkt_pull(pkt
, sizeof(*tpc_rep
));
1516 if (tpc_rep
== NULL
)
1519 tprintf("TPC Report (%u, Len(%u)): ", *id
, tpc_rep
->len
);
1520 if (len_neq_error(tpc_rep
->len
, 2))
1523 tprintf("Transmit Power: %udBm, ", (int8_t)tpc_rep
->trans_pwr
);
1524 tprintf("Link Margin: %udB", (int8_t)tpc_rep
->trans_pwr
);
1529 static int8_t inf_supp_ch(struct pkt_buff
*pkt
, u8
*id
)
1531 struct element_supp_ch
*supp_ch
;
1534 supp_ch
= (struct element_supp_ch
*) pkt_pull(pkt
, sizeof(*supp_ch
));
1535 if (supp_ch
== NULL
)
1538 tprintf("Supp Channels (%u, Len(%u)): ", *id
, supp_ch
->len
);
1539 if (len_lt_error(supp_ch
->len
, 2))
1542 if(supp_ch
->len
& 1) {
1543 tprintf("Length should be modulo 2");
1547 for (i
= 0; i
< supp_ch
->len
; i
+= 2) {
1548 struct element_supp_ch_tuple
*supp_ch_tuple
;
1550 supp_ch_tuple
= (struct element_supp_ch_tuple
*)
1551 pkt_pull(pkt
, sizeof(*supp_ch_tuple
));
1552 if (supp_ch_tuple
== NULL
)
1555 tprintf("First Channel Nr: %u, ", supp_ch_tuple
->first_ch_nr
);
1556 tprintf("Nr of Channels: %u, ", supp_ch_tuple
->nr_ch
);
1562 static int8_t inf_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
)
1564 struct element_ch_sw_ann
*ch_sw_ann
;
1566 ch_sw_ann
= (struct element_ch_sw_ann
*)
1567 pkt_pull(pkt
, sizeof(*ch_sw_ann
));
1568 if (ch_sw_ann
== NULL
)
1571 tprintf("Channel Switch Announc (%u, Len(%u)): ", *id
, ch_sw_ann
->len
);
1572 if (len_neq_error(ch_sw_ann
->len
, 3))
1575 tprintf("Switch Mode: %u, ", ch_sw_ann
->switch_mode
);
1576 tprintf("New Nr: %u, ", ch_sw_ann
->new_nr
);
1577 tprintf("Switch Count: %u", ch_sw_ann
->switch_cnt
);
1582 static const char *meas_type(u8 type
)
1585 case 0: return "Basic";
1586 case 1: return "Clear Channel assesment (CCA)";
1587 case 2: return "Receive power indication (RPI) histogram";
1588 case 3: return "Channel load";
1589 case 4: return "Noise histogram";
1590 case 5: return "Beacon";
1591 case 6: return "Frame";
1592 case 7: return "STA statistics";
1593 case 8: return "LCI";
1594 case 9: return "Transmit stream/category measurement";
1595 case 10: return "Multicast diagnostics";
1596 case 11: return "Location Civic";
1597 case 12: return "Location Identifier";
1598 case 13 ... 255: return "Reserved";
1602 static int8_t inf_meas_req(struct pkt_buff
*pkt
, u8
*id
)
1604 struct element_meas_req
*meas_req
;
1606 meas_req
= (struct element_meas_req
*) pkt_pull(pkt
, sizeof(*meas_req
));
1607 if (meas_req
== NULL
)
1610 tprintf("Measurement Req (%u, Len(%u)): ", *id
, meas_req
->len
);
1611 if (len_lt_error(meas_req
->len
, 3))
1614 tprintf("Token: %u, ", meas_req
->token
);
1615 tprintf("Req Mode: 0x%x (Parallel (%u), Enable(%u), Request(%u), "
1616 "Report(%u), Dur Mand(%u)), ", meas_req
->req_mode
,
1617 meas_req
->req_mode
>> 7, (meas_req
->req_mode
>> 6) & 0x1,
1618 (meas_req
->req_mode
>> 5) & 0x1, (meas_req
->req_mode
>> 4) & 0x1,
1619 (meas_req
->req_mode
>> 3) & 0x1);
1620 tprintf("Type: %s (%u), ", meas_type(meas_req
->type
), meas_req
->type
);
1622 if(meas_req
->len
> 3) {
1623 if(meas_req
->type
== 0) {
1624 struct element_meas_basic
*basic
;
1626 basic
= (struct element_meas_basic
*)
1627 pkt_pull(pkt
, sizeof(*basic
));
1631 if (!(meas_req
->len
- 3 - sizeof(*basic
))) {
1632 tprintf("Length of Req matchs not Type %u",
1637 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
1638 tprintf("Meas Start Time: %lu, ",
1639 le64_to_cpu(basic
->start
));
1640 tprintf("Meas Duration: %fs",
1641 le16_to_cpu(basic
->dur
) * TU
);
1644 else if(meas_req
->type
== 1) {
1645 struct element_meas_cca
*cca
;
1647 cca
= (struct element_meas_cca
*)
1648 pkt_pull(pkt
, sizeof(*cca
));
1652 if (!(meas_req
->len
- 3 - sizeof(*cca
))) {
1653 tprintf("Length of Req matchs not Type %u",
1658 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
1659 tprintf("Meas Start Time: %lu, ",
1660 le64_to_cpu(cca
->start
));
1661 tprintf("Meas Duration: %fs",
1662 le16_to_cpu(cca
->dur
) * TU
);
1664 else if(meas_req
->type
== 2) {
1665 struct element_meas_rpi
*rpi
;
1667 rpi
= (struct element_meas_rpi
*)
1668 pkt_pull(pkt
, sizeof(*rpi
));
1672 if (!(meas_req
->len
- 3 - sizeof(*rpi
))) {
1673 tprintf("Length of Req matchs not Type %u",
1678 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
1679 tprintf("Meas Start Time: %lu, ",
1680 le64_to_cpu(rpi
->start
));
1681 tprintf("Meas Duration: %fs",
1682 le16_to_cpu(rpi
->dur
) * TU
);
1684 else if(meas_req
->type
== 3) {
1685 struct element_meas_ch_load
*ch_load
;
1687 ch_load
= (struct element_meas_ch_load
*)
1688 pkt_pull(pkt
, sizeof(*ch_load
));
1689 if (ch_load
== NULL
)
1692 if ((meas_req
->len
- 3 - sizeof(*ch_load
)) >= 0) {
1693 tprintf("Length of Req matchs not Type %u",
1698 tprintf("OP Class: %u, ", ch_load
->op_class
);
1699 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
1700 tprintf("Rand Intv: %fs, ",
1701 le16_to_cpu(ch_load
->rand_intv
) * TU
);
1702 tprintf("Meas Duration: %fs",
1703 le16_to_cpu(ch_load
->dur
) * TU
);
1705 if(!subelements(pkt
,
1706 meas_req
->len
- 3 - sizeof(*ch_load
)))
1709 else if(meas_req
->type
== 4) {
1710 struct element_meas_noise
*noise
;
1712 noise
= (struct element_meas_noise
*)
1713 pkt_pull(pkt
, sizeof(*noise
));
1717 if ((meas_req
->len
- 3 - sizeof(*noise
)) >= 0) {
1718 tprintf("Length of Req matchs not Type %u",
1723 tprintf("OP Class: %u, ", noise
->op_class
);
1724 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
1725 tprintf("Rand Intv: %fs, ",
1726 le16_to_cpu(noise
->rand_intv
) * TU
);
1727 tprintf("Meas Duration: %fs",
1728 le16_to_cpu(noise
->dur
) * TU
);
1730 if(!subelements(pkt
,
1731 meas_req
->len
- 3 - sizeof(*noise
)))
1734 else if(meas_req
->type
== 5) {
1735 struct element_meas_beacon
*beacon
;
1737 beacon
= (struct element_meas_beacon
*)
1738 pkt_pull(pkt
, sizeof(*beacon
));
1742 if ((meas_req
->len
- 3 - sizeof(*beacon
)) >= 0) {
1743 tprintf("Length of Req matchs not Type %u",
1748 tprintf("OP Class: %u, ", beacon
->op_class
);
1749 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
1750 tprintf("Rand Intv: %fs, ",
1751 le16_to_cpu(beacon
->rand_intv
) * TU
);
1752 tprintf("Meas Duration: %fs",
1753 le16_to_cpu(beacon
->dur
) * TU
);
1754 tprintf("Mode: %u, ", beacon
->mode
);
1755 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1756 beacon
->bssid
[0], beacon
->bssid
[1],
1757 beacon
->bssid
[2], beacon
->bssid
[3],
1758 beacon
->bssid
[4], beacon
->bssid
[5]);
1760 if(!subelements(pkt
,
1761 meas_req
->len
- 3 - sizeof(*beacon
)))
1764 else if(meas_req
->type
== 6) {
1765 struct element_meas_frame
*frame
;
1767 frame
= (struct element_meas_frame
*)
1768 pkt_pull(pkt
, sizeof(*frame
));
1772 if ((meas_req
->len
- 3 - sizeof(*frame
)) >= 0) {
1773 tprintf("Length of Req matchs not Type %u",
1778 tprintf("OP Class: %u, ", frame
->op_class
);
1779 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
1780 tprintf("Rand Intv: %fs, ",
1781 le16_to_cpu(frame
->rand_intv
) * TU
);
1782 tprintf("Meas Duration: %fs",
1783 le16_to_cpu(frame
->dur
) * TU
);
1784 tprintf("Request Type: %u, ", frame
->frame
);
1785 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1786 frame
->mac
[0], frame
->mac
[1],
1787 frame
->mac
[2], frame
->mac
[3],
1788 frame
->mac
[4], frame
->mac
[5]);
1790 if(!subelements(pkt
,
1791 meas_req
->len
- 3 - sizeof(*frame
)))
1794 else if(meas_req
->type
== 7) {
1795 struct element_meas_sta
*sta
;
1797 sta
= (struct element_meas_sta
*)
1798 pkt_pull(pkt
, sizeof(*sta
));
1802 if ((meas_req
->len
- 3 - sizeof(*sta
)) >= 0) {
1803 tprintf("Length of Req matchs not Type %u",
1808 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1809 sta
->peer_mac
[0], sta
->peer_mac
[1],
1810 sta
->peer_mac
[2], sta
->peer_mac
[3],
1811 sta
->peer_mac
[4], sta
->peer_mac
[5]);
1812 tprintf("Rand Intv: %fs, ",
1813 le16_to_cpu(sta
->rand_intv
) * TU
);
1814 tprintf("Meas Duration: %fs",
1815 le16_to_cpu(sta
->dur
) * TU
);
1816 tprintf("Group ID: %u, ", sta
->group_id
);
1818 if(!subelements(pkt
,
1819 meas_req
->len
- 3 - sizeof(*sta
)))
1822 else if(meas_req
->type
== 8) {
1823 struct element_meas_lci
*lci
;
1825 lci
= (struct element_meas_lci
*)
1826 pkt_pull(pkt
, sizeof(*lci
));
1830 if ((meas_req
->len
- 3 - sizeof(*lci
)) >= 0) {
1831 tprintf("Length of Req matchs not Type %u",
1836 tprintf("Location Subj: %u, ", lci
->loc_subj
);
1837 tprintf("Latitude Req Res: %udeg",
1838 lci
->latitude_req_res
);
1839 tprintf("Longitude Req Res: %udeg",
1840 lci
->longitude_req_res
);
1841 tprintf("Altitude Req Res: %udeg",
1842 lci
->altitude_req_res
);
1844 if(!subelements(pkt
,
1845 meas_req
->len
- 3 - sizeof(*lci
)))
1848 else if(meas_req
->type
== 9) {
1849 struct element_meas_trans_str_cat
*trans
;
1851 trans
= (struct element_meas_trans_str_cat
*)
1852 pkt_pull(pkt
, sizeof(*trans
));
1856 if ((meas_req
->len
- 3 - sizeof(*trans
)) >= 0) {
1857 tprintf("Length of Req matchs not Type %u",
1862 tprintf("Rand Intv: %fs, ",
1863 le16_to_cpu(trans
->rand_intv
) * TU
);
1864 tprintf("Meas Duration: %fs",
1865 le16_to_cpu(trans
->dur
) * TU
);
1866 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1867 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
1868 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
1869 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
1870 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
1871 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
1873 if(!subelements(pkt
,
1874 meas_req
->len
- 3 - sizeof(*trans
)))
1877 else if(meas_req
->type
== 10) {
1878 struct element_meas_mcast_diag
*mcast
;
1880 mcast
= (struct element_meas_mcast_diag
*)
1881 pkt_pull(pkt
, sizeof(*mcast
));
1885 if ((meas_req
->len
- 3 - sizeof(*mcast
)) >= 0) {
1886 tprintf("Length of Req matchs not Type %u",
1891 tprintf("Rand Intv: %fs, ",
1892 le16_to_cpu(mcast
->rand_intv
) * TU
);
1893 tprintf("Meas Duration: %fs",
1894 le16_to_cpu(mcast
->dur
) * TU
);
1895 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1896 mcast
->group_mac
[0], mcast
->group_mac
[1],
1897 mcast
->group_mac
[2], mcast
->group_mac
[3],
1898 mcast
->group_mac
[4], mcast
->group_mac
[5]);
1900 if(!subelements(pkt
,
1901 meas_req
->len
- 3 - sizeof(*mcast
)))
1904 else if(meas_req
->type
== 11) {
1905 struct element_meas_loc_civic
*civic
;
1907 civic
= (struct element_meas_loc_civic
*)
1908 pkt_pull(pkt
, sizeof(*civic
));
1912 if ((meas_req
->len
- 3 - sizeof(*civic
)) >= 0) {
1913 tprintf("Length of Req matchs not Type %u",
1918 tprintf("Location Subj: %u, ", civic
->loc_subj
);
1919 tprintf("Type: %u, ", civic
->civic_loc
);
1920 tprintf("Srv Intv Units: %u, ",
1921 le16_to_cpu(civic
->loc_srv_intv_unit
));
1922 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
1924 if(!subelements(pkt
,
1925 meas_req
->len
- 3 - sizeof(*civic
)))
1928 else if(meas_req
->type
== 12) {
1929 struct element_meas_loc_id
*id
;
1931 id
= (struct element_meas_loc_id
*)
1932 pkt_pull(pkt
, sizeof(*id
));
1936 if ((meas_req
->len
- 3 - sizeof(*id
)) >= 0) {
1937 tprintf("Length of Req matchs not Type %u",
1942 tprintf("Location Subj: %u, ", id
->loc_subj
);
1943 tprintf("Srv Intv Units: %u, ",
1944 le16_to_cpu(id
->loc_srv_intv_unit
));
1945 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
1947 if(!subelements(pkt
,
1948 meas_req
->len
- 3 - sizeof(*id
)))
1951 else if(meas_req
->type
== 255) {
1952 struct element_meas_pause
*pause
;
1954 pause
= (struct element_meas_pause
*)
1955 pkt_pull(pkt
, sizeof(*pause
));
1959 if ((meas_req
->len
- 3 - sizeof(*pause
)) >= 0) {
1960 tprintf("Length of Req matchs not Type %u",
1965 tprintf("Pause Time: %fs, ", pause
->time
* 10 * TU
);
1967 if(!subelements(pkt
,
1968 meas_req
->len
- 3 - sizeof(*pause
)))
1972 tprintf("Length field indicates data,"
1973 " but could not interpreted");
1981 static int8_t inf_meas_rep(struct pkt_buff
*pkt
, u8
*id
)
1983 struct element_meas_rep
*meas_rep
;
1985 meas_rep
= (struct element_meas_rep
*) pkt_pull(pkt
, sizeof(*meas_rep
));
1986 if (meas_rep
== NULL
)
1989 tprintf("Measurement Rep (%u, Len(%u)): ", *id
, meas_rep
->len
);
1990 if (len_lt_error(meas_rep
->len
, 3))
1993 tprintf("Token: %u, ", meas_rep
->token
);
1994 tprintf("Rep Mode: 0x%x (Late (%u), Incapable(%u), Refused(%u), ",
1995 meas_rep
->rep_mode
, meas_rep
->rep_mode
>> 7,
1996 (meas_rep
->rep_mode
>> 6) & 0x1,
1997 (meas_rep
->rep_mode
>> 5) & 0x1);
1998 tprintf("Type: %s (%u), ", meas_type(meas_rep
->type
), meas_rep
->type
);
2000 if(meas_rep
->len
> 3) {
2001 if(meas_rep
->type
== 0) {
2002 struct element_meas_basic
*basic
;
2004 basic
= (struct element_meas_basic
*)
2005 pkt_pull(pkt
, sizeof(*basic
));
2009 if (!(meas_rep
->len
- 3 - sizeof(*basic
))) {
2010 tprintf("Length of Req matchs not Type %u",
2015 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
2016 tprintf("Meas Start Time: %lu, ",
2017 le64_to_cpu(basic
->start
));
2018 tprintf("Meas Duration: %fs",
2019 le16_to_cpu(basic
->dur
) * TU
);
2022 else if(meas_rep
->type
== 1) {
2023 struct element_meas_cca
*cca
;
2025 cca
= (struct element_meas_cca
*)
2026 pkt_pull(pkt
, sizeof(*cca
));
2030 if (!(meas_rep
->len
- 3 - sizeof(*cca
))) {
2031 tprintf("Length of Req matchs not Type %u",
2036 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
2037 tprintf("Meas Start Time: %lu, ",
2038 le64_to_cpu(cca
->start
));
2039 tprintf("Meas Duration: %fs",
2040 le16_to_cpu(cca
->dur
) * TU
);
2042 else if(meas_rep
->type
== 2) {
2043 struct element_meas_rpi
*rpi
;
2045 rpi
= (struct element_meas_rpi
*)
2046 pkt_pull(pkt
, sizeof(*rpi
));
2050 if (!(meas_rep
->len
- 3 - sizeof(*rpi
))) {
2051 tprintf("Length of Req matchs not Type %u",
2056 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
2057 tprintf("Meas Start Time: %lu, ",
2058 le64_to_cpu(rpi
->start
));
2059 tprintf("Meas Duration: %fs",
2060 le16_to_cpu(rpi
->dur
) * TU
);
2062 else if(meas_rep
->type
== 3) {
2063 struct element_meas_ch_load
*ch_load
;
2065 ch_load
= (struct element_meas_ch_load
*)
2066 pkt_pull(pkt
, sizeof(*ch_load
));
2067 if (ch_load
== NULL
)
2070 if ((meas_rep
->len
- 3 - sizeof(*ch_load
)) >= 0) {
2071 tprintf("Length of Req matchs not Type %u",
2076 tprintf("OP Class: %u, ", ch_load
->op_class
);
2077 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
2078 tprintf("Rand Intv: %fs, ",
2079 le16_to_cpu(ch_load
->rand_intv
) * TU
);
2080 tprintf("Meas Duration: %fs",
2081 le16_to_cpu(ch_load
->dur
) * TU
);
2083 if(!subelements(pkt
,
2084 meas_rep
->len
- 3 - sizeof(*ch_load
)))
2087 else if(meas_rep
->type
== 4) {
2088 struct element_meas_noise
*noise
;
2090 noise
= (struct element_meas_noise
*)
2091 pkt_pull(pkt
, sizeof(*noise
));
2095 if ((meas_rep
->len
- 3 - sizeof(*noise
)) >= 0) {
2096 tprintf("Length of Req matchs not Type %u",
2101 tprintf("OP Class: %u, ", noise
->op_class
);
2102 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
2103 tprintf("Rand Intv: %fs, ",
2104 le16_to_cpu(noise
->rand_intv
) * TU
);
2105 tprintf("Meas Duration: %fs",
2106 le16_to_cpu(noise
->dur
) * TU
);
2108 if(!subelements(pkt
,
2109 meas_rep
->len
- 3 - sizeof(*noise
)))
2112 else if(meas_rep
->type
== 5) {
2113 struct element_meas_beacon
*beacon
;
2115 beacon
= (struct element_meas_beacon
*)
2116 pkt_pull(pkt
, sizeof(*beacon
));
2120 if ((meas_rep
->len
- 3 - sizeof(*beacon
)) >= 0) {
2121 tprintf("Length of Req matchs not Type %u",
2126 tprintf("OP Class: %u, ", beacon
->op_class
);
2127 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
2128 tprintf("Rand Intv: %fs, ",
2129 le16_to_cpu(beacon
->rand_intv
) * TU
);
2130 tprintf("Meas Duration: %fs",
2131 le16_to_cpu(beacon
->dur
) * TU
);
2132 tprintf("Mode: %u, ", beacon
->mode
);
2133 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2134 beacon
->bssid
[0], beacon
->bssid
[1],
2135 beacon
->bssid
[2], beacon
->bssid
[3],
2136 beacon
->bssid
[4], beacon
->bssid
[5]);
2138 if(!subelements(pkt
,
2139 meas_rep
->len
- 3 - sizeof(*beacon
)))
2142 else if(meas_rep
->type
== 6) {
2143 struct element_meas_frame
*frame
;
2145 frame
= (struct element_meas_frame
*)
2146 pkt_pull(pkt
, sizeof(*frame
));
2150 if ((meas_rep
->len
- 3 - sizeof(*frame
)) >= 0) {
2151 tprintf("Length of Req matchs not Type %u",
2156 tprintf("OP Class: %u, ", frame
->op_class
);
2157 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
2158 tprintf("Rand Intv: %fs, ",
2159 le16_to_cpu(frame
->rand_intv
) * TU
);
2160 tprintf("Meas Duration: %fs",
2161 le16_to_cpu(frame
->dur
) * TU
);
2162 tprintf("Request Type: %u, ", frame
->frame
);
2163 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2164 frame
->mac
[0], frame
->mac
[1],
2165 frame
->mac
[2], frame
->mac
[3],
2166 frame
->mac
[4], frame
->mac
[5]);
2168 if(!subelements(pkt
,
2169 meas_rep
->len
- 3 - sizeof(*frame
)))
2172 else if(meas_rep
->type
== 7) {
2173 struct element_meas_sta
*sta
;
2175 sta
= (struct element_meas_sta
*)
2176 pkt_pull(pkt
, sizeof(*sta
));
2180 if ((meas_rep
->len
- 3 - sizeof(*sta
)) >= 0) {
2181 tprintf("Length of Req matchs not Type %u",
2186 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2187 sta
->peer_mac
[0], sta
->peer_mac
[1],
2188 sta
->peer_mac
[2], sta
->peer_mac
[3],
2189 sta
->peer_mac
[4], sta
->peer_mac
[5]);
2190 tprintf("Rand Intv: %fs, ",
2191 le16_to_cpu(sta
->rand_intv
) * TU
);
2192 tprintf("Meas Duration: %fs",
2193 le16_to_cpu(sta
->dur
) * TU
);
2194 tprintf("Group ID: %u, ", sta
->group_id
);
2196 if(!subelements(pkt
,
2197 meas_rep
->len
- 3 - sizeof(*sta
)))
2200 else if(meas_rep
->type
== 8) {
2201 struct element_meas_lci
*lci
;
2203 lci
= (struct element_meas_lci
*)
2204 pkt_pull(pkt
, sizeof(*lci
));
2208 if ((meas_rep
->len
- 3 - sizeof(*lci
)) >= 0) {
2209 tprintf("Length of Req matchs not Type %u",
2214 tprintf("Location Subj: %u, ", lci
->loc_subj
);
2215 tprintf("Latitude Req Res: %udeg",
2216 lci
->latitude_req_res
);
2217 tprintf("Longitude Req Res: %udeg",
2218 lci
->longitude_req_res
);
2219 tprintf("Altitude Req Res: %udeg",
2220 lci
->altitude_req_res
);
2222 if(!subelements(pkt
,
2223 meas_rep
->len
- 3 - sizeof(*lci
)))
2226 else if(meas_rep
->type
== 9) {
2227 struct element_meas_trans_str_cat
*trans
;
2229 trans
= (struct element_meas_trans_str_cat
*)
2230 pkt_pull(pkt
, sizeof(*trans
));
2234 if ((meas_rep
->len
- 3 - sizeof(*trans
)) >= 0) {
2235 tprintf("Length of Req matchs not Type %u",
2240 tprintf("Rand Intv: %fs, ",
2241 le16_to_cpu(trans
->rand_intv
) * TU
);
2242 tprintf("Meas Duration: %fs",
2243 le16_to_cpu(trans
->dur
) * TU
);
2244 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2245 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
2246 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
2247 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
2248 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
2249 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
2251 if(!subelements(pkt
,
2252 meas_rep
->len
- 3 - sizeof(*trans
)))
2255 else if(meas_rep
->type
== 10) {
2256 struct element_meas_mcast_diag
*mcast
;
2258 mcast
= (struct element_meas_mcast_diag
*)
2259 pkt_pull(pkt
, sizeof(*mcast
));
2263 if ((meas_rep
->len
- 3 - sizeof(*mcast
)) >= 0) {
2264 tprintf("Length of Req matchs not Type %u",
2269 tprintf("Rand Intv: %fs, ",
2270 le16_to_cpu(mcast
->rand_intv
) * TU
);
2271 tprintf("Meas Duration: %fs",
2272 le16_to_cpu(mcast
->dur
) * TU
);
2273 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2274 mcast
->group_mac
[0], mcast
->group_mac
[1],
2275 mcast
->group_mac
[2], mcast
->group_mac
[3],
2276 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2278 if(!subelements(pkt
,
2279 meas_rep
->len
- 3 - sizeof(*mcast
)))
2282 else if(meas_rep
->type
== 11) {
2283 struct element_meas_loc_civic
*civic
;
2285 civic
= (struct element_meas_loc_civic
*)
2286 pkt_pull(pkt
, sizeof(*civic
));
2290 if ((meas_rep
->len
- 3 - sizeof(*civic
)) >= 0) {
2291 tprintf("Length of Req matchs not Type %u",
2296 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2297 tprintf("Type: %u, ", civic
->civic_loc
);
2298 tprintf("Srv Intv Units: %u, ",
2299 le16_to_cpu(civic
->loc_srv_intv_unit
));
2300 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2302 if(!subelements(pkt
,
2303 meas_rep
->len
- 3 - sizeof(*civic
)))
2306 else if(meas_rep
->type
== 12) {
2307 struct element_meas_loc_id
*id
;
2309 id
= (struct element_meas_loc_id
*)
2310 pkt_pull(pkt
, sizeof(*id
));
2314 if ((meas_rep
->len
- 3 - sizeof(*id
)) >= 0) {
2315 tprintf("Length of Req matchs not Type %u",
2320 tprintf("Location Subj: %u, ", id
->loc_subj
);
2321 tprintf("Srv Intv Units: %u, ",
2322 le16_to_cpu(id
->loc_srv_intv_unit
));
2323 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2325 if(!subelements(pkt
,
2326 meas_rep
->len
- 3 - sizeof(*id
)))
2330 tprintf("Length field indicates data,"
2331 " but could not interpreted");
2339 static int8_t inf_quiet(struct pkt_buff
*pkt
, u8
*id
)
2341 struct element_quiet
*quiet
;
2343 quiet
= (struct element_quiet
*) pkt_pull(pkt
, sizeof(*quiet
));
2347 tprintf("Quit (%u, Len(%u)): ", *id
, quiet
->len
);
2348 if (len_neq_error(quiet
->len
, 6))
2351 tprintf("Count: %ud, ", quiet
->cnt
);
2352 tprintf("Period: %u, ", quiet
->period
);
2353 tprintf("Duration: %fs, ", le16_to_cpu(quiet
->dur
) * TU
);
2354 tprintf("Offs: %fs", le16_to_cpu(quiet
->offs
) * TU
);
2360 static int8_t inf_ibss_dfs(struct pkt_buff
*pkt
, u8
*id
)
2362 struct element_ibss_dfs
*ibss_dfs
;
2365 ibss_dfs
= (struct element_ibss_dfs
*) pkt_pull(pkt
, sizeof(*ibss_dfs
));
2366 if (ibss_dfs
== NULL
)
2369 tprintf("IBSS DFS (%u, Len(%u)): ", *id
, ibss_dfs
->len
);
2370 if (len_lt_error(ibss_dfs
->len
, 7))
2373 tprintf("Owner: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2374 ibss_dfs
->owner
[0], ibss_dfs
->owner
[1],
2375 ibss_dfs
->owner
[2], ibss_dfs
->owner
[3],
2376 ibss_dfs
->owner
[4], ibss_dfs
->owner
[5]);
2377 tprintf("Recovery Intv: %u, ", ibss_dfs
->rec_intv
);
2379 if((ibss_dfs
->len
- sizeof(*ibss_dfs
) + 1) & 1) {
2380 tprintf("Length of Channel Map should be modulo 2");
2384 for (i
= 0; i
< ibss_dfs
->len
; i
+= 2) {
2385 struct element_ibss_dfs_tuple
*ibss_dfs_tuple
;
2387 ibss_dfs_tuple
= (struct element_ibss_dfs_tuple
*)
2388 pkt_pull(pkt
, sizeof(*ibss_dfs_tuple
));
2389 if (ibss_dfs_tuple
== NULL
)
2392 tprintf("Channel Nr: %u, ", ibss_dfs_tuple
->ch_nr
);
2393 tprintf("Map: %u, ", ibss_dfs_tuple
->map
);
2399 static int8_t inf_erp(struct pkt_buff
*pkt
, u8
*id
)
2401 struct element_erp
*erp
;
2403 erp
= (struct element_erp
*) pkt_pull(pkt
, sizeof(*erp
));
2407 tprintf("ERP (%u, Len(%u)): ", *id
, erp
->len
);
2408 if (len_neq_error(erp
->len
, 1))
2410 tprintf("Non ERP Present (%u), ", erp
->param
& 0x1);
2411 tprintf("Use Protection (%u), ", (erp
->param
>> 1) & 0x1);
2412 tprintf("Barker Preamble Mode (%u), ", (erp
->param
>> 2) & 0x1);
2413 tprintf("Reserved (0x%.5x)", erp
->param
>> 3);
2418 static int8_t inf_ts_del(struct pkt_buff
*pkt
, u8
*id
)
2423 static int8_t inf_tclas_proc(struct pkt_buff
*pkt
, u8
*id
)
2428 static int8_t inf_ht_cap(struct pkt_buff
*pkt
, u8
*id
)
2433 static int8_t inf_qos_cap(struct pkt_buff
*pkt
, u8
*id
)
2438 static int8_t inf_rsn(struct pkt_buff
*pkt
, u8
*id
)
2443 static int8_t inf_ext_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
2447 struct element_ext_supp_rates
*ext_supp_rates
;
2449 ext_supp_rates
= (struct element_ext_supp_rates
*)
2450 pkt_pull(pkt
, sizeof(*ext_supp_rates
));
2451 if (ext_supp_rates
== NULL
)
2454 tprintf("Ext Support Rates (%u, Len(%u)): ", *id
, ext_supp_rates
->len
);
2456 if ((ext_supp_rates
->len
- sizeof(*ext_supp_rates
) + 1) > 0) {
2457 rates
= pkt_pull(pkt
, ext_supp_rates
->len
);
2461 for (i
= 0; i
< ext_supp_rates
->len
; i
++)
2462 tprintf("%g ", (rates
[i
] & 0x80) ?
2463 ((rates
[i
] & 0x3f) * 0.5) :
2464 data_rates(rates
[i
]));
2471 static int8_t inf_ap_ch_exp(struct pkt_buff
*pkt
, u8
*id
) {
2475 static int8_t inf_neighb_rep(struct pkt_buff
*pkt
, u8
*id
) {
2479 static int8_t inf_rcpi(struct pkt_buff
*pkt
, u8
*id
) {
2483 static int8_t inf_mde(struct pkt_buff
*pkt
, u8
*id
) {
2487 static int8_t inf_fte(struct pkt_buff
*pkt
, u8
*id
) {
2491 static int8_t inf_time_out_int(struct pkt_buff
*pkt
, u8
*id
) {
2495 static int8_t inf_rde(struct pkt_buff
*pkt
, u8
*id
) {
2499 static int8_t inf_dse_reg_loc(struct pkt_buff
*pkt
, u8
*id
) {
2503 static int8_t inf_supp_op_class(struct pkt_buff
*pkt
, u8
*id
) {
2507 static int8_t inf_ext_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
) {
2511 static int8_t inf_ht_op(struct pkt_buff
*pkt
, u8
*id
) {
2515 static int8_t inf_sec_ch_offs(struct pkt_buff
*pkt
, u8
*id
) {
2519 static int8_t inf_bss_avg_acc_del(struct pkt_buff
*pkt
, u8
*id
) {
2523 static int8_t inf_ant(struct pkt_buff
*pkt
, u8
*id
) {
2527 static int8_t inf_rsni(struct pkt_buff
*pkt
, u8
*id
) {
2531 static int8_t inf_meas_pilot_trans(struct pkt_buff
*pkt
, u8
*id
) {
2535 static int8_t inf_bss_avl_adm_cap(struct pkt_buff
*pkt
, u8
*id
) {
2539 static int8_t inf_bss_ac_acc_del(struct pkt_buff
*pkt
, u8
*id
) {
2543 static int8_t inf_time_adv(struct pkt_buff
*pkt
, u8
*id
) {
2547 static int8_t inf_rm_ena_cap(struct pkt_buff
*pkt
, u8
*id
) {
2551 static int8_t inf_mult_bssid(struct pkt_buff
*pkt
, u8
*id
) {
2555 static int8_t inf_20_40_bss_coex(struct pkt_buff
*pkt
, u8
*id
) {
2559 static int8_t inf_20_40_bss_int_ch_rep(struct pkt_buff
*pkt
, u8
*id
) {
2563 static int8_t inf_overl_bss_scan_para(struct pkt_buff
*pkt
, u8
*id
) {
2567 static int8_t inf_ric_desc(struct pkt_buff
*pkt
, u8
*id
) {
2571 static int8_t inf_mgmt_mic(struct pkt_buff
*pkt
, u8
*id
) {
2575 static int8_t inf_ev_req(struct pkt_buff
*pkt
, u8
*id
) {
2579 static int8_t inf_ev_rep(struct pkt_buff
*pkt
, u8
*id
) {
2583 static int8_t inf_diagn_req(struct pkt_buff
*pkt
, u8
*id
) {
2587 static int8_t inf_diagn_rep(struct pkt_buff
*pkt
, u8
*id
) {
2591 static int8_t inf_loc_para(struct pkt_buff
*pkt
, u8
*id
) {
2595 static int8_t inf_nontr_bssid_cap(struct pkt_buff
*pkt
, u8
*id
) {
2599 static int8_t inf_ssid_list(struct pkt_buff
*pkt
, u8
*id
) {
2603 static int8_t inf_mult_bssid_index(struct pkt_buff
*pkt
, u8
*id
) {
2607 static int8_t inf_fms_desc(struct pkt_buff
*pkt
, u8
*id
) {
2611 static int8_t inf_fms_req(struct pkt_buff
*pkt
, u8
*id
) {
2615 static int8_t inf_fms_resp(struct pkt_buff
*pkt
, u8
*id
) {
2619 static int8_t inf_qos_tfc_cap(struct pkt_buff
*pkt
, u8
*id
) {
2623 static int8_t inf_bss_max_idle_per(struct pkt_buff
*pkt
, u8
*id
) {
2627 static int8_t inf_tfs_req(struct pkt_buff
*pkt
, u8
*id
) {
2631 static int8_t inf_tfs_resp(struct pkt_buff
*pkt
, u8
*id
) {
2635 static int8_t inf_wnm_sleep_mod(struct pkt_buff
*pkt
, u8
*id
) {
2639 static int8_t inf_tim_bcst_req(struct pkt_buff
*pkt
, u8
*id
) {
2643 static int8_t inf_tim_bcst_resp(struct pkt_buff
*pkt
, u8
*id
) {
2647 static int8_t inf_coll_interf_rep(struct pkt_buff
*pkt
, u8
*id
) {
2651 static int8_t inf_ch_usage(struct pkt_buff
*pkt
, u8
*id
) {
2655 static int8_t inf_time_zone(struct pkt_buff
*pkt
, u8
*id
) {
2659 static int8_t inf_dms_req(struct pkt_buff
*pkt
, u8
*id
) {
2663 static int8_t inf_dms_resp(struct pkt_buff
*pkt
, u8
*id
) {
2667 static int8_t inf_link_id(struct pkt_buff
*pkt
, u8
*id
) {
2671 static int8_t inf_wakeup_sched(struct pkt_buff
*pkt
, u8
*id
) {
2675 static int8_t inf_ch_sw_timing(struct pkt_buff
*pkt
, u8
*id
) {
2679 static int8_t inf_pti_ctrl(struct pkt_buff
*pkt
, u8
*id
) {
2683 static int8_t inf_tpu_buff_status(struct pkt_buff
*pkt
, u8
*id
) {
2687 static int8_t inf_interw(struct pkt_buff
*pkt
, u8
*id
) {
2691 static int8_t inf_adv_proto(struct pkt_buff
*pkt
, u8
*id
) {
2695 static int8_t inf_exp_bandw_req(struct pkt_buff
*pkt
, u8
*id
) {
2699 static int8_t inf_qos_map_set(struct pkt_buff
*pkt
, u8
*id
) {
2703 static int8_t inf_roam_cons(struct pkt_buff
*pkt
, u8
*id
) {
2707 static int8_t inf_emer_alert_id(struct pkt_buff
*pkt
, u8
*id
) {
2711 static int8_t inf_mesh_conf(struct pkt_buff
*pkt
, u8
*id
) {
2715 static int8_t inf_mesh_id(struct pkt_buff
*pkt
, u8
*id
) {
2719 static int8_t inf_mesh_link_metr_rep(struct pkt_buff
*pkt
, u8
*id
) {
2723 static int8_t inf_cong_notif(struct pkt_buff
*pkt
, u8
*id
) {
2727 static int8_t inf_mesh_peer_mgmt(struct pkt_buff
*pkt
, u8
*id
) {
2731 static int8_t inf_mesh_ch_sw_para(struct pkt_buff
*pkt
, u8
*id
) {
2735 static int8_t inf_mesh_awake_win(struct pkt_buff
*pkt
, u8
*id
) {
2739 static int8_t inf_beacon_timing(struct pkt_buff
*pkt
, u8
*id
) {
2743 static int8_t inf_mccaop_setup_req(struct pkt_buff
*pkt
, u8
*id
) {
2747 static int8_t inf_mccaop_setup_rep(struct pkt_buff
*pkt
, u8
*id
) {
2751 static int8_t inf_mccaop_adv(struct pkt_buff
*pkt
, u8
*id
) {
2755 static int8_t inf_mccaop_teardwn(struct pkt_buff
*pkt
, u8
*id
) {
2759 static int8_t inf_gann(struct pkt_buff
*pkt
, u8
*id
) {
2763 static int8_t inf_rann(struct pkt_buff
*pkt
, u8
*id
) {
2767 static int8_t inf_ext_cap(struct pkt_buff
*pkt
, u8
*id
) {
2771 static int8_t inf_preq(struct pkt_buff
*pkt
, u8
*id
) {
2775 static int8_t inf_prep(struct pkt_buff
*pkt
, u8
*id
) {
2779 static int8_t inf_perr(struct pkt_buff
*pkt
, u8
*id
) {
2783 static int8_t inf_pxu(struct pkt_buff
*pkt
, u8
*id
) {
2787 static int8_t inf_pxuc(struct pkt_buff
*pkt
, u8
*id
) {
2791 static int8_t inf_auth_mesh_peer_exch(struct pkt_buff
*pkt
, u8
*id
) {
2795 static int8_t inf_mic(struct pkt_buff
*pkt
, u8
*id
) {
2799 static int8_t inf_dest_uri(struct pkt_buff
*pkt
, u8
*id
) {
2803 static int8_t inf_u_apsd_coex(struct pkt_buff
*pkt
, u8
*id
) {
2807 static int8_t inf_mccaop_adv_overv(struct pkt_buff
*pkt
, u8
*id
) {
2811 static int8_t inf_vend_spec(struct pkt_buff
*pkt
, u8
*id
)
2815 struct element_vend_spec
*vend_spec
;
2817 vend_spec
= (struct element_vend_spec
*)
2818 pkt_pull(pkt
, sizeof(*vend_spec
));
2819 if (vend_spec
== NULL
)
2822 tprintf("Vendor Specific (%u, Len (%u)): ", *id
, vend_spec
->len
);
2824 data
= pkt_pull(pkt
, vend_spec
->len
);
2829 for (i
= 0; i
< vend_spec
->len
; i
++)
2830 tprintf("%.2x", data
[i
]);
2835 static int8_t inf_elements(struct pkt_buff
*pkt
)
2837 u8
*id
= pkt_pull(pkt
, 1);
2842 case 0: return inf_ssid(pkt
, id
);
2843 case 1: return inf_supp_rates(pkt
, id
);
2844 case 2: return inf_fh_ps(pkt
, id
);
2845 case 3: return inf_dsss_ps(pkt
, id
);
2846 case 4: return inf_cf_ps(pkt
, id
);
2847 case 5: return inf_tim(pkt
, id
);
2848 case 6: return inf_ibss_ps(pkt
, id
);
2849 case 7: return inf_country(pkt
, id
);
2850 case 8: return inf_hop_pp(pkt
, id
);
2851 case 9: return inf_hop_pt(pkt
, id
);
2852 case 10: return inf_req(pkt
, id
);
2853 case 11: return inf_bss_load(pkt
, id
);
2854 case 12: return inf_edca_ps(pkt
, id
);
2855 case 13: return inf_tspec(pkt
, id
);
2856 case 14: return inf_tclas(pkt
, id
);
2857 case 15: return inf_sched(pkt
, id
);
2858 case 16: return inf_chall_txt(pkt
, id
);
2859 case 17 ... 31: return inf_reserved(pkt
, id
);
2860 case 32: return inf_pwr_constr(pkt
, id
);
2861 case 33: return inf_pwr_cap(pkt
, id
);
2862 case 34: return inf_tpc_req(pkt
, id
);
2863 case 35: return inf_tpc_rep(pkt
, id
);
2864 case 36: return inf_supp_ch(pkt
, id
);
2865 case 37: return inf_ch_sw_ann(pkt
, id
);
2866 case 38: return inf_meas_req(pkt
, id
);
2867 case 39: return inf_meas_rep(pkt
, id
);
2868 case 40: return inf_quiet(pkt
, id
);
2869 case 41: return inf_ibss_dfs(pkt
, id
);
2870 case 42: return inf_erp(pkt
, id
);
2871 case 43: return inf_ts_del(pkt
, id
);
2872 case 44: return inf_tclas_proc(pkt
, id
);
2873 case 45: return inf_ht_cap(pkt
, id
);
2874 case 46: return inf_qos_cap(pkt
, id
);
2875 case 47: return inf_reserved(pkt
, id
);
2876 case 48: return inf_rsn(pkt
, id
);
2877 case 49: return inf_rsn(pkt
, id
);
2878 case 50: return inf_ext_supp_rates(pkt
, id
);
2879 case 51: return inf_ap_ch_exp(pkt
, id
);
2880 case 52: return inf_neighb_rep(pkt
, id
);
2881 case 53: return inf_rcpi(pkt
, id
);
2882 case 54: return inf_mde(pkt
, id
);
2883 case 55: return inf_fte(pkt
, id
);
2884 case 56: return inf_time_out_int(pkt
, id
);
2885 case 57: return inf_rde(pkt
, id
);
2886 case 58: return inf_dse_reg_loc(pkt
, id
);
2887 case 59: return inf_supp_op_class(pkt
, id
);
2888 case 60: return inf_ext_ch_sw_ann(pkt
, id
);
2889 case 61: return inf_ht_op(pkt
, id
);
2890 case 62: return inf_sec_ch_offs(pkt
, id
);
2891 case 63: return inf_bss_avg_acc_del(pkt
, id
);
2892 case 64: return inf_ant(pkt
, id
);
2893 case 65: return inf_rsni(pkt
, id
);
2894 case 66: return inf_meas_pilot_trans(pkt
, id
);
2895 case 67: return inf_bss_avl_adm_cap(pkt
, id
);
2896 case 68: return inf_bss_ac_acc_del(pkt
, id
);
2897 case 69: return inf_time_adv(pkt
, id
);
2898 case 70: return inf_rm_ena_cap(pkt
, id
);
2899 case 71: return inf_mult_bssid(pkt
, id
);
2900 case 72: return inf_20_40_bss_coex(pkt
, id
);
2901 case 73: return inf_20_40_bss_int_ch_rep(pkt
, id
);
2902 case 74: return inf_overl_bss_scan_para(pkt
, id
);
2903 case 75: return inf_ric_desc(pkt
, id
);
2904 case 76: return inf_mgmt_mic(pkt
, id
);
2905 case 78: return inf_ev_req(pkt
, id
);
2906 case 79: return inf_ev_rep(pkt
, id
);
2907 case 80: return inf_diagn_req(pkt
, id
);
2908 case 81: return inf_diagn_rep(pkt
, id
);
2909 case 82: return inf_loc_para(pkt
, id
);
2910 case 83: return inf_nontr_bssid_cap(pkt
, id
);
2911 case 84: return inf_ssid_list(pkt
, id
);
2912 case 85: return inf_mult_bssid_index(pkt
, id
);
2913 case 86: return inf_fms_desc(pkt
, id
);
2914 case 87: return inf_fms_req(pkt
, id
);
2915 case 88: return inf_fms_resp(pkt
, id
);
2916 case 89: return inf_qos_tfc_cap(pkt
, id
);
2917 case 90: return inf_bss_max_idle_per(pkt
, id
);
2918 case 91: return inf_tfs_req(pkt
, id
);
2919 case 92: return inf_tfs_resp(pkt
, id
);
2920 case 93: return inf_wnm_sleep_mod(pkt
, id
);
2921 case 94: return inf_tim_bcst_req(pkt
, id
);
2922 case 95: return inf_tim_bcst_resp(pkt
, id
);
2923 case 96: return inf_coll_interf_rep(pkt
, id
);
2924 case 97: return inf_ch_usage(pkt
, id
);
2925 case 98: return inf_time_zone(pkt
, id
);
2926 case 99: return inf_dms_req(pkt
, id
);
2927 case 100: return inf_dms_resp(pkt
, id
);
2928 case 101: return inf_link_id(pkt
, id
);
2929 case 102: return inf_wakeup_sched(pkt
, id
);
2930 case 104: return inf_ch_sw_timing(pkt
, id
);
2931 case 105: return inf_pti_ctrl(pkt
, id
);
2932 case 106: return inf_tpu_buff_status(pkt
, id
);
2933 case 107: return inf_interw(pkt
, id
);
2934 case 108: return inf_adv_proto(pkt
, id
);
2935 case 109: return inf_exp_bandw_req(pkt
, id
);
2936 case 110: return inf_qos_map_set(pkt
, id
);
2937 case 111: return inf_roam_cons(pkt
, id
);
2938 case 112: return inf_emer_alert_id(pkt
, id
);
2939 case 113: return inf_mesh_conf(pkt
, id
);
2940 case 114: return inf_mesh_id(pkt
, id
);
2941 case 115: return inf_mesh_link_metr_rep(pkt
, id
);
2942 case 116: return inf_cong_notif(pkt
, id
);
2943 case 117: return inf_mesh_peer_mgmt(pkt
, id
);
2944 case 118: return inf_mesh_ch_sw_para(pkt
, id
);
2945 case 119: return inf_mesh_awake_win(pkt
, id
);
2946 case 120: return inf_beacon_timing(pkt
, id
);
2947 case 121: return inf_mccaop_setup_req(pkt
, id
);
2948 case 122: return inf_mccaop_setup_rep(pkt
, id
);
2949 case 123: return inf_mccaop_adv(pkt
, id
);
2950 case 124: return inf_mccaop_teardwn(pkt
, id
);
2951 case 125: return inf_gann(pkt
, id
);
2952 case 126: return inf_rann(pkt
, id
);
2953 case 127: return inf_ext_cap(pkt
, id
);
2954 case 128: return inf_reserved(pkt
, id
);
2955 case 129: return inf_reserved(pkt
, id
);
2956 case 130: return inf_preq(pkt
, id
);
2957 case 131: return inf_prep(pkt
, id
);
2958 case 132: return inf_perr(pkt
, id
);
2959 case 133: return inf_reserved(pkt
, id
);
2960 case 134: return inf_reserved(pkt
, id
);
2961 case 135: return inf_reserved(pkt
, id
);
2962 case 136: return inf_reserved(pkt
, id
);
2963 case 137: return inf_pxu(pkt
, id
);
2964 case 138: return inf_pxuc(pkt
, id
);
2965 case 139: return inf_auth_mesh_peer_exch(pkt
, id
);
2966 case 140: return inf_mic(pkt
, id
);
2967 case 141: return inf_dest_uri(pkt
, id
);
2968 case 142: return inf_u_apsd_coex(pkt
, id
);
2969 case 143 ... 173: return inf_reserved(pkt
, id
);
2970 case 174: return inf_mccaop_adv_overv(pkt
, id
);
2971 case 221: return inf_vend_spec(pkt
, id
);
2977 #define ESS 0b0000000000000001
2978 #define IBSS 0b0000000000000010
2979 #define CF_Pollable 0b0000000000000100
2980 #define CF_Poll_Req 0b0000000000001000
2981 #define Privacy 0b0000000000010000
2982 #define Short_Pre 0b0000000000100000
2983 #define PBCC 0b0000000001000000
2984 #define Ch_Agility 0b0000000010000000
2985 #define Spec_Mgmt 0b0000000100000000
2986 #define QoS 0b0000001000000000
2987 #define Short_Slot_t 0b0000010000000000
2988 #define APSD 0b0000100000000000
2989 #define Radio_Meas 0b0001000000000000
2990 #define DSSS_OFDM 0b0010000000000000
2991 #define Del_Block_ACK 0b0100000000000000
2992 #define Imm_Block_ACK 0b1000000000000000
2994 static int8_t cap_field(u16 cap_inf
)
3000 if (CF_Pollable
& cap_inf
)
3001 tprintf(" CF Pollable;");
3002 if (CF_Poll_Req
& cap_inf
)
3003 tprintf(" CF-Poll Request;");
3004 if (Privacy
& cap_inf
)
3005 tprintf(" Privacy;");
3006 if (Short_Pre
& cap_inf
)
3007 tprintf(" Short Preamble;");
3010 if (Ch_Agility
& cap_inf
)
3011 tprintf(" Channel Agility;");
3012 if (Spec_Mgmt
& cap_inf
)
3013 tprintf(" Spectrum Management;");
3016 if (Short_Slot_t
& cap_inf
)
3017 tprintf(" Short Slot Time;");
3020 if (Radio_Meas
& cap_inf
)
3021 tprintf(" Radio Measurement;");
3022 if (DSSS_OFDM
& cap_inf
)
3023 tprintf(" DSSS-OFDM;");
3024 if (Del_Block_ACK
& cap_inf
)
3025 tprintf(" Delayed Block Ack;");
3026 if (Imm_Block_ACK
& cap_inf
)
3027 tprintf(" Immediate Block Ack;");
3032 /* Management Dissectors */
3033 static int8_t assoc_req(struct pkt_buff
*pkt
) {
3037 static int8_t assoc_resp(struct pkt_buff
*pkt
) {
3041 static int8_t reassoc_req(struct pkt_buff
*pkt
) {
3045 static int8_t reassoc_resp(struct pkt_buff
*pkt
) {
3049 static int8_t probe_req(struct pkt_buff
*pkt
) {
3053 static int8_t probe_resp(struct pkt_buff
*pkt
) {
3057 static int8_t beacon(struct pkt_buff
*pkt
)
3059 struct ieee80211_mgmt_beacon
*beacon
;
3061 beacon
= (struct ieee80211_mgmt_beacon
*)
3062 pkt_pull(pkt
, sizeof(*beacon
));
3066 tprintf("Timestamp 0x%.16lx, ", le64_to_cpu(beacon
->timestamp
));
3067 tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon
->beacon_int
)*TU
);
3068 tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon
->capab_info
));
3069 cap_field(le16_to_cpu(beacon
->capab_info
));
3073 tprintf("\n\tParameters:");
3074 while (inf_elements(pkt
)) {
3084 static int8_t atim(struct pkt_buff
*pkt
) {
3088 static int8_t disassoc(struct pkt_buff
*pkt
) {
3092 static int8_t auth(struct pkt_buff
*pkt
) {
3096 static int8_t deauth(struct pkt_buff
*pkt
) {
3099 /* End Management Dissectors */
3101 /* Control Dissectors */
3102 static int8_t ps_poll(struct pkt_buff
*pkt
) {
3106 static int8_t rts(struct pkt_buff
*pkt
) {
3110 static int8_t cts(struct pkt_buff
*pkt
) {
3114 static int8_t ack(struct pkt_buff
*pkt
) {
3118 static int8_t cf_end(struct pkt_buff
*pkt
) {
3122 static int8_t cf_end_ack(struct pkt_buff
*pkt
) {
3125 /* End Control Dissectors */
3127 /* Data Dissectors */
3128 static int8_t data(struct pkt_buff
*pkt
) {
3132 static int8_t data_cf_ack(struct pkt_buff
*pkt
) {
3136 static int8_t data_cf_poll(struct pkt_buff
*pkt
) {
3140 static int8_t data_cf_ack_poll(struct pkt_buff
*pkt
) {
3144 static int8_t null(struct pkt_buff
*pkt
) {
3148 static int8_t cf_ack(struct pkt_buff
*pkt
) {
3152 static int8_t cf_poll(struct pkt_buff
*pkt
) {
3156 static int8_t cf_ack_poll(struct pkt_buff
*pkt
) {
3159 /* End Data Dissectors */
3161 static const char *mgt_sub(u8 subtype
, struct pkt_buff
*pkt
,
3162 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3165 struct ieee80211_mgmt
*mgmt
;
3166 const char *dst
, *src
, *bssid
;
3168 mgmt
= (struct ieee80211_mgmt
*) pkt_pull(pkt
, sizeof(*mgmt
));
3172 dst
= lookup_vendor((mgmt
->da
[0] << 16) |
3173 (mgmt
->da
[1] << 8) |
3175 src
= lookup_vendor((mgmt
->sa
[0] << 16) |
3176 (mgmt
->sa
[1] << 8) |
3179 bssid
= lookup_vendor((mgmt
->bssid
[0] << 16) |
3180 (mgmt
->bssid
[1] << 8) |
3182 seq_ctrl
= le16_to_cpu(mgmt
->seq_ctrl
);
3184 tprintf("Duration (%u),", le16_to_cpu(mgmt
->duration
));
3185 tprintf("\n\tDestination (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3186 mgmt
->da
[0], mgmt
->da
[1], mgmt
->da
[2],
3187 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3189 tprintf("=> (%s:%.2x:%.2x:%.2x)", dst
,
3190 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3193 tprintf("\n\tSource (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3194 mgmt
->sa
[0], mgmt
->sa
[1], mgmt
->sa
[2],
3195 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3197 tprintf("=> (%s:%.2x:%.2x:%.2x)", src
,
3198 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3201 tprintf("\n\tBSSID (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3202 mgmt
->bssid
[0], mgmt
->bssid
[1], mgmt
->bssid
[2],
3203 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3205 tprintf("=> (%s:%.2x:%.2x:%.2x)", bssid
,
3206 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3209 tprintf("\n\tFragmentnr. (%u), Seqnr. (%u). ",
3210 seq_ctrl
& 0xf, seq_ctrl
>> 4);
3214 *get_content
= assoc_req
;
3215 return "Association Request";
3217 *get_content
= assoc_resp
;
3218 return "Association Response";
3220 *get_content
= reassoc_req
;
3221 return "Reassociation Request";
3223 *get_content
= reassoc_resp
;
3224 return "Reassociation Response";
3226 *get_content
= probe_req
;
3227 return "Probe Request";
3229 *get_content
= probe_resp
;
3230 return "Probe Response";
3232 *get_content
= beacon
;
3235 *get_content
= atim
;
3238 *get_content
= disassoc
;
3239 return "Disassociation";
3241 *get_content
= auth
;
3242 return "Authentication";
3244 *get_content
= deauth
;
3245 return "Deauthentication";
3246 case 0b0110 ... 0b0111:
3247 case 0b1101 ... 0b1111:
3248 *get_content
= NULL
;
3251 *get_content
= NULL
;
3252 return "Management SubType unknown";
3256 static const char *ctrl_sub(u8 subtype
, struct pkt_buff
*pkt
,
3257 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3261 *get_content
= ps_poll
;
3273 *get_content
= cf_end
;
3276 *get_content
= cf_end_ack
;
3277 return "CF End + CF-ACK";
3278 case 0b0000 ... 0b1001:
3279 *get_content
= NULL
;
3282 return "Control SubType unkown";
3286 static const char *data_sub(u8 subtype
, struct pkt_buff
*pkt
,
3287 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3291 *get_content
= data
;
3294 *get_content
= data_cf_ack
;
3295 return "Data + CF-ACK";
3297 *get_content
= data_cf_poll
;
3298 return "Data + CF-Poll";
3300 *get_content
= data_cf_ack_poll
;
3301 return "Data + CF-ACK + CF-Poll";
3303 *get_content
= null
;
3306 *get_content
= cf_ack
;
3309 *get_content
= cf_poll
;
3312 *get_content
= cf_ack_poll
;
3313 return "CF-ACK + CF-Poll";
3314 case 0b1000 ... 0b1111:
3315 *get_content
= NULL
;
3318 *get_content
= NULL
;
3319 return "Data SubType unkown";
3324 frame_control_type(u8 type
, const char *(**get_subtype
)(u8 subtype
,
3325 struct pkt_buff
*pkt
, int8_t (**get_content
)(struct pkt_buff
*pkt
)))
3329 *get_subtype
= mgt_sub
;
3330 return "Management";
3332 *get_subtype
= ctrl_sub
;
3335 *get_subtype
= data_sub
;
3338 *get_subtype
= NULL
;
3341 *get_subtype
= NULL
;
3342 return "Control Type unkown";
3346 static void ieee80211(struct pkt_buff
*pkt
)
3348 int8_t (*get_content
)(struct pkt_buff
*pkt
) = NULL
;
3349 const char *(*get_subtype
)(u8 subtype
, struct pkt_buff
*pkt
,
3350 int8_t (**get_content
)(struct pkt_buff
*pkt
)) = NULL
;
3351 const char *subtype
= NULL
;
3352 struct ieee80211_frm_ctrl
*frm_ctrl
;
3354 frm_ctrl
= (struct ieee80211_frm_ctrl
*)
3355 pkt_pull(pkt
, sizeof(*frm_ctrl
));
3356 if (frm_ctrl
== NULL
)
3359 tprintf(" [ 802.11 Frame Control (0x%04x)]\n",
3360 le16_to_cpu(frm_ctrl
->frame_control
));
3362 tprintf(" [ Proto Version (%u), ", frm_ctrl
->proto_version
);
3363 tprintf("Type (%u, %s), ", frm_ctrl
->type
,
3364 frame_control_type(frm_ctrl
->type
, &get_subtype
));
3366 subtype
= (*get_subtype
)(frm_ctrl
->subtype
, pkt
, &get_content
);
3367 tprintf("Subtype (%u, %s)", frm_ctrl
->subtype
, subtype
);
3369 tprintf("%s%s%s", colorize_start_full(black
, red
),
3370 "No SubType Data available", colorize_end());
3373 tprintf("%s%s", frm_ctrl
->to_ds
? ", Frame goes to DS" : "",
3374 frm_ctrl
->from_ds
? ", Frame comes from DS" : "");
3375 tprintf("%s", frm_ctrl
->more_frags
? ", More Fragments" : "");
3376 tprintf("%s", frm_ctrl
->retry
? ", Frame is retransmitted" : "");
3377 tprintf("%s", frm_ctrl
->power_mgmt
? ", In Power Saving Mode" : "");
3378 tprintf("%s", frm_ctrl
->more_data
? ", More Data" : "");
3379 tprintf("%s", frm_ctrl
->wep
? ", Needs WEP" : "");
3380 tprintf("%s", frm_ctrl
->order
? ", Order" : "");
3384 tprintf(" [ Subtype %s: ", subtype
);
3385 if (!((*get_content
) (pkt
)))
3386 tprintf("%s%s%s", colorize_start_full(black
, red
),
3387 "Failed to dissect Subtype", colorize_end());
3390 tprintf("%s%s%s", colorize_start_full(black
, red
),
3391 "No SubType Data available", colorize_end());
3396 // pkt_set_proto(pkt, &ieee802_lay2, ntohs(eth->h_proto));
3399 static void ieee80211_less(struct pkt_buff
*pkt
)
3401 tprintf("802.11 frame (more on todo)");
3404 struct protocol ieee80211_ops
= {
3406 .print_full
= ieee80211
,
3407 .print_less
= ieee80211_less
,
3410 EXPORT_SYMBOL(ieee80211_ops
);