2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012, 2013 Markus Amend <markus@netsniff-ng.org>
4 * Copyright 2012 Daniel Borkmann <daniel@netsniff-ng.org>
5 * Subject to the GPL, version 2.
9 * check all possible frame combinations for their behavior
10 * with respect to endianess (little / big)
16 #include <netinet/in.h> /* for ntohs() */
17 #include <asm/byteorder.h>
18 #include <arpa/inet.h> /* for inet_ntop() */
21 #include "dissector_80211.h"
28 /* Note: Fields are encoded in little-endian! */
29 struct ieee80211_frm_ctrl
{
33 #if defined(__LITTLE_ENDIAN_BITFIELD)
34 /* Correct order here ... */
35 __extension__ u16 proto_version
:2,
46 #elif defined(__BIG_ENDIAN_BITFIELD)
47 __extension__ u16 subtype
:4,
59 # error "Adjust your <asm/byteorder.h> defines"
65 /* Management Frame start */
66 /* Note: Fields are encoded in little-endian! */
67 struct ieee80211_mgmt
{
75 struct ieee80211_mgmt_auth
{
79 /* possibly followed by Challenge text */
83 struct ieee80211_mgmt_deauth
{
87 struct ieee80211_mgmt_assoc_req
{
90 /* followed by SSID and Supported rates */
94 struct ieee80211_mgmt_assoc_resp
{
98 /* followed by Supported rates */
102 struct ieee80211_mgmt_reassoc_resp
{
106 /* followed by Supported rates */
110 struct ieee80211_mgmt_reassoc_req
{
114 /* followed by SSID and Supported rates */
118 struct ieee80211_mgmt_disassoc
{
122 struct ieee80211_mgmt_probe_req
{
125 struct ieee80211_mgmt_beacon
{
129 /* followed by some of SSID, Supported rates,
130 * FH Params, DS Params, CF Params, IBSS Params, TIM */
134 struct ieee80211_mgmt_probe_resp
{
138 /* followed by some of SSID, Supported rates,
139 * FH Params, DS Params, CF Params, IBSS Params, TIM */
142 /* Management Frame end */
144 /* Control Frame start */
145 /* Note: Fields are encoded in little-endian! */
146 struct ieee80211_ctrl
{
149 struct ieee80211_ctrl_rts
{
155 struct ieee80211_ctrl_cts
{
160 struct ieee80211_ctrl_ack
{
165 struct ieee80211_ctrl_ps_poll
{
171 struct ieee80211_ctrl_cf_end
{
177 struct ieee80211_ctrl_cf_end_ack
{
182 /* Control Frame end */
184 /* Data Frame start */
185 /* Note: Fields are encoded in little-endian! */
186 struct ieee80211_data
{
192 struct element_reserved
{
196 struct element_ssid
{
201 struct element_supp_rates
{
206 struct element_fh_ps
{
214 struct element_dsss_ps
{
219 struct element_cf_ps
{
235 struct element_ibss_ps
{
240 struct element_country_tripled
{
246 struct element_country
{
248 #if defined(__LITTLE_ENDIAN_BITFIELD)
249 /* Correct order here ... */
253 #elif defined(__BIG_ENDIAN_BITFIELD)
258 # error "Adjust your <asm/byteorder.h> defines"
260 /* triplet may repeat */
261 struct element_country_tripled tripled
[0];
266 struct element_hop_pp
{
272 struct element_hop_pt
{
286 struct element_bss_load
{
293 struct element_edca_ps
{
303 struct element_tspec
{
307 #if defined(__LITTLE_ENDIAN_BITFIELD)
308 /* Correct order here ... */
309 __extension__ u32 len
:8,
320 #elif defined(__BIG_ENDIAN_BITFIELD)
321 __extension__ u32 len
:8,
333 # error "Adjust your <asm/byteorder.h> defines"
350 u16 surplus_bandw_allow
;
354 struct element_tclas
{
360 struct element_tclas_frm_class
{
366 struct element_tclas_type0
{
372 struct element_tclas_type1
{
377 struct element_tclas_type1_ip4
{
387 struct element_tclas_type1_ip6
{
395 #if defined(__LITTLE_ENDIAN_BITFIELD)
396 __extension__ u8 flow_label3
:8;
397 __extension__ u8 flow_label2
:8;
398 __extension__ u8 flow_label1
:8;
399 #elif defined(__BIG_ENDIAN_BITFIELD)
400 __extension__ u8 flow_label1
:8;
401 __extension__ u8 flow_label2
:8;
402 __extension__ u8 flow_label3
:8;
404 # error "Adjust your <asm/byteorder.h> defines"
410 struct element_tclas_type2
{
414 struct element_tclas_type3
{
420 struct element_tclas_type4
{
425 struct element_tclas_type4_ip4
{
435 struct element_tclas_type4_ip6
{
445 #if defined(__LITTLE_ENDIAN_BITFIELD)
446 __extension__ u8 flow_label3
:8;
447 __extension__ u8 flow_label2
:8;
448 __extension__ u8 flow_label1
:8;
449 #elif defined(__BIG_ENDIAN_BITFIELD)
450 __extension__ u8 flow_label1
:8;
451 __extension__ u8 flow_label2
:8;
452 __extension__ u8 flow_label3
:8;
454 # error "Adjust your <asm/byteorder.h> defines"
460 struct element_tclas_type5
{
466 struct element_schedule
{
474 struct element_chall_txt
{
479 struct element_pwr_constr
{
484 struct element_pwr_cap
{
490 struct element_tpc_req
{
494 struct element_tpc_rep
{
500 struct element_supp_ch
{
506 struct element_supp_ch_tuple
{
511 struct element_ch_sw_ann
{
518 struct element_meas_basic
{
524 struct element_meas_cca
{
530 struct element_meas_rpi
{
536 struct element_meas_ch_load
{
544 struct element_meas_noise
{
552 struct element_meas_beacon
{
562 struct element_meas_frame
{
572 struct element_meas_sta
{
580 struct element_meas_lci
{
583 u8 longitude_req_res
;
588 struct element_meas_trans_str_cat
{
597 struct element_meas_mcast_diag
{
601 u8 mcast_triggered
[0];
605 struct element_meas_loc_civic
{
608 u8 loc_srv_intv_unit
;
613 struct element_meas_loc_id
{
615 u8 loc_srv_intv_unit
;
620 struct element_meas_pause
{
625 struct element_meas_req
{
633 struct element_meas_rep
{
641 struct element_quiet
{
649 struct element_ibss_dfs
{
656 struct element_ibss_dfs_tuple
{
666 struct element_ts_del
{
671 struct element_tclas_proc
{
676 struct element_ht_cap
{
681 #if defined(__LITTLE_ENDIAN_BITFIELD)
682 /* Correct order here ... */
683 __extension__ u16 ldpc
:1,
697 #elif defined(__BIG_ENDIAN_BITFIELD)
698 __extension__ u16 rx_stbc
:2,
713 # error "Adjust your <asm/byteorder.h> defines"
721 #if defined(__LITTLE_ENDIAN_BITFIELD)
722 /* Correct order here ... */
723 __extension__ u8 bitmask1
:8;
724 __extension__ u8 bitmask2
:8;
725 __extension__ u8 bitmask3
:8;
726 __extension__ u8 bitmask4
:8;
727 __extension__ u8 bitmask5
:8;
728 __extension__ u8 bitmask6
:8;
729 __extension__ u8 bitmask7
:8;
730 __extension__ u8 bitmask8
:8;
731 __extension__ u8 bitmask9
:8;
732 __extension__ u8 bitmask10_res
:8;
733 __extension__ u16 supp_rate_res
:16;
734 __extension__ u32 tx_param_res
:32;
736 #elif defined(__BIG_ENDIAN_BITFIELD)
737 __extension__ u32 tx_param_res
:32;
738 __extension__ u16 supp_rate_res
:16;
739 __extension__ u8 bitmask10_res
:8;
740 __extension__ u8 bitmask9
:8;
741 __extension__ u8 bitmask8
:8;
742 __extension__ u8 bitmask7
:8;
743 __extension__ u8 bitmask6
:8;
744 __extension__ u8 bitmask5
:8;
745 __extension__ u8 bitmask4
:8;
746 __extension__ u8 bitmask3
:8;
747 __extension__ u8 bitmask2
:8;
748 __extension__ u8 bitmask1
:8;
750 # error "Adjust your <asm/byteorder.h> defines"
759 struct element_qos_cap
{
764 struct element_ext_supp_rates
{
769 struct element_vend_spec
{
775 static int8_t len_neq_error(u8 len
, u8 intended
)
777 if(intended
!= len
) {
778 tprintf("Length should be %u Bytes", intended
);
785 static int8_t len_lt_error(u8 len
, u8 intended
)
788 tprintf("Length should be greater %u Bytes", intended
);
795 static float data_rates(u8 id
)
797 /* XXX Why not (id / 2.f)? */
805 case 11: return 5.5f
;
806 case 12: return 6.0f
;
807 case 18: return 9.0f
;
808 case 22: return 11.0f
;
809 case 24: return 12.0f
;
810 case 27: return 13.5f
;
811 case 36: return 18.0f
;
812 case 44: return 22.0f
;
813 case 48: return 24.0f
;
814 case 54: return 27.0f
;
815 case 66: return 33.0f
;
816 case 72: return 36.0f
;
817 case 96: return 48.0f
;
818 case 108: return 54.0f
;
831 static int8_t subelements(struct pkt_buff
*pkt
, u8 len
)
837 struct subelement
*sub
;
839 sub
= (struct subelement
*) pkt_pull(pkt
, sizeof(*sub
));
843 tprintf(", Subelement ID %u, ", sub
->id
);
844 tprintf("Length %u, ", sub
->len
);
846 data
= pkt_pull(pkt
, sub
->len
);
851 for(j
=0; j
< sub
->len
; j
++)
852 tprintf("%.2x ", data
[j
]);
857 /* Not needed ?! Should break before*/
860 * tprintf("Length error");
868 static int8_t inf_reserved(struct pkt_buff
*pkt
, u8
*id
)
872 struct element_reserved
*reserved
;
874 reserved
= (struct element_reserved
*) pkt_pull(pkt
, sizeof(*reserved
));
875 if (reserved
== NULL
)
878 tprintf("Reserved (%u, Len (%u)): ", *id
, reserved
->len
);
880 data
= pkt_pull(pkt
, reserved
->len
);
885 for (i
= 0; i
< reserved
->len
; i
++)
886 tprintf("%.2x", data
[i
]);
891 static int8_t inf_ssid(struct pkt_buff
*pkt
, u8
*id
)
894 struct element_ssid
*ssid
;
897 ssid
= (struct element_ssid
*) pkt_pull(pkt
, sizeof(*ssid
));
901 tprintf(" SSID (%u, Len (%u)): ", *id
, ssid
->len
);
903 if ((ssid
->len
- sizeof(*ssid
) + 1) > 0) {
904 ssid_name
= (char *) pkt_pull(pkt
, ssid
->len
);
905 if (ssid_name
== NULL
)
908 for (i
= 0; i
< ssid
->len
; i
++)
909 tprintf("%c",ssid_name
[i
]);
911 tprintf("Wildcard SSID");
917 static int8_t inf_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
921 struct element_supp_rates
*supp_rates
;
923 supp_rates
= (struct element_supp_rates
*)
924 pkt_pull(pkt
, sizeof(*supp_rates
));
925 if (supp_rates
== NULL
)
928 tprintf(" Supp. Rates (%u, Len (%u)): ", *id
, supp_rates
->len
);
929 if (len_lt_error(supp_rates
->len
, 1))
932 if ((supp_rates
->len
- sizeof(*supp_rates
) + 1) > 0) {
933 rates
= pkt_pull(pkt
, supp_rates
->len
);
937 for (i
= 0; i
< supp_rates
->len
; i
++)
938 tprintf("%g%s ", ((rates
[i
] & 0x80) >> 7) ?
939 data_rates(rates
[i
] & 0x3f) :
940 ((rates
[i
] & 0x3f) * 0.5),
941 ((rates
[i
] & 0x80) >> 7) ? "(B)" : "");
948 static int8_t inf_fh_ps(struct pkt_buff
*pkt
, u8
*id
)
950 struct element_fh_ps
*fh_ps
;
952 fh_ps
= (struct element_fh_ps
*) pkt_pull(pkt
, sizeof(*fh_ps
));
956 tprintf(" FH Param Set (%u, Len(%u)): ", *id
, fh_ps
->len
);
957 if (len_neq_error(fh_ps
->len
, 5))
959 tprintf("Dwell Time: %fs, ", le16_to_cpu(fh_ps
->dwell_time
) * TU
);
960 tprintf("HopSet: %u, ", fh_ps
->hop_set
);
961 tprintf("HopPattern: %u, ", fh_ps
->hop_pattern
);
962 tprintf("HopIndex: %u", fh_ps
->hop_index
);
967 static int8_t inf_dsss_ps(struct pkt_buff
*pkt
, u8
*id
)
969 struct element_dsss_ps
*dsss_ps
;
971 dsss_ps
= (struct element_dsss_ps
*) pkt_pull(pkt
, sizeof(*dsss_ps
));
975 tprintf(" DSSS Param Set (%u, Len(%u)): ", *id
, dsss_ps
->len
);
976 if (len_neq_error(dsss_ps
->len
, 1))
978 tprintf("Current Channel: %u", dsss_ps
->curr_ch
);
983 static int8_t inf_cf_ps(struct pkt_buff
*pkt
, u8
*id
)
985 struct element_cf_ps
*cf_ps
;
987 cf_ps
= (struct element_cf_ps
*) pkt_pull(pkt
, sizeof(*cf_ps
));
991 tprintf(" CF Param Set (%u, Len(%u)): ", *id
, cf_ps
->len
);
992 if (len_neq_error(cf_ps
->len
, 6))
994 tprintf("CFP Count: %u, ", cf_ps
->cfp_cnt
);
995 tprintf("CFP Period: %u, ", cf_ps
->cfp_period
);
996 tprintf("CFP MaxDur: %fs, ", le16_to_cpu(cf_ps
->cfp_max_dur
) * TU
);
997 tprintf("CFP DurRem: %fs", le16_to_cpu(cf_ps
->cfp_dur_rem
) * TU
);
1002 static int8_t inf_tim(struct pkt_buff
*pkt
, u8
*id
)
1004 struct element_tim
*tim
;
1007 tim
= (struct element_tim
*) pkt_pull(pkt
, sizeof(*tim
));
1011 tprintf(" TIM (%u, Len(%u)): ", *id
, tim
->len
);
1012 if (len_lt_error(tim
->len
, 3))
1014 tprintf("DTIM Count: %u, ", tim
->dtim_cnt
);
1015 tprintf("DTIM Period: %u, ", tim
->dtim_period
);
1016 tprintf("Bitmap Control: %u, ", tim
->bmp_cntrl
);
1017 if ((tim
->len
- sizeof(*tim
) + 1) > 0) {
1018 u8
*bmp
= pkt_pull(pkt
, (tim
->len
- sizeof(*tim
) + 1));
1022 tprintf("Partial Virtual Bitmap: 0x");
1023 for (i
= 0; i
< (tim
->len
- sizeof(*tim
) + 1); i
++)
1024 tprintf("%.2x", bmp
[i
]);
1030 static int8_t inf_ibss_ps(struct pkt_buff
*pkt
, u8
*id
)
1032 struct element_ibss_ps
*ibss_ps
;
1034 ibss_ps
= (struct element_ibss_ps
*) pkt_pull(pkt
, sizeof(*ibss_ps
));
1035 if (ibss_ps
== NULL
)
1038 tprintf(" IBSS Param Set (%u, Len(%u)): ", *id
, ibss_ps
->len
);
1039 if (len_neq_error(ibss_ps
->len
, 2))
1041 tprintf("ATIM Window: %fs", le16_to_cpu(ibss_ps
->atim_win
) * TU
);
1046 static int8_t inf_country(struct pkt_buff
*pkt
, u8
*id
)
1050 struct element_country
*country
;
1052 country
= (struct element_country
*) pkt_pull(pkt
, sizeof(*country
));
1053 if (country
== NULL
)
1056 tprintf(" Country (%u, Len(%u)): ", *id
, country
->len
);
1057 if (len_lt_error(country
->len
, 6))
1059 tprintf("Country String: %c%c%c", country
->country_first
,
1060 country
->country_sec
, country
->country_third
);
1062 for (i
= country
->len
% 3; i
< (country
->len
- 3); i
+= 3) {
1063 struct element_country_tripled
*country_tripled
;
1065 country_tripled
= (struct element_country_tripled
*)
1066 pkt_pull(pkt
, sizeof(*country_tripled
));
1067 if (country_tripled
== NULL
)
1070 if(country_tripled
->frst_ch
>= 201) {
1071 tprintf("Oper Ext ID: %u, ", country_tripled
->frst_ch
);
1072 tprintf("Operating Class: %u, ", country_tripled
->nr_ch
);
1073 tprintf("Coverage Class: %u", country_tripled
->max_trans
);
1075 tprintf("First Ch Nr: %u, ", country_tripled
->frst_ch
);
1076 tprintf("Nr of Ch: %u, ", country_tripled
->nr_ch
);
1077 tprintf("Max Transmit Pwr Lvl: %u", country_tripled
->max_trans
);
1081 if(country
->len
% 3) {
1082 pad
= pkt_pull(pkt
, 1);
1086 tprintf(", Pad: 0x%x", *pad
);
1092 static int8_t inf_hop_pp(struct pkt_buff
*pkt
, u8
*id
)
1094 struct element_hop_pp
*hop_pp
;
1096 hop_pp
= (struct element_hop_pp
*) pkt_pull(pkt
, sizeof(*hop_pp
));
1100 tprintf(" Hopping Pattern Param (%u, Len(%u)): ", *id
, hop_pp
->len
);
1101 if (len_neq_error(hop_pp
->len
, 2))
1103 tprintf("Prime Radix: %u, ", hop_pp
->prime_radix
);
1104 tprintf("Nr of Ch: %u", hop_pp
->nr_ch
);
1109 static int8_t inf_hop_pt(struct pkt_buff
*pkt
, u8
*id
)
1113 struct element_hop_pt
*hop_pt
;
1115 hop_pt
= (struct element_hop_pt
*) pkt_pull(pkt
, sizeof(*hop_pt
));
1119 tprintf(" Hopping Pattern Table (%u, Len(%u)): ", *id
, hop_pt
->len
);
1120 if (len_lt_error(hop_pt
->len
, 4))
1122 tprintf("Flag: %u, ", hop_pt
->flag
);
1123 tprintf("Nr of Sets: %u, ", hop_pt
->nr_sets
);
1124 tprintf("Modulus: %u, ", hop_pt
->modules
);
1125 tprintf("Offs: %u", hop_pt
->offs
);
1127 if ((hop_pt
->len
- sizeof(*hop_pt
) + 1) > 0) {
1128 rand_tabl
= pkt_pull(pkt
, (hop_pt
->len
- sizeof(*hop_pt
) + 1));
1129 if (rand_tabl
== NULL
)
1132 tprintf(", Rand table: 0x");
1133 for (i
= 0; i
< (hop_pt
->len
- sizeof(*hop_pt
) + 1); i
++)
1134 tprintf("%.2x", rand_tabl
[i
]);
1140 static int8_t inf_req(struct pkt_buff
*pkt
, u8
*id
)
1143 struct element_req
*req
;
1146 req
= (struct element_req
*) pkt_pull(pkt
, sizeof(*req
));
1150 tprintf(" Request Element (%u, Len(%u)): ", *id
, req
->len
);
1151 if ((req
->len
- sizeof(*req
) + 1) > 0) {
1152 req_ids
= pkt_pull(pkt
, (req
->len
- sizeof(*req
) + 1));
1153 if (req_ids
== NULL
)
1156 tprintf(", Requested Element IDs: ");
1157 for (i
= 0; i
< (req
->len
- sizeof(*req
) + 1); i
++)
1158 tprintf("%u ", req_ids
[i
]);
1164 static int8_t inf_bss_load(struct pkt_buff
*pkt
, u8
*id
)
1166 struct element_bss_load
*bss_load
;
1168 bss_load
= (struct element_bss_load
*) pkt_pull(pkt
, sizeof(*bss_load
));
1169 if (bss_load
== NULL
)
1172 tprintf(" BSS Load element (%u, Len(%u)): ", *id
, bss_load
->len
);
1173 if (len_neq_error(bss_load
->len
, 5))
1175 tprintf("Station Count: %u, ", le16_to_cpu(bss_load
->station_cnt
));
1176 tprintf("Channel Utilization: %u, ", bss_load
->ch_util
);
1177 tprintf("Available Admission Capacity: %uus",
1178 bss_load
->avlb_adm_cap
* 32);
1183 static int8_t inf_edca_ps(struct pkt_buff
*pkt
, u8
*id
)
1185 u32 ac_be
, ac_bk
, ac_vi
, ac_vo
;
1186 struct element_edca_ps
*edca_ps
;
1188 edca_ps
= (struct element_edca_ps
*) pkt_pull(pkt
, sizeof(*edca_ps
));
1189 if (edca_ps
== NULL
)
1192 ac_be
= le32_to_cpu(edca_ps
->ac_be
);
1193 ac_bk
= le32_to_cpu(edca_ps
->ac_bk
);
1194 ac_vi
= le32_to_cpu(edca_ps
->ac_vi
);
1195 ac_vo
= le32_to_cpu(edca_ps
->ac_vo
);
1197 tprintf(" EDCA Param Set (%u, Len(%u)): ", *id
, edca_ps
->len
);
1198 if (len_neq_error(edca_ps
->len
, 18))
1200 tprintf("QoS Info: 0x%x (-> EDCA Param Set Update Count (%u),"
1201 "Q-Ack (%u), Queue Re (%u), TXOP Req(%u), Res(%u)), ",
1202 edca_ps
->qos_inf
, edca_ps
->qos_inf
>> 4,
1203 (edca_ps
->qos_inf
>> 3) & 1, (edca_ps
->qos_inf
>> 2) & 1,
1204 (edca_ps
->qos_inf
>> 1) & 1, edca_ps
->qos_inf
& 1);
1205 tprintf("Reserved: 0x%x, ", edca_ps
->res
);
1206 tprintf("AC_BE Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1207 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_be
,
1208 ac_be
>> 28, (ac_be
>> 27) & 1, (ac_be
>> 25) & 3,
1209 (ac_be
>> 24) & 1, (ac_be
>> 20) & 15, (ac_be
>> 16) & 15,
1210 bswap_16(ac_be
& 0xFFFF) * 32);
1211 tprintf("AC_BK Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1212 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_bk
,
1213 ac_bk
>> 28, (ac_bk
>> 27) & 1, (ac_bk
>> 25) & 3,
1214 (ac_bk
>> 24) & 1, (ac_bk
>> 20) & 15, (ac_bk
>> 16) & 15,
1215 bswap_16(ac_bk
& 0xFFFF) * 32);
1216 tprintf("AC_VI Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1217 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_vi
,
1218 ac_vi
>> 28, (ac_vi
>> 27) & 1, (ac_vi
>> 25) & 3,
1219 (ac_vi
>> 24) & 1, (ac_vi
>> 20) & 15, (ac_vi
>> 16) & 15,
1220 bswap_16(ac_vi
& 0xFFFF) * 32);
1221 tprintf("AC_VO Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1222 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)", ac_vo
,
1223 ac_vo
>> 28, (ac_vo
>> 27) & 1, (ac_vo
>> 25) & 3,
1224 (ac_vo
>> 24) & 1, (ac_vo
>> 20) & 15, (ac_vo
>> 16) & 15,
1225 bswap_16(ac_vo
& 0xFFFF) * 32);
1230 static int8_t inf_tspec(struct pkt_buff
*pkt
, u8
*id
)
1232 u16 nom_msdu_size
, surplus_bandw_allow
;
1233 struct element_tspec
*tspec
;
1235 tspec
= (struct element_tspec
*) pkt_pull(pkt
, sizeof(*tspec
));
1239 nom_msdu_size
= le16_to_cpu(tspec
->nom_msdu_size
);
1240 surplus_bandw_allow
= le16_to_cpu(tspec
->surplus_bandw_allow
);
1242 tprintf(" TSPEC (%u, Len(%u)): ", *id
, tspec
->len
);
1243 if (len_neq_error(tspec
->len
, 55))
1245 tprintf("Traffic Type: %u, ", tspec
->traffic_type
);
1246 tprintf("TSID: %u, ", tspec
->tsid
);
1247 tprintf("Direction: %u, ", tspec
->direction
);
1248 tprintf("Access Policy: %u, ", tspec
->access_policy
);
1249 tprintf("Aggregation: %u, ", tspec
->aggr
);
1250 tprintf("APSD: %u, ", tspec
->apsd
);
1251 tprintf("User Priority: %u, ", tspec
->user_prior
);
1252 tprintf("TSinfo Ack Policy: %u, ", tspec
->tsinfo_ack_pol
);
1253 tprintf("Schedule: %u, ", tspec
->schedule
);
1254 tprintf("Reserved: 0x%x, ", tspec
->res
);
1255 tprintf("Nominal MSDU Size: %uB (Fixed (%u)), ",
1256 nom_msdu_size
>> 1, nom_msdu_size
& 1);
1257 tprintf("Maximum MSDU Size: %uB, ", le16_to_cpu(tspec
->max_msdu_size
));
1258 tprintf("Minimum Service Interval: %uus, ",
1259 le32_to_cpu(tspec
->min_srv_intv
));
1260 tprintf("Maximum Service Interval: %uus, ",
1261 le32_to_cpu(tspec
->max_srv_intv
));
1262 tprintf("Inactivity Interval: %uus, ",
1263 le32_to_cpu(tspec
->inactive_intv
));
1264 tprintf("Suspension Interval: %uus, ", le32_to_cpu(tspec
->susp_intv
));
1265 tprintf("Service Start Time: %uus, ",
1266 le32_to_cpu(tspec
->srv_start_time
));
1267 tprintf("Minimum Data Rate: %ub/s, ",le32_to_cpu(tspec
->min_data_rate
));
1268 tprintf("Mean Data Rate: %ub/s, ", le32_to_cpu(tspec
->mean_data_rate
));
1269 tprintf("Peak Data Rate: %ub/s, ",le32_to_cpu(tspec
->peak_data_rate
));
1270 tprintf("Burst Size: %uB, ", le32_to_cpu(tspec
->burst_size
));
1271 tprintf("Delay Bound: %uus, ", le32_to_cpu(tspec
->delay_bound
));
1272 tprintf("Minimum PHY Rate: %ub/s, ", le32_to_cpu(tspec
->min_phy_rate
));
1273 tprintf("Surplus Bandwidth: %u.%u, ", surplus_bandw_allow
>> 13,
1274 surplus_bandw_allow
& 0x1FFF);
1275 tprintf("Medium Time: %uus", le16_to_cpu(tspec
->med_time
) * 32);
1280 static const char *class_type(u8 type
)
1283 case 0: return "Ethernet parameters";
1284 case 1: return "TCP/UDP IP parameters";
1285 case 2: return "IEEE 802.1Q parameters";
1286 case 3: return "Filter Offset parameters";
1287 case 4: return "IP and higher layer parameters";
1288 case 5: return "IEEE 802.1D/Q parameters";
1289 default: return "Reserved";
1293 static int8_t inf_tclas(struct pkt_buff
*pkt
, u8
*id
)
1295 struct element_tclas
*tclas
;
1296 struct element_tclas_frm_class
*frm_class
;
1298 tclas
= (struct element_tclas
*) pkt_pull(pkt
, sizeof(*tclas
));
1302 frm_class
= (struct element_tclas_frm_class
*)
1303 pkt_pull(pkt
, sizeof(*frm_class
));
1304 if (frm_class
== NULL
)
1307 tprintf(" TCLAS (%u, Len(%u)): ", *id
, tclas
->len
);
1308 if (len_lt_error(tclas
->len
, 3))
1310 tprintf("User Priority: %u, ", tclas
->user_priority
);
1311 tprintf("Classifier Type: %s (%u), ", class_type(frm_class
->type
),
1313 tprintf("Classifier Mask: 0x%x, ", frm_class
->mask
);
1315 if(frm_class
->type
== 0) {
1316 struct element_tclas_type0
*type0
;
1318 type0
= (struct element_tclas_type0
*)
1319 pkt_pull(pkt
, sizeof(*type0
));
1323 /* I think little endian, like the rest */
1324 tprintf("Src Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1325 type0
->sa
[5], type0
->sa
[4], type0
->sa
[3],
1326 type0
->sa
[2], type0
->sa
[1], type0
->sa
[0]);
1327 tprintf("Dst Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1328 type0
->da
[5], type0
->da
[4], type0
->da
[3],
1329 type0
->da
[2], type0
->da
[1], type0
->da
[0]);
1330 tprintf("Type: 0x%x", le16_to_cpu(type0
->type
));
1332 else if(frm_class
->type
== 1) {
1333 struct element_tclas_type1
*type1
;
1335 type1
= (struct element_tclas_type1
*)
1336 pkt_pull(pkt
, sizeof(*type1
));
1340 tprintf("Version: %u, ", type1
->version
);
1341 /* big endian format follows */
1342 if(type1
->version
== 4) {
1343 struct element_tclas_type1_ip4
*type1_ip4
;
1344 char src_ip
[INET_ADDRSTRLEN
];
1345 char dst_ip
[INET_ADDRSTRLEN
];
1347 type1_ip4
= (struct element_tclas_type1_ip4
*)
1348 pkt_pull(pkt
, sizeof(*type1_ip4
));
1349 if (type1_ip4
== NULL
)
1352 inet_ntop(AF_INET
, &type1_ip4
->sa
, src_ip
, sizeof(src_ip
));
1353 inet_ntop(AF_INET
, &type1_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1355 tprintf("Src IP: %s, ", src_ip
);
1356 tprintf("Dst IP: %s, ", dst_ip
);
1357 tprintf("Src Port: %u, ", ntohs(type1_ip4
->sp
));
1358 tprintf("Dst Port: %u, ", ntohs(type1_ip4
->dp
));
1359 tprintf("DSCP: 0x%x, ", type1_ip4
->dscp
);
1360 tprintf("Proto: %u, ", type1_ip4
->proto
);
1361 tprintf("Res: 0x%x", type1_ip4
->reserved
);
1363 else if(type1
->version
== 6) {
1364 struct element_tclas_type1_ip6
*type1_ip6
;
1365 char src_ip
[INET6_ADDRSTRLEN
];
1366 char dst_ip
[INET6_ADDRSTRLEN
];
1368 type1_ip6
= (struct element_tclas_type1_ip6
*)
1369 pkt_pull(pkt
, sizeof(*type1_ip6
));
1370 if (type1_ip6
== NULL
)
1373 inet_ntop(AF_INET6
, &type1_ip6
->sa
,
1374 src_ip
, sizeof(src_ip
));
1375 inet_ntop(AF_INET6
, &type1_ip6
->da
,
1376 dst_ip
, sizeof(dst_ip
));
1378 tprintf("Src IP: %s, ", src_ip
);
1379 tprintf("Dst IP: %s, ", dst_ip
);
1380 tprintf("Src Port: %u, ", ntohs(type1_ip6
->sp
));
1381 tprintf("Dst Port: %u, ", ntohs(type1_ip6
->dp
));
1382 tprintf("Flow Label: 0x%x%x%x", type1_ip6
->flow_label1
,
1383 type1_ip6
->flow_label2
, type1_ip6
->flow_label3
);
1386 tprintf("Version (%u) not supported", type1
->version
);
1391 else if(frm_class
->type
== 2) {
1392 struct element_tclas_type2
*type2
;
1394 type2
= (struct element_tclas_type2
*)
1395 pkt_pull(pkt
, sizeof(*type2
));
1399 tprintf("802.1Q VLAN TCI: 0x%x", ntohs(type2
->vlan_tci
));
1401 else if(frm_class
->type
== 3) {
1402 struct element_tclas_type3
*type3
;
1406 type3
= (struct element_tclas_type3
*)
1407 pkt_pull(pkt
, sizeof(*type3
));
1411 len
= (tclas
->len
- 5) / 2;
1413 tprintf("Filter Offset: %u, ", type3
->offs
);
1415 if((len
& 1) || (len_lt_error(tclas
->len
, 5))) {
1416 tprintf("Length of TCLAS (%u) not correct", tclas
->len
);
1420 val
= pkt_pull(pkt
, len
);
1424 tprintf("Filter Value: 0x");
1425 for (i
= 0; i
< len
/ 2; i
++)
1426 tprintf("%x ", val
[i
]);
1428 tprintf("Filter Mask: 0x");
1429 for (i
= len
/ 2; i
< len
; i
++)
1430 tprintf("%x ", val
[i
]);
1434 else if(frm_class
->type
== 4) {
1435 struct element_tclas_type4
*type4
;
1437 type4
= (struct element_tclas_type4
*)
1438 pkt_pull(pkt
, sizeof(*type4
));
1442 tprintf("Version: %u, ", type4
->version
);
1443 /* big endian format follows */
1444 if(type4
->version
== 4) {
1445 struct element_tclas_type4_ip4
*type4_ip4
;
1446 char src_ip
[INET_ADDRSTRLEN
];
1447 char dst_ip
[INET_ADDRSTRLEN
];
1449 type4_ip4
= (struct element_tclas_type4_ip4
*)
1450 pkt_pull(pkt
, sizeof(*type4_ip4
));
1451 if (type4_ip4
== NULL
)
1454 inet_ntop(AF_INET
, &type4_ip4
->sa
, src_ip
, sizeof(src_ip
));
1455 inet_ntop(AF_INET
, &type4_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1457 tprintf("Src IP: %s, ", src_ip
);
1458 tprintf("Dst IP: %s, ", dst_ip
);
1459 tprintf("Src Port: %u, ", ntohs(type4_ip4
->sp
));
1460 tprintf("Dst Port: %u, ", ntohs(type4_ip4
->dp
));
1461 tprintf("DSCP: 0x%x, ", type4_ip4
->dscp
);
1462 tprintf("Proto: %u, ", type4_ip4
->proto
);
1463 tprintf("Res: 0x%x", type4_ip4
->reserved
);
1465 else if(type4
->version
== 6) {
1466 struct element_tclas_type4_ip6
*type4_ip6
;
1467 char src_ip
[INET6_ADDRSTRLEN
];
1468 char dst_ip
[INET6_ADDRSTRLEN
];
1470 type4_ip6
= (struct element_tclas_type4_ip6
*)
1471 pkt_pull(pkt
, sizeof(*type4_ip6
));
1472 if (type4_ip6
== NULL
)
1475 inet_ntop(AF_INET6
, &type4_ip6
->sa
,
1476 src_ip
, sizeof(src_ip
));
1477 inet_ntop(AF_INET6
, &type4_ip6
->da
,
1478 dst_ip
, sizeof(dst_ip
));
1480 tprintf("Src IP: %s, ", src_ip
);
1481 tprintf("Dst IP: %s, ", dst_ip
);
1482 tprintf("Src Port: %u, ", ntohs(type4_ip6
->sp
));
1483 tprintf("Dst Port: %u, ", ntohs(type4_ip6
->dp
));
1484 tprintf("DSCP: 0x%x, ", type4_ip6
->dscp
);
1485 tprintf("Nxt Hdr: %u, ", type4_ip6
->nxt_hdr
);
1486 tprintf("Flow Label: 0x%x%x%x", type4_ip6
->flow_label1
,
1487 type4_ip6
->flow_label2
, type4_ip6
->flow_label3
);
1490 tprintf("Version (%u) not supported", type4
->version
);
1494 else if(frm_class
->type
== 5) {
1495 struct element_tclas_type5
*type5
;
1497 type5
= (struct element_tclas_type5
*)
1498 pkt_pull(pkt
, sizeof(*type5
));
1502 tprintf("802.1Q PCP: 0x%x, ", type5
->pcp
);
1503 tprintf("802.1Q CFI: 0x%x, ", type5
->cfi
);
1504 tprintf("802.1Q VID: 0x%x", type5
->vid
);
1507 tprintf("Classifier Type (%u) not supported", frm_class
->type
);
1514 static int8_t inf_sched(struct pkt_buff
*pkt
, u8
*id
)
1516 struct element_schedule
*schedule
;
1519 schedule
= (struct element_schedule
*) pkt_pull(pkt
, sizeof(*schedule
));
1520 if (schedule
== NULL
)
1523 info
= le16_to_cpu(schedule
->inf
);
1525 tprintf(" Schedule (%u, Len(%u)): ", *id
, schedule
->len
);
1526 if (len_neq_error(schedule
->len
, 12))
1529 tprintf("Aggregation: %u, ", info
>> 15);
1530 tprintf("TSID: %u, ", (info
>> 11) & 0xF);
1531 tprintf("Direction: %u, ", (info
>> 9) & 0x3);
1532 tprintf("Res: %u, ", info
& 0x1FF);
1533 tprintf("Serv Start Time: %uus, ", le32_to_cpu(schedule
->start
));
1534 tprintf("Serv Interval: %uus, ", le32_to_cpu(schedule
->serv_intv
));
1535 tprintf("Spec Interval: %fs", le32_to_cpu(schedule
->spec_intv
) * TU
);
1540 static int8_t inf_chall_txt(struct pkt_buff
*pkt
, u8
*id
)
1542 struct element_chall_txt
*chall_txt
;
1546 chall_txt
= (struct element_chall_txt
*)
1547 pkt_pull(pkt
, sizeof(*chall_txt
));
1548 if (chall_txt
== NULL
)
1551 tprintf(" Challenge Text (%u, Len(%u)): ", *id
, chall_txt
->len
);
1552 if ((chall_txt
->len
- sizeof(*chall_txt
) + 1) > 0) {
1553 txt
= pkt_pull(pkt
, (chall_txt
->len
- sizeof(*chall_txt
) + 1));
1558 for (i
= 0; i
< (chall_txt
->len
- sizeof(*chall_txt
) + 1); i
++)
1559 tprintf("%x", txt
[i
]);
1565 static int8_t inf_pwr_constr(struct pkt_buff
*pkt
, u8
*id
)
1567 struct element_pwr_constr
*pwr_constr
;
1569 pwr_constr
= (struct element_pwr_constr
*) pkt_pull(pkt
, sizeof(*pwr_constr
));
1570 if (pwr_constr
== NULL
)
1573 tprintf(" Power Constraint (%u, Len(%u)): ", *id
, pwr_constr
->len
);
1574 if (len_neq_error(pwr_constr
->len
, 1))
1577 tprintf("Local Power Constraint: %udB", pwr_constr
->local_pwr_constr
);
1582 static int8_t inf_pwr_cap(struct pkt_buff
*pkt
, u8
*id
)
1584 struct element_pwr_cap
*pwr_cap
;
1586 pwr_cap
= (struct element_pwr_cap
*) pkt_pull(pkt
, sizeof(*pwr_cap
));
1587 if (pwr_cap
== NULL
)
1590 tprintf(" Power Capability (%u, Len(%u)): ", *id
, pwr_cap
->len
);
1591 if (len_neq_error(pwr_cap
->len
, 2))
1594 tprintf("Min. Transm. Pwr Cap.: %ddBm, ", (int8_t)pwr_cap
->min_pwr_cap
);
1595 tprintf("Max. Transm. Pwr Cap.: %ddBm", (int8_t)pwr_cap
->max_pwr_cap
);
1600 static int8_t inf_tpc_req(struct pkt_buff
*pkt
, u8
*id
)
1602 struct element_tpc_req
*tpc_req
;
1604 tpc_req
= (struct element_tpc_req
*) pkt_pull(pkt
, sizeof(*tpc_req
));
1605 if (tpc_req
== NULL
)
1608 tprintf(" TPC Request (%u, Len(%u))", *id
, tpc_req
->len
);
1609 if (len_neq_error(tpc_req
->len
, 0))
1615 static int8_t inf_tpc_rep(struct pkt_buff
*pkt
, u8
*id
)
1617 struct element_tpc_rep
*tpc_rep
;
1619 tpc_rep
= (struct element_tpc_rep
*) pkt_pull(pkt
, sizeof(*tpc_rep
));
1620 if (tpc_rep
== NULL
)
1623 tprintf(" TPC Report (%u, Len(%u)): ", *id
, tpc_rep
->len
);
1624 if (len_neq_error(tpc_rep
->len
, 2))
1627 tprintf("Transmit Power: %udBm, ", (int8_t)tpc_rep
->trans_pwr
);
1628 tprintf("Link Margin: %udB", (int8_t)tpc_rep
->trans_pwr
);
1633 static int8_t inf_supp_ch(struct pkt_buff
*pkt
, u8
*id
)
1635 struct element_supp_ch
*supp_ch
;
1638 supp_ch
= (struct element_supp_ch
*) pkt_pull(pkt
, sizeof(*supp_ch
));
1639 if (supp_ch
== NULL
)
1642 tprintf(" Supp Channels (%u, Len(%u)): ", *id
, supp_ch
->len
);
1643 if (len_lt_error(supp_ch
->len
, 2))
1646 if(supp_ch
->len
& 1) {
1647 tprintf("Length should be even");
1651 for (i
= 0; i
< supp_ch
->len
; i
+= 2) {
1652 struct element_supp_ch_tuple
*supp_ch_tuple
;
1654 supp_ch_tuple
= (struct element_supp_ch_tuple
*)
1655 pkt_pull(pkt
, sizeof(*supp_ch_tuple
));
1656 if (supp_ch_tuple
== NULL
)
1659 tprintf("First Channel Nr: %u, ", supp_ch_tuple
->first_ch_nr
);
1660 tprintf("Nr of Channels: %u, ", supp_ch_tuple
->nr_ch
);
1666 static int8_t inf_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
)
1668 struct element_ch_sw_ann
*ch_sw_ann
;
1670 ch_sw_ann
= (struct element_ch_sw_ann
*)
1671 pkt_pull(pkt
, sizeof(*ch_sw_ann
));
1672 if (ch_sw_ann
== NULL
)
1675 tprintf(" Channel Switch Announc (%u, Len(%u)): ", *id
, ch_sw_ann
->len
);
1676 if (len_neq_error(ch_sw_ann
->len
, 3))
1679 tprintf("Switch Mode: %u, ", ch_sw_ann
->switch_mode
);
1680 tprintf("New Nr: %u, ", ch_sw_ann
->new_nr
);
1681 tprintf("Switch Count: %u", ch_sw_ann
->switch_cnt
);
1686 static const char *meas_type(u8 type
)
1689 case 0: return "Basic";
1690 case 1: return "Clear Channel assesment (CCA)";
1691 case 2: return "Receive power indication (RPI) histogram";
1692 case 3: return "Channel load";
1693 case 4: return "Noise histogram";
1694 case 5: return "Beacon";
1695 case 6: return "Frame";
1696 case 7: return "STA statistics";
1697 case 8: return "LCI";
1698 case 9: return "Transmit stream/category measurement";
1699 case 10: return "Multicast diagnostics";
1700 case 11: return "Location Civic";
1701 case 12: return "Location Identifier";
1702 case 13 ... 255: return "Reserved";
1706 static int8_t inf_meas_req(struct pkt_buff
*pkt
, u8
*id
)
1708 struct element_meas_req
*meas_req
;
1710 meas_req
= (struct element_meas_req
*) pkt_pull(pkt
, sizeof(*meas_req
));
1711 if (meas_req
== NULL
)
1714 tprintf(" Measurement Req (%u, Len(%u)): ", *id
, meas_req
->len
);
1715 if (len_lt_error(meas_req
->len
, 3))
1718 tprintf("Token: %u, ", meas_req
->token
);
1719 tprintf("Req Mode: 0x%x (Parallel (%u), Enable(%u), Request(%u), "
1720 "Report(%u), Dur Mand(%u), Res(0x%x)), ", meas_req
->req_mode
,
1721 meas_req
->req_mode
& 0x1,
1722 (meas_req
->req_mode
>> 1) & 0x1,
1723 (meas_req
->req_mode
>> 2) & 0x1,
1724 (meas_req
->req_mode
>> 3) & 0x1,
1725 (meas_req
->req_mode
>> 4) & 0x1,
1726 meas_req
->req_mode
>> 7);
1727 tprintf("Type: %s (%u), ", meas_type(meas_req
->type
), meas_req
->type
);
1729 if(meas_req
->len
> 3) {
1730 if(meas_req
->type
== 0) {
1731 struct element_meas_basic
*basic
;
1733 basic
= (struct element_meas_basic
*)
1734 pkt_pull(pkt
, sizeof(*basic
));
1738 if ((meas_req
->len
- 3 - sizeof(*basic
)) != 0) {
1739 tprintf("Length of Req matchs not Type %u",
1744 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
1745 tprintf("Meas Start Time: %"PRIu64
", ",
1746 le64_to_cpu(basic
->start
));
1747 tprintf("Meas Duration: %fs",
1748 le16_to_cpu(basic
->dur
) * TU
);
1751 else if(meas_req
->type
== 1) {
1752 struct element_meas_cca
*cca
;
1754 cca
= (struct element_meas_cca
*)
1755 pkt_pull(pkt
, sizeof(*cca
));
1759 if ((meas_req
->len
- 3 - sizeof(*cca
)) != 0) {
1760 tprintf("Length of Req matchs not Type %u",
1765 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
1766 tprintf("Meas Start Time: %"PRIu64
", ",
1767 le64_to_cpu(cca
->start
));
1768 tprintf("Meas Duration: %fs",
1769 le16_to_cpu(cca
->dur
) * TU
);
1771 else if(meas_req
->type
== 2) {
1772 struct element_meas_rpi
*rpi
;
1774 rpi
= (struct element_meas_rpi
*)
1775 pkt_pull(pkt
, sizeof(*rpi
));
1779 if ((meas_req
->len
- 3 - sizeof(*rpi
)) != 0) {
1780 tprintf("Length of Req matchs not Type %u",
1785 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
1786 tprintf("Meas Start Time: %"PRIu64
", ",
1787 le64_to_cpu(rpi
->start
));
1788 tprintf("Meas Duration: %fs",
1789 le16_to_cpu(rpi
->dur
) * TU
);
1791 else if(meas_req
->type
== 3) {
1792 struct element_meas_ch_load
*ch_load
;
1794 ch_load
= (struct element_meas_ch_load
*)
1795 pkt_pull(pkt
, sizeof(*ch_load
));
1796 if (ch_load
== NULL
)
1799 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*ch_load
)) < 0) {
1800 tprintf("Length of Req matchs not Type %u",
1805 tprintf("OP Class: %u, ", ch_load
->op_class
);
1806 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
1807 tprintf("Rand Intv: %fs, ",
1808 le16_to_cpu(ch_load
->rand_intv
) * TU
);
1809 tprintf("Meas Duration: %fs",
1810 le16_to_cpu(ch_load
->dur
) * TU
);
1812 if(!subelements(pkt
,
1813 meas_req
->len
- 3 - sizeof(*ch_load
)))
1816 else if(meas_req
->type
== 4) {
1817 struct element_meas_noise
*noise
;
1819 noise
= (struct element_meas_noise
*)
1820 pkt_pull(pkt
, sizeof(*noise
));
1824 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*noise
)) < 0) {
1825 tprintf("Length of Req matchs not Type %u",
1830 tprintf("OP Class: %u, ", noise
->op_class
);
1831 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
1832 tprintf("Rand Intv: %fs, ",
1833 le16_to_cpu(noise
->rand_intv
) * TU
);
1834 tprintf("Meas Duration: %fs",
1835 le16_to_cpu(noise
->dur
) * TU
);
1837 if(!subelements(pkt
,
1838 meas_req
->len
- 3 - sizeof(*noise
)))
1841 else if(meas_req
->type
== 5) {
1842 struct element_meas_beacon
*beacon
;
1844 beacon
= (struct element_meas_beacon
*)
1845 pkt_pull(pkt
, sizeof(*beacon
));
1849 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*beacon
)) < 0) {
1850 tprintf("Length of Req matchs not Type %u",
1855 tprintf("OP Class: %u, ", beacon
->op_class
);
1856 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
1857 tprintf("Rand Intv: %fs, ",
1858 le16_to_cpu(beacon
->rand_intv
) * TU
);
1859 tprintf("Meas Duration: %fs",
1860 le16_to_cpu(beacon
->dur
) * TU
);
1861 tprintf("Mode: %u, ", beacon
->mode
);
1862 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1863 beacon
->bssid
[0], beacon
->bssid
[1],
1864 beacon
->bssid
[2], beacon
->bssid
[3],
1865 beacon
->bssid
[4], beacon
->bssid
[5]);
1867 if(!subelements(pkt
,
1868 meas_req
->len
- 3 - sizeof(*beacon
)))
1871 else if(meas_req
->type
== 6) {
1872 struct element_meas_frame
*frame
;
1874 frame
= (struct element_meas_frame
*)
1875 pkt_pull(pkt
, sizeof(*frame
));
1879 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*frame
)) < 0) {
1880 tprintf("Length of Req matchs not Type %u",
1885 tprintf("OP Class: %u, ", frame
->op_class
);
1886 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
1887 tprintf("Rand Intv: %fs, ",
1888 le16_to_cpu(frame
->rand_intv
) * TU
);
1889 tprintf("Meas Duration: %fs",
1890 le16_to_cpu(frame
->dur
) * TU
);
1891 tprintf("Request Type: %u, ", frame
->frame
);
1892 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1893 frame
->mac
[0], frame
->mac
[1],
1894 frame
->mac
[2], frame
->mac
[3],
1895 frame
->mac
[4], frame
->mac
[5]);
1897 if(!subelements(pkt
,
1898 meas_req
->len
- 3 - sizeof(*frame
)))
1901 else if(meas_req
->type
== 7) {
1902 struct element_meas_sta
*sta
;
1904 sta
= (struct element_meas_sta
*)
1905 pkt_pull(pkt
, sizeof(*sta
));
1909 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*sta
)) < 0) {
1910 tprintf("Length of Req matchs not Type %u",
1915 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1916 sta
->peer_mac
[0], sta
->peer_mac
[1],
1917 sta
->peer_mac
[2], sta
->peer_mac
[3],
1918 sta
->peer_mac
[4], sta
->peer_mac
[5]);
1919 tprintf("Rand Intv: %fs, ",
1920 le16_to_cpu(sta
->rand_intv
) * TU
);
1921 tprintf("Meas Duration: %fs",
1922 le16_to_cpu(sta
->dur
) * TU
);
1923 tprintf("Group ID: %u, ", sta
->group_id
);
1925 if(!subelements(pkt
,
1926 meas_req
->len
- 3 - sizeof(*sta
)))
1929 else if(meas_req
->type
== 8) {
1930 struct element_meas_lci
*lci
;
1932 lci
= (struct element_meas_lci
*)
1933 pkt_pull(pkt
, sizeof(*lci
));
1937 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*lci
)) < 0) {
1938 tprintf("Length of Req matchs not Type %u",
1943 tprintf("Location Subj: %u, ", lci
->loc_subj
);
1944 tprintf("Latitude Req Res: %udeg",
1945 lci
->latitude_req_res
);
1946 tprintf("Longitude Req Res: %udeg",
1947 lci
->longitude_req_res
);
1948 tprintf("Altitude Req Res: %udeg",
1949 lci
->altitude_req_res
);
1951 if(!subelements(pkt
,
1952 meas_req
->len
- 3 - sizeof(*lci
)))
1955 else if(meas_req
->type
== 9) {
1956 struct element_meas_trans_str_cat
*trans
;
1958 trans
= (struct element_meas_trans_str_cat
*)
1959 pkt_pull(pkt
, sizeof(*trans
));
1963 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*trans
)) < 0) {
1964 tprintf("Length of Req matchs not Type %u",
1969 tprintf("Rand Intv: %fs, ",
1970 le16_to_cpu(trans
->rand_intv
) * TU
);
1971 tprintf("Meas Duration: %fs",
1972 le16_to_cpu(trans
->dur
) * TU
);
1973 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1974 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
1975 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
1976 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
1977 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
1978 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
1980 if(!subelements(pkt
,
1981 meas_req
->len
- 3 - sizeof(*trans
)))
1984 else if(meas_req
->type
== 10) {
1985 struct element_meas_mcast_diag
*mcast
;
1987 mcast
= (struct element_meas_mcast_diag
*)
1988 pkt_pull(pkt
, sizeof(*mcast
));
1992 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*mcast
)) < 0) {
1993 tprintf("Length of Req matchs not Type %u",
1998 tprintf("Rand Intv: %fs, ",
1999 le16_to_cpu(mcast
->rand_intv
) * TU
);
2000 tprintf("Meas Duration: %fs",
2001 le16_to_cpu(mcast
->dur
) * TU
);
2002 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2003 mcast
->group_mac
[0], mcast
->group_mac
[1],
2004 mcast
->group_mac
[2], mcast
->group_mac
[3],
2005 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2007 if(!subelements(pkt
,
2008 meas_req
->len
- 3 - sizeof(*mcast
)))
2011 else if(meas_req
->type
== 11) {
2012 struct element_meas_loc_civic
*civic
;
2014 civic
= (struct element_meas_loc_civic
*)
2015 pkt_pull(pkt
, sizeof(*civic
));
2019 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*civic
)) < 0) {
2020 tprintf("Length of Req matchs not Type %u",
2025 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2026 tprintf("Type: %u, ", civic
->civic_loc
);
2027 tprintf("Srv Intv Units: %u, ",
2028 le16_to_cpu(civic
->loc_srv_intv_unit
));
2029 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2031 if(!subelements(pkt
,
2032 meas_req
->len
- 3 - sizeof(*civic
)))
2035 else if(meas_req
->type
== 12) {
2036 struct element_meas_loc_id
*id
;
2038 id
= (struct element_meas_loc_id
*)
2039 pkt_pull(pkt
, sizeof(*id
));
2043 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*id
)) < 0) {
2044 tprintf("Length of Req matchs not Type %u",
2049 tprintf("Location Subj: %u, ", id
->loc_subj
);
2050 tprintf("Srv Intv Units: %u, ",
2051 le16_to_cpu(id
->loc_srv_intv_unit
));
2052 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2054 if(!subelements(pkt
,
2055 meas_req
->len
- 3 - sizeof(*id
)))
2058 else if(meas_req
->type
== 255) {
2059 struct element_meas_pause
*pause
;
2061 pause
= (struct element_meas_pause
*)
2062 pkt_pull(pkt
, sizeof(*pause
));
2066 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*pause
)) < 0) {
2067 tprintf("Length of Req matchs not Type %u",
2072 tprintf("Pause Time: %fs, ", pause
->time
* 10 * TU
);
2074 if(!subelements(pkt
,
2075 meas_req
->len
- 3 - sizeof(*pause
)))
2079 tprintf("Length field indicates data,"
2080 " but could not interpreted");
2088 static int8_t inf_meas_rep(struct pkt_buff
*pkt
, u8
*id
)
2090 struct element_meas_rep
*meas_rep
;
2092 meas_rep
= (struct element_meas_rep
*) pkt_pull(pkt
, sizeof(*meas_rep
));
2093 if (meas_rep
== NULL
)
2096 tprintf(" Measurement Rep (%u, Len(%u)): ", *id
, meas_rep
->len
);
2097 if (len_lt_error(meas_rep
->len
, 3))
2100 tprintf("Token: %u, ", meas_rep
->token
);
2101 tprintf("Rep Mode: 0x%x (Late (%u), Incapable(%u), Refused(%u), ",
2102 meas_rep
->rep_mode
, meas_rep
->rep_mode
>> 7,
2103 (meas_rep
->rep_mode
>> 6) & 0x1,
2104 (meas_rep
->rep_mode
>> 5) & 0x1);
2105 tprintf("Type: %s (%u), ", meas_type(meas_rep
->type
), meas_rep
->type
);
2107 if(meas_rep
->len
> 3) {
2108 if(meas_rep
->type
== 0) {
2109 struct element_meas_basic
*basic
;
2111 basic
= (struct element_meas_basic
*)
2112 pkt_pull(pkt
, sizeof(*basic
));
2116 if ((meas_rep
->len
- 3 - sizeof(*basic
)) != 0) {
2117 tprintf("Length of Req matchs not Type %u",
2122 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
2123 tprintf("Meas Start Time: %"PRIu64
", ",
2124 le64_to_cpu(basic
->start
));
2125 tprintf("Meas Duration: %fs",
2126 le16_to_cpu(basic
->dur
) * TU
);
2129 else if(meas_rep
->type
== 1) {
2130 struct element_meas_cca
*cca
;
2132 cca
= (struct element_meas_cca
*)
2133 pkt_pull(pkt
, sizeof(*cca
));
2137 if ((meas_rep
->len
- 3 - sizeof(*cca
)) != 0) {
2138 tprintf("Length of Req matchs not Type %u",
2143 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
2144 tprintf("Meas Start Time: %"PRIu64
", ",
2145 le64_to_cpu(cca
->start
));
2146 tprintf("Meas Duration: %fs",
2147 le16_to_cpu(cca
->dur
) * TU
);
2149 else if(meas_rep
->type
== 2) {
2150 struct element_meas_rpi
*rpi
;
2152 rpi
= (struct element_meas_rpi
*)
2153 pkt_pull(pkt
, sizeof(*rpi
));
2157 if ((meas_rep
->len
- 3 - sizeof(*rpi
)) != 0) {
2158 tprintf("Length of Req matchs not Type %u",
2163 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
2164 tprintf("Meas Start Time: %"PRIu64
", ",
2165 le64_to_cpu(rpi
->start
));
2166 tprintf("Meas Duration: %fs",
2167 le16_to_cpu(rpi
->dur
) * TU
);
2169 else if(meas_rep
->type
== 3) {
2170 struct element_meas_ch_load
*ch_load
;
2172 ch_load
= (struct element_meas_ch_load
*)
2173 pkt_pull(pkt
, sizeof(*ch_load
));
2174 if (ch_load
== NULL
)
2177 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*ch_load
)) < 0) {
2178 tprintf("Length of Req matchs not Type %u",
2183 tprintf("OP Class: %u, ", ch_load
->op_class
);
2184 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
2185 tprintf("Rand Intv: %fs, ",
2186 le16_to_cpu(ch_load
->rand_intv
) * TU
);
2187 tprintf("Meas Duration: %fs",
2188 le16_to_cpu(ch_load
->dur
) * TU
);
2190 if(!subelements(pkt
,
2191 meas_rep
->len
- 3 - sizeof(*ch_load
)))
2194 else if(meas_rep
->type
== 4) {
2195 struct element_meas_noise
*noise
;
2197 noise
= (struct element_meas_noise
*)
2198 pkt_pull(pkt
, sizeof(*noise
));
2202 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*noise
)) < 0) {
2203 tprintf("Length of Req matchs not Type %u",
2208 tprintf("OP Class: %u, ", noise
->op_class
);
2209 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
2210 tprintf("Rand Intv: %fs, ",
2211 le16_to_cpu(noise
->rand_intv
) * TU
);
2212 tprintf("Meas Duration: %fs",
2213 le16_to_cpu(noise
->dur
) * TU
);
2215 if(!subelements(pkt
,
2216 meas_rep
->len
- 3 - sizeof(*noise
)))
2219 else if(meas_rep
->type
== 5) {
2220 struct element_meas_beacon
*beacon
;
2222 beacon
= (struct element_meas_beacon
*)
2223 pkt_pull(pkt
, sizeof(*beacon
));
2227 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*beacon
)) < 0) {
2228 tprintf("Length of Req matchs not Type %u",
2233 tprintf("OP Class: %u, ", beacon
->op_class
);
2234 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
2235 tprintf("Rand Intv: %fs, ",
2236 le16_to_cpu(beacon
->rand_intv
) * TU
);
2237 tprintf("Meas Duration: %fs",
2238 le16_to_cpu(beacon
->dur
) * TU
);
2239 tprintf("Mode: %u, ", beacon
->mode
);
2240 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2241 beacon
->bssid
[0], beacon
->bssid
[1],
2242 beacon
->bssid
[2], beacon
->bssid
[3],
2243 beacon
->bssid
[4], beacon
->bssid
[5]);
2245 if(!subelements(pkt
,
2246 meas_rep
->len
- 3 - sizeof(*beacon
)))
2249 else if(meas_rep
->type
== 6) {
2250 struct element_meas_frame
*frame
;
2252 frame
= (struct element_meas_frame
*)
2253 pkt_pull(pkt
, sizeof(*frame
));
2257 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*frame
)) < 0) {
2258 tprintf("Length of Req matchs not Type %u",
2263 tprintf("OP Class: %u, ", frame
->op_class
);
2264 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
2265 tprintf("Rand Intv: %fs, ",
2266 le16_to_cpu(frame
->rand_intv
) * TU
);
2267 tprintf("Meas Duration: %fs",
2268 le16_to_cpu(frame
->dur
) * TU
);
2269 tprintf("Request Type: %u, ", frame
->frame
);
2270 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2271 frame
->mac
[0], frame
->mac
[1],
2272 frame
->mac
[2], frame
->mac
[3],
2273 frame
->mac
[4], frame
->mac
[5]);
2275 if(!subelements(pkt
,
2276 meas_rep
->len
- 3 - sizeof(*frame
)))
2279 else if(meas_rep
->type
== 7) {
2280 struct element_meas_sta
*sta
;
2282 sta
= (struct element_meas_sta
*)
2283 pkt_pull(pkt
, sizeof(*sta
));
2287 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*sta
)) < 0) {
2288 tprintf("Length of Req matchs not Type %u",
2293 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2294 sta
->peer_mac
[0], sta
->peer_mac
[1],
2295 sta
->peer_mac
[2], sta
->peer_mac
[3],
2296 sta
->peer_mac
[4], sta
->peer_mac
[5]);
2297 tprintf("Rand Intv: %fs, ",
2298 le16_to_cpu(sta
->rand_intv
) * TU
);
2299 tprintf("Meas Duration: %fs",
2300 le16_to_cpu(sta
->dur
) * TU
);
2301 tprintf("Group ID: %u, ", sta
->group_id
);
2303 if(!subelements(pkt
,
2304 meas_rep
->len
- 3 - sizeof(*sta
)))
2307 else if(meas_rep
->type
== 8) {
2308 struct element_meas_lci
*lci
;
2310 lci
= (struct element_meas_lci
*)
2311 pkt_pull(pkt
, sizeof(*lci
));
2315 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*lci
)) < 0) {
2316 tprintf("Length of Req matchs not Type %u",
2321 tprintf("Location Subj: %u, ", lci
->loc_subj
);
2322 tprintf("Latitude Req Res: %udeg",
2323 lci
->latitude_req_res
);
2324 tprintf("Longitude Req Res: %udeg",
2325 lci
->longitude_req_res
);
2326 tprintf("Altitude Req Res: %udeg",
2327 lci
->altitude_req_res
);
2329 if(!subelements(pkt
,
2330 meas_rep
->len
- 3 - sizeof(*lci
)))
2333 else if(meas_rep
->type
== 9) {
2334 struct element_meas_trans_str_cat
*trans
;
2336 trans
= (struct element_meas_trans_str_cat
*)
2337 pkt_pull(pkt
, sizeof(*trans
));
2341 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*trans
)) < 0) {
2342 tprintf("Length of Req matchs not Type %u",
2347 tprintf("Rand Intv: %fs, ",
2348 le16_to_cpu(trans
->rand_intv
) * TU
);
2349 tprintf("Meas Duration: %fs",
2350 le16_to_cpu(trans
->dur
) * TU
);
2351 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2352 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
2353 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
2354 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
2355 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
2356 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
2358 if(!subelements(pkt
,
2359 meas_rep
->len
- 3 - sizeof(*trans
)))
2362 else if(meas_rep
->type
== 10) {
2363 struct element_meas_mcast_diag
*mcast
;
2365 mcast
= (struct element_meas_mcast_diag
*)
2366 pkt_pull(pkt
, sizeof(*mcast
));
2370 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*mcast
)) < 0) {
2371 tprintf("Length of Req matchs not Type %u",
2376 tprintf("Rand Intv: %fs, ",
2377 le16_to_cpu(mcast
->rand_intv
) * TU
);
2378 tprintf("Meas Duration: %fs",
2379 le16_to_cpu(mcast
->dur
) * TU
);
2380 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2381 mcast
->group_mac
[0], mcast
->group_mac
[1],
2382 mcast
->group_mac
[2], mcast
->group_mac
[3],
2383 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2385 if(!subelements(pkt
,
2386 meas_rep
->len
- 3 - sizeof(*mcast
)))
2389 else if(meas_rep
->type
== 11) {
2390 struct element_meas_loc_civic
*civic
;
2392 civic
= (struct element_meas_loc_civic
*)
2393 pkt_pull(pkt
, sizeof(*civic
));
2397 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*civic
)) < 0) {
2398 tprintf("Length of Req matchs not Type %u",
2403 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2404 tprintf("Type: %u, ", civic
->civic_loc
);
2405 tprintf("Srv Intv Units: %u, ",
2406 le16_to_cpu(civic
->loc_srv_intv_unit
));
2407 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2409 if(!subelements(pkt
,
2410 meas_rep
->len
- 3 - sizeof(*civic
)))
2413 else if(meas_rep
->type
== 12) {
2414 struct element_meas_loc_id
*id
;
2416 id
= (struct element_meas_loc_id
*)
2417 pkt_pull(pkt
, sizeof(*id
));
2421 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*id
)) < 0) {
2422 tprintf("Length of Req matchs not Type %u",
2427 tprintf("Location Subj: %u, ", id
->loc_subj
);
2428 tprintf("Srv Intv Units: %u, ",
2429 le16_to_cpu(id
->loc_srv_intv_unit
));
2430 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2432 if(!subelements(pkt
,
2433 meas_rep
->len
- 3 - sizeof(*id
)))
2437 tprintf("Length field indicates data,"
2438 " but could not interpreted");
2446 static int8_t inf_quiet(struct pkt_buff
*pkt
, u8
*id
)
2448 struct element_quiet
*quiet
;
2450 quiet
= (struct element_quiet
*) pkt_pull(pkt
, sizeof(*quiet
));
2454 tprintf(" Quit (%u, Len(%u)): ", *id
, quiet
->len
);
2455 if (len_neq_error(quiet
->len
, 6))
2458 tprintf("Count: %ud, ", quiet
->cnt
);
2459 tprintf("Period: %u, ", quiet
->period
);
2460 tprintf("Duration: %fs, ", le16_to_cpu(quiet
->dur
) * TU
);
2461 tprintf("Offs: %fs", le16_to_cpu(quiet
->offs
) * TU
);
2467 static int8_t inf_ibss_dfs(struct pkt_buff
*pkt
, u8
*id
)
2469 struct element_ibss_dfs
*ibss_dfs
;
2472 ibss_dfs
= (struct element_ibss_dfs
*) pkt_pull(pkt
, sizeof(*ibss_dfs
));
2473 if (ibss_dfs
== NULL
)
2476 tprintf(" IBSS DFS (%u, Len(%u)): ", *id
, ibss_dfs
->len
);
2477 if (len_lt_error(ibss_dfs
->len
, 7))
2480 tprintf("Owner: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2481 ibss_dfs
->owner
[0], ibss_dfs
->owner
[1],
2482 ibss_dfs
->owner
[2], ibss_dfs
->owner
[3],
2483 ibss_dfs
->owner
[4], ibss_dfs
->owner
[5]);
2484 tprintf("Recovery Intv: %u, ", ibss_dfs
->rec_intv
);
2486 if((ibss_dfs
->len
- sizeof(*ibss_dfs
) + 1) & 1) {
2487 tprintf("Length of Channel Map should be modulo 2");
2491 for (i
= 0; i
< ibss_dfs
->len
; i
+= 2) {
2492 struct element_ibss_dfs_tuple
*ibss_dfs_tuple
;
2494 ibss_dfs_tuple
= (struct element_ibss_dfs_tuple
*)
2495 pkt_pull(pkt
, sizeof(*ibss_dfs_tuple
));
2496 if (ibss_dfs_tuple
== NULL
)
2499 tprintf("Channel Nr: %u, ", ibss_dfs_tuple
->ch_nr
);
2500 tprintf("Map: %u, ", ibss_dfs_tuple
->map
);
2506 static int8_t inf_erp(struct pkt_buff
*pkt
, u8
*id
)
2508 struct element_erp
*erp
;
2510 erp
= (struct element_erp
*) pkt_pull(pkt
, sizeof(*erp
));
2514 tprintf(" ERP (%u, Len(%u)): ", *id
, erp
->len
);
2515 if (len_neq_error(erp
->len
, 1))
2517 tprintf("Non ERP Present (%u), ", erp
->param
& 0x1);
2518 tprintf("Use Protection (%u), ", (erp
->param
>> 1) & 0x1);
2519 tprintf("Barker Preamble Mode (%u), ", (erp
->param
>> 2) & 0x1);
2520 tprintf("Reserved (0x%.5x)", erp
->param
>> 3);
2525 static int8_t inf_ts_del(struct pkt_buff
*pkt
, u8
*id
)
2527 struct element_ts_del
*ts_del
;
2529 ts_del
= (struct element_ts_del
*) pkt_pull(pkt
, sizeof(*ts_del
));
2533 tprintf(" TS Delay (%u, Len(%u)): ", *id
, ts_del
->len
);
2534 if (len_neq_error(ts_del
->len
, 4))
2536 tprintf("Delay (%fs)", le32_to_cpu(ts_del
->delay
) * TU
);
2541 static int8_t inf_tclas_proc(struct pkt_buff
*pkt
, u8
*id
)
2543 struct element_tclas_proc
*tclas_proc
;
2545 tclas_proc
= (struct element_tclas_proc
*)
2546 pkt_pull(pkt
, sizeof(*tclas_proc
));
2547 if (tclas_proc
== NULL
)
2550 tprintf(" TCLAS Procesing (%u, Len(%u)): ", *id
, tclas_proc
->len
);
2551 if (len_neq_error(tclas_proc
->len
, 1))
2553 tprintf("Processing (%u)", tclas_proc
->proc
);
2558 static int8_t inf_ht_cap(struct pkt_buff
*pkt
, u8
*id
)
2560 struct element_ht_cap
*ht_cap
;
2561 u32 tx_param_res
, beam_cap
;
2564 ht_cap
= (struct element_ht_cap
*)
2565 pkt_pull(pkt
, sizeof(*ht_cap
));
2569 tx_param_res
= le32_to_cpu(ht_cap
->tx_param_res
);
2570 beam_cap
= le32_to_cpu(ht_cap
->beam_cap
);
2571 ext_cap
= le16_to_cpu(ht_cap
->ext_cap
);
2573 tprintf(" HT Capabilities (%u, Len(%u)): ", *id
, ht_cap
->len
);
2574 if (len_neq_error(ht_cap
->len
, 26))
2576 tprintf("Info (LDCP Cod Cap (%u), Supp Ch Width Set (%u),"
2577 " SM Pwr Save(%u), HT-Greenfield (%u), Short GI for 20/40 MHz"
2578 " (%u/%u), Tx/Rx STBC (%u/%u), HT-Delayed Block Ack (%u),"
2579 " Max A-MSDU Len (%u), DSSS/CCK Mode in 40 MHz (%u),"
2580 " Res (0x%x), Forty MHz Intol (%u), L-SIG TXOP Protection Supp"
2581 " (%u)), ", ht_cap
->ldpc
, ht_cap
->supp_width
,
2582 ht_cap
->sm_pwr
, ht_cap
->ht_green
, ht_cap
->gi_20mhz
,
2583 ht_cap
->gi_40mhz
, ht_cap
->tx_stbc
, ht_cap
->rx_stbc
,
2584 ht_cap
->ht_ack
, ht_cap
->max_msdu_length
, ht_cap
->dsss_ck_mode
,
2585 ht_cap
->res
, ht_cap
->forty_int
, ht_cap
->prot_supp
);
2586 tprintf("A-MPDU Params (Max Len Exp (%u), Min Start Spacing (%u),"
2587 " Res (0x%x)), ", ht_cap
->param
>> 6, (ht_cap
->param
>> 3) & 0x7,
2588 ht_cap
->param
& 0x07);
2589 tprintf("Supp MCS Set (Rx MCS Bitmask (0x%x%x%x%x%x%x%x%x%x%x),"
2590 " Res (0x%x), Rx High Supp Data Rate (%u), Res (0x%x),"
2591 " Tx MCS Set Def (%u), Tx Rx MCS Set Not Eq (%u),"
2592 " Tx Max Number Spat Str Supp (%u),"
2593 " Tx Uneq Mod Supp (%u), Res (0x%x)), ",
2594 ht_cap
->bitmask1
, ht_cap
->bitmask2
, ht_cap
->bitmask3
,
2595 ht_cap
->bitmask4
, ht_cap
->bitmask5
, ht_cap
->bitmask6
,
2596 ht_cap
->bitmask7
, ht_cap
->bitmask8
, ht_cap
->bitmask9
,
2597 ht_cap
->bitmask10_res
>> 3, ht_cap
->bitmask10_res
& 0x7,
2598 le16_to_cpu(ht_cap
->supp_rate_res
) >> 6,
2599 le16_to_cpu(ht_cap
->supp_rate_res
) & 0x3F,
2600 tx_param_res
>> 31, (tx_param_res
>> 30) & 1,
2601 (tx_param_res
>> 28) & 3, (tx_param_res
>> 27) & 1,
2602 tx_param_res
& 0x7FFFFFF);
2603 tprintf("Ext Cap (PCO (%u), PCO Trans Time (%u), Res (0x%x),"
2604 " MCS Feedb (%u), +HTC Supp (%u), RD Resp (%u), Res (0x%x)), ",
2605 ext_cap
>> 15, (ext_cap
>> 13) & 3, (ext_cap
>> 8) & 0x1F,
2606 (ext_cap
>> 6) & 3, (ext_cap
>> 5) & 1, (ext_cap
>> 4) & 1,
2608 tprintf("Transm Beamf (Impl Transm Beamf Rec Cap (%u),"
2609 " Rec/Transm Stagg Sound Cap (%u/%u),"
2610 " Rec/Trans NDP Cap (%u/%u), Impl Transm Beamf Cap (%u),"
2611 " Cal (%u), Expl CSI Transm Beamf Cap (%u),"
2612 " Expl Noncmpr/Compr Steering Cap (%u/%u),"
2613 " Expl Trans Beamf CSI Feedb (%u),"
2614 " Expl Noncmpr/Cmpr Feedb Cap (%u/%u),"
2615 " Min Grpg (%u), CSI Num Beamf Ant Supp (%u),"
2616 " Noncmpr/Cmpr Steering Nr Beamf Ant Supp (%u/%u),"
2617 " CSI Max Nr Rows Beamf Supp (%u),"
2618 " Ch Estim Cap (%u), Res (0x%x)), ",
2619 beam_cap
>> 31, (beam_cap
>> 30) & 1, (beam_cap
>> 29) & 1,
2620 (beam_cap
>> 28) & 1, (beam_cap
>> 27) & 1, (beam_cap
>> 26) & 1,
2621 (beam_cap
>> 24) & 3, (beam_cap
>> 23) & 1, (beam_cap
>> 22) & 1,
2622 (beam_cap
>> 21) & 1, (beam_cap
>> 19) & 3, (beam_cap
>> 17) & 3,
2623 (beam_cap
>> 15) & 3, (beam_cap
>> 13) & 3, (beam_cap
>> 11) & 3,
2624 (beam_cap
>> 9) & 3, (beam_cap
>> 7) & 3, (beam_cap
>> 5) & 3,
2625 (beam_cap
>> 3) & 3, beam_cap
& 7);
2626 tprintf("ASEL (Ant Select Cap (%u),"
2627 " Expl CSI Feedb Based Transm ASEL Cap (%u),"
2628 " Ant Indic Feedb Based Transm ASEL Cap (%u),"
2629 " Expl CSI Feedb Cap (%u), Ant Indic Feedb Cap (%u),"
2630 " Rec ASEL Cap (%u), Transm Sound PPDUs Cap (%u), Res (0x%x))",
2631 ht_cap
->asel_cap
>> 7, (ht_cap
->asel_cap
>> 6) & 1,
2632 (ht_cap
->asel_cap
>> 5) & 1, (ht_cap
->asel_cap
>> 4) & 1,
2633 (ht_cap
->asel_cap
>> 3) & 1, (ht_cap
->asel_cap
>> 2) & 1,
2634 (ht_cap
->asel_cap
>> 1) & 1, ht_cap
->asel_cap
& 1);
2639 static int8_t inf_qos_cap(struct pkt_buff
*pkt
, u8
*id
)
2641 struct element_qos_cap
*qos_cap
;
2643 qos_cap
= (struct element_qos_cap
*)
2644 pkt_pull(pkt
, sizeof(*qos_cap
));
2645 if (qos_cap
== NULL
)
2648 tprintf(" QoS Capabilities (%u, Len(%u)): ", *id
, qos_cap
->len
);
2649 if (len_neq_error(qos_cap
->len
, 1))
2652 tprintf("Info (0x%x)", qos_cap
->info
);
2657 static int8_t inf_ext_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
2661 struct element_ext_supp_rates
*ext_supp_rates
;
2663 ext_supp_rates
= (struct element_ext_supp_rates
*)
2664 pkt_pull(pkt
, sizeof(*ext_supp_rates
));
2665 if (ext_supp_rates
== NULL
)
2668 tprintf(" Ext Support Rates (%u, Len(%u)): ", *id
, ext_supp_rates
->len
);
2670 if ((ext_supp_rates
->len
- sizeof(*ext_supp_rates
) + 1) > 0) {
2671 rates
= pkt_pull(pkt
, ext_supp_rates
->len
);
2675 for (i
= 0; i
< ext_supp_rates
->len
; i
++)
2676 tprintf("%g ", (rates
[i
] & 0x80) ?
2677 ((rates
[i
] & 0x3f) * 0.5) :
2678 data_rates(rates
[i
]));
2685 static int8_t inf_vend_spec(struct pkt_buff
*pkt
, u8
*id
)
2689 struct element_vend_spec
*vend_spec
;
2691 vend_spec
= (struct element_vend_spec
*)
2692 pkt_pull(pkt
, sizeof(*vend_spec
));
2693 if (vend_spec
== NULL
)
2696 tprintf(" Vendor Specific (%u, Len (%u)): ", *id
, vend_spec
->len
);
2698 data
= pkt_pull(pkt
, vend_spec
->len
);
2703 for (i
= 0; i
< vend_spec
->len
; i
++)
2704 tprintf("%.2x", data
[i
]);
2709 static int8_t inf_unimplemented(struct pkt_buff
*pkt __maybe_unused
,
2710 u8
*id __maybe_unused
)
2715 static int8_t inf_elements(struct pkt_buff
*pkt
)
2717 u8
*id
= pkt_pull(pkt
, 1);
2722 case 0: return inf_ssid(pkt
, id
);
2723 case 1: return inf_supp_rates(pkt
, id
);
2724 case 2: return inf_fh_ps(pkt
, id
);
2725 case 3: return inf_dsss_ps(pkt
, id
);
2726 case 4: return inf_cf_ps(pkt
, id
);
2727 case 5: return inf_tim(pkt
, id
);
2728 case 6: return inf_ibss_ps(pkt
, id
);
2729 case 7: return inf_country(pkt
, id
);
2730 case 8: return inf_hop_pp(pkt
, id
);
2731 case 9: return inf_hop_pt(pkt
, id
);
2732 case 10: return inf_req(pkt
, id
);
2733 case 11: return inf_bss_load(pkt
, id
);
2734 case 12: return inf_edca_ps(pkt
, id
);
2735 case 13: return inf_tspec(pkt
, id
);
2736 case 14: return inf_tclas(pkt
, id
);
2737 case 15: return inf_sched(pkt
, id
);
2738 case 16: return inf_chall_txt(pkt
, id
);
2739 case 17 ... 31: return inf_reserved(pkt
, id
);
2740 case 32: return inf_pwr_constr(pkt
, id
);
2741 case 33: return inf_pwr_cap(pkt
, id
);
2742 case 34: return inf_tpc_req(pkt
, id
);
2743 case 35: return inf_tpc_rep(pkt
, id
);
2744 case 36: return inf_supp_ch(pkt
, id
);
2745 case 37: return inf_ch_sw_ann(pkt
, id
);
2746 case 38: return inf_meas_req(pkt
, id
);
2747 case 39: return inf_meas_rep(pkt
, id
);
2748 case 40: return inf_quiet(pkt
, id
);
2749 case 41: return inf_ibss_dfs(pkt
, id
);
2750 case 42: return inf_erp(pkt
, id
);
2751 case 43: return inf_ts_del(pkt
, id
);
2752 case 44: return inf_tclas_proc(pkt
, id
);
2753 case 45: return inf_ht_cap(pkt
, id
);
2754 case 46: return inf_qos_cap(pkt
, id
);
2755 case 47: return inf_reserved(pkt
, id
);
2756 case 48: return inf_unimplemented(pkt
, id
);
2757 case 49: return inf_unimplemented(pkt
, id
);
2758 case 50: return inf_ext_supp_rates(pkt
, id
);
2759 case 51: return inf_unimplemented(pkt
, id
);
2760 case 52: return inf_unimplemented(pkt
, id
);
2761 case 53: return inf_unimplemented(pkt
, id
);
2762 case 54: return inf_unimplemented(pkt
, id
);
2763 case 55: return inf_unimplemented(pkt
, id
);
2764 case 56: return inf_unimplemented(pkt
, id
);
2765 case 57: return inf_unimplemented(pkt
, id
);
2766 case 58: return inf_unimplemented(pkt
, id
);
2767 case 59: return inf_unimplemented(pkt
, id
);
2768 case 60: return inf_unimplemented(pkt
, id
);
2769 case 61: return inf_unimplemented(pkt
, id
);
2770 case 62: return inf_unimplemented(pkt
, id
);
2771 case 63: return inf_unimplemented(pkt
, id
);
2772 case 64: return inf_unimplemented(pkt
, id
);
2773 case 65: return inf_unimplemented(pkt
, id
);
2774 case 66: return inf_unimplemented(pkt
, id
);
2775 case 67: return inf_unimplemented(pkt
, id
);
2776 case 68: return inf_unimplemented(pkt
, id
);
2777 case 69: return inf_unimplemented(pkt
, id
);
2778 case 70: return inf_unimplemented(pkt
, id
);
2779 case 71: return inf_unimplemented(pkt
, id
);
2780 case 72: return inf_unimplemented(pkt
, id
);
2781 case 73: return inf_unimplemented(pkt
, id
);
2782 case 74: return inf_unimplemented(pkt
, id
);
2783 case 75: return inf_unimplemented(pkt
, id
);
2784 case 76: return inf_unimplemented(pkt
, id
);
2785 case 78: return inf_unimplemented(pkt
, id
);
2786 case 79: return inf_unimplemented(pkt
, id
);
2787 case 80: return inf_unimplemented(pkt
, id
);
2788 case 81: return inf_unimplemented(pkt
, id
);
2789 case 82: return inf_unimplemented(pkt
, id
);
2790 case 83: return inf_unimplemented(pkt
, id
);
2791 case 84: return inf_unimplemented(pkt
, id
);
2792 case 85: return inf_unimplemented(pkt
, id
);
2793 case 86: return inf_unimplemented(pkt
, id
);
2794 case 87: return inf_unimplemented(pkt
, id
);
2795 case 88: return inf_unimplemented(pkt
, id
);
2796 case 89: return inf_unimplemented(pkt
, id
);
2797 case 90: return inf_unimplemented(pkt
, id
);
2798 case 91: return inf_unimplemented(pkt
, id
);
2799 case 92: return inf_unimplemented(pkt
, id
);
2800 case 93: return inf_unimplemented(pkt
, id
);
2801 case 94: return inf_unimplemented(pkt
, id
);
2802 case 95: return inf_unimplemented(pkt
, id
);
2803 case 96: return inf_unimplemented(pkt
, id
);
2804 case 97: return inf_unimplemented(pkt
, id
);
2805 case 98: return inf_unimplemented(pkt
, id
);
2806 case 99: return inf_unimplemented(pkt
, id
);
2807 case 100: return inf_unimplemented(pkt
, id
);
2808 case 101: return inf_unimplemented(pkt
, id
);
2809 case 102: return inf_unimplemented(pkt
, id
);
2810 case 104: return inf_unimplemented(pkt
, id
);
2811 case 105: return inf_unimplemented(pkt
, id
);
2812 case 106: return inf_unimplemented(pkt
, id
);
2813 case 107: return inf_unimplemented(pkt
, id
);
2814 case 108: return inf_unimplemented(pkt
, id
);
2815 case 109: return inf_unimplemented(pkt
, id
);
2816 case 110: return inf_unimplemented(pkt
, id
);
2817 case 111: return inf_unimplemented(pkt
, id
);
2818 case 112: return inf_unimplemented(pkt
, id
);
2819 case 113: return inf_unimplemented(pkt
, id
);
2820 case 114: return inf_unimplemented(pkt
, id
);
2821 case 115: return inf_unimplemented(pkt
, id
);
2822 case 116: return inf_unimplemented(pkt
, id
);
2823 case 117: return inf_unimplemented(pkt
, id
);
2824 case 118: return inf_unimplemented(pkt
, id
);
2825 case 119: return inf_unimplemented(pkt
, id
);
2826 case 120: return inf_unimplemented(pkt
, id
);
2827 case 121: return inf_unimplemented(pkt
, id
);
2828 case 122: return inf_unimplemented(pkt
, id
);
2829 case 123: return inf_unimplemented(pkt
, id
);
2830 case 124: return inf_unimplemented(pkt
, id
);
2831 case 125: return inf_unimplemented(pkt
, id
);
2832 case 126: return inf_unimplemented(pkt
, id
);
2833 case 127: return inf_unimplemented(pkt
, id
);
2834 case 128: return inf_reserved(pkt
, id
);
2835 case 129: return inf_reserved(pkt
, id
);
2836 case 130: return inf_unimplemented(pkt
, id
);
2837 case 131: return inf_unimplemented(pkt
, id
);
2838 case 132: return inf_unimplemented(pkt
, id
);
2839 case 133: return inf_reserved(pkt
, id
);
2840 case 134: return inf_reserved(pkt
, id
);
2841 case 135: return inf_reserved(pkt
, id
);
2842 case 136: return inf_reserved(pkt
, id
);
2843 case 137: return inf_unimplemented(pkt
, id
);
2844 case 138: return inf_unimplemented(pkt
, id
);
2845 case 139: return inf_unimplemented(pkt
, id
);
2846 case 140: return inf_unimplemented(pkt
, id
);
2847 case 141: return inf_unimplemented(pkt
, id
);
2848 case 142: return inf_unimplemented(pkt
, id
);
2849 case 143 ... 173: return inf_reserved(pkt
, id
);
2850 case 174: return inf_unimplemented(pkt
, id
);
2851 case 221: return inf_vend_spec(pkt
, id
);
2859 #define CF_Pollable 0x0004
2860 #define CF_Poll_Req 0x0008
2861 #define Privacy 0x0010
2862 #define Short_Pre 0x0020
2864 #define Ch_Agility 0x0080
2865 #define Spec_Mgmt 0x0100
2867 #define Short_Slot_t 0x0400
2869 #define Radio_Meas 0x1000
2870 #define DSSS_OFDM 0x2000
2871 #define Del_Block_ACK 0x4000
2872 #define Imm_Block_ACK 0x8000
2874 static int8_t cap_field(u16 cap_inf
)
2880 if (CF_Pollable
& cap_inf
)
2881 tprintf(" CF Pollable;");
2882 if (CF_Poll_Req
& cap_inf
)
2883 tprintf(" CF-Poll Request;");
2884 if (Privacy
& cap_inf
)
2885 tprintf(" Privacy;");
2886 if (Short_Pre
& cap_inf
)
2887 tprintf(" Short Preamble;");
2890 if (Ch_Agility
& cap_inf
)
2891 tprintf(" Channel Agility;");
2892 if (Spec_Mgmt
& cap_inf
)
2893 tprintf(" Spectrum Management;");
2896 if (Short_Slot_t
& cap_inf
)
2897 tprintf(" Short Slot Time;");
2900 if (Radio_Meas
& cap_inf
)
2901 tprintf(" Radio Measurement;");
2902 if (DSSS_OFDM
& cap_inf
)
2903 tprintf(" DSSS-OFDM;");
2904 if (Del_Block_ACK
& cap_inf
)
2905 tprintf(" Delayed Block Ack;");
2906 if (Imm_Block_ACK
& cap_inf
)
2907 tprintf(" Immediate Block Ack;");
2912 /* Management Dissectors */
2913 static int8_t beacon(struct pkt_buff
*pkt
)
2915 struct ieee80211_mgmt_beacon
*beacon
;
2917 beacon
= (struct ieee80211_mgmt_beacon
*)
2918 pkt_pull(pkt
, sizeof(*beacon
));
2922 tprintf("Timestamp 0x%.16"PRIx64
", ", le64_to_cpu(beacon
->timestamp
));
2923 tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon
->beacon_int
)*TU
);
2924 tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon
->capab_info
));
2925 cap_field(le16_to_cpu(beacon
->capab_info
));
2929 tprintf("\n\tParameters:");
2930 while (inf_elements(pkt
)) {
2940 static int8_t mgmt_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
2944 /* End Management Dissectors */
2946 /* Control Dissectors */
2947 static int8_t ctrl_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
2951 /* End Control Dissectors */
2953 /* Data Dissectors */
2954 static int8_t data_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
2958 /* End Data Dissectors */
2960 static const char *mgt_sub(u8 subtype
, struct pkt_buff
*pkt
,
2961 int8_t (**get_content
)(struct pkt_buff
*pkt
))
2964 struct ieee80211_mgmt
*mgmt
;
2965 const char *dst
, *src
, *bssid
;
2967 mgmt
= (struct ieee80211_mgmt
*) pkt_pull(pkt
, sizeof(*mgmt
));
2971 dst
= lookup_vendor((mgmt
->da
[0] << 16) |
2972 (mgmt
->da
[1] << 8) |
2974 src
= lookup_vendor((mgmt
->sa
[0] << 16) |
2975 (mgmt
->sa
[1] << 8) |
2978 bssid
= lookup_vendor((mgmt
->bssid
[0] << 16) |
2979 (mgmt
->bssid
[1] << 8) |
2981 seq_ctrl
= le16_to_cpu(mgmt
->seq_ctrl
);
2983 tprintf("Duration (%u),", le16_to_cpu(mgmt
->duration
));
2984 tprintf("\n\tDestination (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
2985 mgmt
->da
[0], mgmt
->da
[1], mgmt
->da
[2],
2986 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
2988 tprintf("=> (%s:%.2x:%.2x:%.2x)", dst
,
2989 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
2992 tprintf("\n\tSource (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
2993 mgmt
->sa
[0], mgmt
->sa
[1], mgmt
->sa
[2],
2994 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
2996 tprintf("=> (%s:%.2x:%.2x:%.2x)", src
,
2997 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3000 tprintf("\n\tBSSID (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3001 mgmt
->bssid
[0], mgmt
->bssid
[1], mgmt
->bssid
[2],
3002 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3004 tprintf("=> (%s:%.2x:%.2x:%.2x)", bssid
,
3005 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3008 tprintf("\n\tFragmentnr. (%u), Seqnr. (%u). ",
3009 seq_ctrl
& 0xf, seq_ctrl
>> 4);
3013 *get_content
= mgmt_unimplemented
;
3014 return "Association Request";
3016 *get_content
= mgmt_unimplemented
;
3017 return "Association Response";
3019 *get_content
= mgmt_unimplemented
;
3020 return "Reassociation Request";
3022 *get_content
= mgmt_unimplemented
;
3023 return "Reassociation Response";
3025 *get_content
= mgmt_unimplemented
;
3026 return "Probe Request";
3028 *get_content
= mgmt_unimplemented
;
3029 return "Probe Response";
3031 *get_content
= beacon
;
3034 *get_content
= mgmt_unimplemented
;
3037 *get_content
= mgmt_unimplemented
;
3038 return "Disassociation";
3040 *get_content
= mgmt_unimplemented
;
3041 return "Authentication";
3043 *get_content
= mgmt_unimplemented
;
3044 return "Deauthentication";
3045 case 0b0110 ... 0b0111:
3046 case 0b1101 ... 0b1111:
3047 *get_content
= NULL
;
3050 *get_content
= NULL
;
3051 return "Management SubType unknown";
3055 static const char *ctrl_sub(u8 subtype
, struct pkt_buff
*pkt __maybe_unused
,
3056 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3060 *get_content
= ctrl_unimplemented
;
3063 *get_content
= ctrl_unimplemented
;
3066 *get_content
= ctrl_unimplemented
;
3069 *get_content
= ctrl_unimplemented
;
3072 *get_content
= ctrl_unimplemented
;
3075 *get_content
= ctrl_unimplemented
;
3076 return "CF End + CF-ACK";
3077 case 0b0000 ... 0b1001:
3078 *get_content
= NULL
;
3081 return "Control SubType unknown";
3085 static const char *data_sub(u8 subtype
, struct pkt_buff
*pkt __maybe_unused
,
3086 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3090 *get_content
= data_unimplemented
;
3093 *get_content
= data_unimplemented
;
3094 return "Data + CF-ACK";
3096 *get_content
= data_unimplemented
;
3097 return "Data + CF-Poll";
3099 *get_content
= data_unimplemented
;
3100 return "Data + CF-ACK + CF-Poll";
3102 *get_content
= data_unimplemented
;
3105 *get_content
= data_unimplemented
;
3108 *get_content
= data_unimplemented
;
3111 *get_content
= data_unimplemented
;
3112 return "CF-ACK + CF-Poll";
3113 case 0b1000 ... 0b1111:
3114 *get_content
= NULL
;
3117 *get_content
= NULL
;
3118 return "Data SubType unknown";
3123 frame_control_type(u8 type
, const char *(**get_subtype
)(u8 subtype
,
3124 struct pkt_buff
*pkt
, int8_t (**get_content
)(struct pkt_buff
*pkt
)))
3128 *get_subtype
= mgt_sub
;
3129 return "Management";
3131 *get_subtype
= ctrl_sub
;
3134 *get_subtype
= data_sub
;
3137 *get_subtype
= NULL
;
3140 *get_subtype
= NULL
;
3141 return "Control Type unknown";
3145 static void ieee80211(struct pkt_buff
*pkt
)
3147 int8_t (*get_content
)(struct pkt_buff
*pkt
) = NULL
;
3148 const char *(*get_subtype
)(u8 subtype
, struct pkt_buff
*pkt
,
3149 int8_t (**get_content
)(struct pkt_buff
*pkt
)) = NULL
;
3150 const char *subtype
= NULL
;
3151 struct ieee80211_frm_ctrl
*frm_ctrl
;
3153 frm_ctrl
= (struct ieee80211_frm_ctrl
*)
3154 pkt_pull(pkt
, sizeof(*frm_ctrl
));
3155 if (frm_ctrl
== NULL
)
3158 tprintf(" [ 802.11 Frame Control (0x%04x)]\n",
3159 le16_to_cpu(frm_ctrl
->frame_control
));
3161 tprintf(" [ Proto Version (%u), ", frm_ctrl
->proto_version
);
3162 tprintf("Type (%u, %s), ", frm_ctrl
->type
,
3163 frame_control_type(frm_ctrl
->type
, &get_subtype
));
3165 subtype
= (*get_subtype
)(frm_ctrl
->subtype
, pkt
, &get_content
);
3166 tprintf("Subtype (%u, %s)", frm_ctrl
->subtype
, subtype
);
3168 tprintf("%s%s%s", colorize_start_full(black
, red
),
3169 "No SubType Data available", colorize_end());
3172 tprintf("%s%s", frm_ctrl
->to_ds
? ", Frame goes to DS" : "",
3173 frm_ctrl
->from_ds
? ", Frame comes from DS" : "");
3174 tprintf("%s", frm_ctrl
->more_frags
? ", More Fragments" : "");
3175 tprintf("%s", frm_ctrl
->retry
? ", Frame is retransmitted" : "");
3176 tprintf("%s", frm_ctrl
->power_mgmt
? ", In Power Saving Mode" : "");
3177 tprintf("%s", frm_ctrl
->more_data
? ", More Data" : "");
3178 tprintf("%s", frm_ctrl
->wep
? ", Needs WEP" : "");
3179 tprintf("%s", frm_ctrl
->order
? ", Order" : "");
3183 tprintf(" [ Subtype %s: ", subtype
);
3184 if (!((*get_content
) (pkt
)))
3185 tprintf("%s%s%s", colorize_start_full(black
, red
),
3186 "Failed to dissect Subtype", colorize_end());
3189 tprintf("%s%s%s", colorize_start_full(black
, red
),
3190 "No SubType Data available", colorize_end());
3195 // pkt_set_proto(pkt, &ieee802_lay2, ntohs(eth->h_proto));
3198 static void ieee80211_less(struct pkt_buff
*pkt __maybe_unused
)
3200 tprintf("802.11 frame (more on todo)");
3203 struct protocol ieee80211_ops
= {
3205 .print_full
= ieee80211
,
3206 .print_less
= ieee80211_less
,