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.
9 * check all possible frame combinations for their behavior
10 * with respect to endianess (little / big)
15 #include <netinet/in.h> /* for ntohs() */
16 #include <asm/byteorder.h>
17 #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
]);
858 tprintf("Length error");
865 static int8_t inf_reserved(struct pkt_buff
*pkt
, u8
*id
)
869 struct element_reserved
*reserved
;
871 reserved
= (struct element_reserved
*) pkt_pull(pkt
, sizeof(*reserved
));
872 if (reserved
== NULL
)
875 tprintf("Reserved (%u, Len (%u)): ", *id
, reserved
->len
);
877 data
= pkt_pull(pkt
, reserved
->len
);
882 for (i
= 0; i
< reserved
->len
; i
++)
883 tprintf("%.2x", data
[i
]);
888 static int8_t inf_ssid(struct pkt_buff
*pkt
, u8
*id
)
891 struct element_ssid
*ssid
;
894 ssid
= (struct element_ssid
*) pkt_pull(pkt
, sizeof(*ssid
));
898 tprintf(" SSID (%u, Len (%u)): ", *id
, ssid
->len
);
900 if ((ssid
->len
- sizeof(*ssid
) + 1) > 0) {
901 ssid_name
= (char *) pkt_pull(pkt
, ssid
->len
);
902 if (ssid_name
== NULL
)
905 for (i
= 0; i
< ssid
->len
; i
++)
906 tprintf("%c",ssid_name
[i
]);
908 tprintf("Wildcard SSID");
914 static int8_t inf_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
918 struct element_supp_rates
*supp_rates
;
920 supp_rates
= (struct element_supp_rates
*)
921 pkt_pull(pkt
, sizeof(*supp_rates
));
922 if (supp_rates
== NULL
)
925 tprintf(" Supp. Rates (%u, Len (%u)): ", *id
, supp_rates
->len
);
926 if (len_lt_error(supp_rates
->len
, 1))
929 if ((supp_rates
->len
- sizeof(*supp_rates
) + 1) > 0) {
930 rates
= pkt_pull(pkt
, supp_rates
->len
);
934 for (i
= 0; i
< supp_rates
->len
; i
++)
935 tprintf("%g%s ", ((rates
[i
] & 0x80) >> 7) ?
936 data_rates(rates
[i
] & 0x3f) :
937 ((rates
[i
] & 0x3f) * 0.5),
938 ((rates
[i
] & 0x80) >> 7) ? "(B)" : "");
945 static int8_t inf_fh_ps(struct pkt_buff
*pkt
, u8
*id
)
947 struct element_fh_ps
*fh_ps
;
949 fh_ps
= (struct element_fh_ps
*) pkt_pull(pkt
, sizeof(*fh_ps
));
953 tprintf(" FH Param Set (%u, Len(%u)): ", *id
, fh_ps
->len
);
954 if (len_neq_error(fh_ps
->len
, 5))
956 tprintf("Dwell Time: %fs, ", le16_to_cpu(fh_ps
->dwell_time
) * TU
);
957 tprintf("HopSet: %u, ", fh_ps
->hop_set
);
958 tprintf("HopPattern: %u, ", fh_ps
->hop_pattern
);
959 tprintf("HopIndex: %u", fh_ps
->hop_index
);
964 static int8_t inf_dsss_ps(struct pkt_buff
*pkt
, u8
*id
)
966 struct element_dsss_ps
*dsss_ps
;
968 dsss_ps
= (struct element_dsss_ps
*) pkt_pull(pkt
, sizeof(*dsss_ps
));
972 tprintf(" DSSS Param Set (%u, Len(%u)): ", *id
, dsss_ps
->len
);
973 if (len_neq_error(dsss_ps
->len
, 1))
975 tprintf("Current Channel: %u", dsss_ps
->curr_ch
);
980 static int8_t inf_cf_ps(struct pkt_buff
*pkt
, u8
*id
)
982 struct element_cf_ps
*cf_ps
;
984 cf_ps
= (struct element_cf_ps
*) pkt_pull(pkt
, sizeof(*cf_ps
));
988 tprintf(" CF Param Set (%u, Len(%u)): ", *id
, cf_ps
->len
);
989 if (len_neq_error(cf_ps
->len
, 6))
991 tprintf("CFP Count: %u, ", cf_ps
->cfp_cnt
);
992 tprintf("CFP Period: %u, ", cf_ps
->cfp_period
);
993 tprintf("CFP MaxDur: %fs, ", le16_to_cpu(cf_ps
->cfp_max_dur
) * TU
);
994 tprintf("CFP DurRem: %fs", le16_to_cpu(cf_ps
->cfp_dur_rem
) * TU
);
999 static int8_t inf_tim(struct pkt_buff
*pkt
, u8
*id
)
1001 struct element_tim
*tim
;
1003 tim
= (struct element_tim
*) pkt_pull(pkt
, sizeof(*tim
));
1007 tprintf(" TIM (%u, Len(%u)): ", *id
, tim
->len
);
1008 if (len_lt_error(tim
->len
, 3))
1010 tprintf("DTIM Count: %u, ", tim
->dtim_cnt
);
1011 tprintf("DTIM Period: %u, ", tim
->dtim_period
);
1012 tprintf("Bitmap Control: %u, ", tim
->bmp_cntrl
);
1013 if ((tim
->len
- sizeof(*tim
) + 1) > 0) {
1014 u8
*bmp
= pkt_pull(pkt
, (tim
->len
- sizeof(*tim
) + 1));
1018 tprintf("Partial Virtual Bitmap: 0x");
1019 for(u8 i
=0; i
< (tim
->len
- sizeof(*tim
) + 1); i
++)
1020 tprintf("%.2x", bmp
[i
]);
1026 static int8_t inf_ibss_ps(struct pkt_buff
*pkt
, u8
*id
)
1028 struct element_ibss_ps
*ibss_ps
;
1030 ibss_ps
= (struct element_ibss_ps
*) pkt_pull(pkt
, sizeof(*ibss_ps
));
1031 if (ibss_ps
== NULL
)
1034 tprintf(" IBSS Param Set (%u, Len(%u)): ", *id
, ibss_ps
->len
);
1035 if (len_neq_error(ibss_ps
->len
, 2))
1037 tprintf("ATIM Window: %fs", le16_to_cpu(ibss_ps
->atim_win
) * TU
);
1042 static int8_t inf_country(struct pkt_buff
*pkt
, u8
*id
)
1046 struct element_country
*country
;
1048 country
= (struct element_country
*) pkt_pull(pkt
, sizeof(*country
));
1049 if (country
== NULL
)
1052 tprintf(" Country (%u, Len(%u)): ", *id
, country
->len
);
1053 if (len_lt_error(country
->len
, 6))
1055 tprintf("Country String: %c%c%c", country
->country_first
,
1056 country
->country_sec
, country
->country_third
);
1058 for (i
= country
->len
% 3; i
< (country
->len
- 3); i
+= 3) {
1059 struct element_country_tripled
*country_tripled
;
1061 country_tripled
= (struct element_country_tripled
*)
1062 pkt_pull(pkt
, sizeof(*country_tripled
));
1063 if (country_tripled
== NULL
)
1066 if(country_tripled
->frst_ch
>= 201) {
1067 tprintf("Oper Ext ID: %u, ", country_tripled
->frst_ch
);
1068 tprintf("Operating Class: %u, ", country_tripled
->nr_ch
);
1069 tprintf("Coverage Class: %u", country_tripled
->max_trans
);
1071 tprintf("First Ch Nr: %u, ", country_tripled
->frst_ch
);
1072 tprintf("Nr of Ch: %u, ", country_tripled
->nr_ch
);
1073 tprintf("Max Transmit Pwr Lvl: %u", country_tripled
->max_trans
);
1077 if(country
->len
% 3) {
1078 pad
= pkt_pull(pkt
, 1);
1082 tprintf(", Pad: 0x%x", *pad
);
1088 static int8_t inf_hop_pp(struct pkt_buff
*pkt
, u8
*id
)
1090 struct element_hop_pp
*hop_pp
;
1092 hop_pp
= (struct element_hop_pp
*) pkt_pull(pkt
, sizeof(*hop_pp
));
1096 tprintf(" Hopping Pattern Param (%u, Len(%u)): ", *id
, hop_pp
->len
);
1097 if (len_neq_error(hop_pp
->len
, 2))
1099 tprintf("Prime Radix: %u, ", hop_pp
->prime_radix
);
1100 tprintf("Nr of Ch: %u", hop_pp
->nr_ch
);
1105 static int8_t inf_hop_pt(struct pkt_buff
*pkt
, u8
*id
)
1109 struct element_hop_pt
*hop_pt
;
1111 hop_pt
= (struct element_hop_pt
*) pkt_pull(pkt
, sizeof(*hop_pt
));
1115 tprintf(" Hopping Pattern Table (%u, Len(%u)): ", *id
, hop_pt
->len
);
1116 if (len_lt_error(hop_pt
->len
, 4))
1118 tprintf("Flag: %u, ", hop_pt
->flag
);
1119 tprintf("Nr of Sets: %u, ", hop_pt
->nr_sets
);
1120 tprintf("Modulus: %u, ", hop_pt
->modules
);
1121 tprintf("Offs: %u", hop_pt
->offs
);
1123 if ((hop_pt
->len
- sizeof(*hop_pt
) + 1) > 0) {
1124 rand_tabl
= pkt_pull(pkt
, (hop_pt
->len
- sizeof(*hop_pt
) + 1));
1125 if (rand_tabl
== NULL
)
1128 tprintf(", Rand table: 0x");
1129 for (i
= 0; i
< (hop_pt
->len
- sizeof(*hop_pt
) + 1); i
++)
1130 tprintf("%.2x", rand_tabl
[i
]);
1136 static int8_t inf_req(struct pkt_buff
*pkt
, u8
*id
)
1139 struct element_req
*req
;
1142 req
= (struct element_req
*) pkt_pull(pkt
, sizeof(*req
));
1146 tprintf(" Request Element (%u, Len(%u)): ", *id
, req
->len
);
1147 if ((req
->len
- sizeof(*req
) + 1) > 0) {
1148 req_ids
= pkt_pull(pkt
, (req
->len
- sizeof(*req
) + 1));
1149 if (req_ids
== NULL
)
1152 tprintf(", Requested Element IDs: ");
1153 for (i
= 0; i
< (req
->len
- sizeof(*req
) + 1); i
++)
1154 tprintf("%u ", req_ids
[i
]);
1160 static int8_t inf_bss_load(struct pkt_buff
*pkt
, u8
*id
)
1162 struct element_bss_load
*bss_load
;
1164 bss_load
= (struct element_bss_load
*) pkt_pull(pkt
, sizeof(*bss_load
));
1165 if (bss_load
== NULL
)
1168 tprintf(" BSS Load element (%u, Len(%u)): ", *id
, bss_load
->len
);
1169 if (len_neq_error(bss_load
->len
, 5))
1171 tprintf("Station Count: %u, ", le16_to_cpu(bss_load
->station_cnt
));
1172 tprintf("Channel Utilization: %u, ", bss_load
->ch_util
);
1173 tprintf("Available Admission Capacity: %uus",
1174 bss_load
->avlb_adm_cap
* 32);
1179 static int8_t inf_edca_ps(struct pkt_buff
*pkt
, u8
*id
)
1181 u32 ac_be
, ac_bk
, ac_vi
, ac_vo
;
1182 struct element_edca_ps
*edca_ps
;
1184 edca_ps
= (struct element_edca_ps
*) pkt_pull(pkt
, sizeof(*edca_ps
));
1185 if (edca_ps
== NULL
)
1188 ac_be
= le32_to_cpu(edca_ps
->ac_be
);
1189 ac_bk
= le32_to_cpu(edca_ps
->ac_bk
);
1190 ac_vi
= le32_to_cpu(edca_ps
->ac_vi
);
1191 ac_vo
= le32_to_cpu(edca_ps
->ac_vo
);
1193 tprintf(" EDCA Param Set (%u, Len(%u)): ", *id
, edca_ps
->len
);
1194 if (len_neq_error(edca_ps
->len
, 18))
1196 tprintf("QoS Info: 0x%x (-> EDCA Param Set Update Count (%u),"
1197 "Q-Ack (%u), Queue Re (%u), TXOP Req(%u), Res(%u)), ",
1198 edca_ps
->qos_inf
, edca_ps
->qos_inf
>> 4,
1199 (edca_ps
->qos_inf
>> 3) & 1, (edca_ps
->qos_inf
>> 2) & 1,
1200 (edca_ps
->qos_inf
>> 1) & 1, edca_ps
->qos_inf
& 1);
1201 tprintf("Reserved: 0x%x, ", edca_ps
->res
);
1202 tprintf("AC_BE Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1203 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_be
,
1204 ac_be
>> 28, (ac_be
>> 27) & 1, (ac_be
>> 25) & 3,
1205 (ac_be
>> 24) & 1, (ac_be
>> 20) & 15, (ac_be
>> 16) & 15,
1206 bswap_16(ac_be
& 0xFFFF) * 32);
1207 tprintf("AC_BK Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1208 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_bk
,
1209 ac_bk
>> 28, (ac_bk
>> 27) & 1, (ac_bk
>> 25) & 3,
1210 (ac_bk
>> 24) & 1, (ac_bk
>> 20) & 15, (ac_bk
>> 16) & 15,
1211 bswap_16(ac_bk
& 0xFFFF) * 32);
1212 tprintf("AC_VI Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1213 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_vi
,
1214 ac_vi
>> 28, (ac_vi
>> 27) & 1, (ac_vi
>> 25) & 3,
1215 (ac_vi
>> 24) & 1, (ac_vi
>> 20) & 15, (ac_vi
>> 16) & 15,
1216 bswap_16(ac_vi
& 0xFFFF) * 32);
1217 tprintf("AC_VO Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1218 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)", ac_vo
,
1219 ac_vo
>> 28, (ac_vo
>> 27) & 1, (ac_vo
>> 25) & 3,
1220 (ac_vo
>> 24) & 1, (ac_vo
>> 20) & 15, (ac_vo
>> 16) & 15,
1221 bswap_16(ac_vo
& 0xFFFF) * 32);
1226 static int8_t inf_tspec(struct pkt_buff
*pkt
, u8
*id
)
1228 u16 nom_msdu_size
, surplus_bandw_allow
;
1229 struct element_tspec
*tspec
;
1231 tspec
= (struct element_tspec
*) pkt_pull(pkt
, sizeof(*tspec
));
1235 nom_msdu_size
= le16_to_cpu(tspec
->nom_msdu_size
);
1236 surplus_bandw_allow
= le16_to_cpu(tspec
->surplus_bandw_allow
);
1238 tprintf(" TSPEC (%u, Len(%u)): ", *id
, tspec
->len
);
1239 if (len_neq_error(tspec
->len
, 55))
1241 tprintf("Traffic Type: %u, ", tspec
->traffic_type
);
1242 tprintf("TSID: %u, ", tspec
->tsid
);
1243 tprintf("Direction: %u, ", tspec
->direction
);
1244 tprintf("Access Policy: %u, ", tspec
->access_policy
);
1245 tprintf("Aggregation: %u, ", tspec
->aggr
);
1246 tprintf("User Priority: %u, ", tspec
->user_prior
);
1247 tprintf("TSinfo Ack Policy: %u, ", tspec
->tsinfo_ack_pol
);
1248 tprintf("Schedule: %u, ", tspec
->schedule
);
1249 tprintf("Reserved: 0x%x, ", tspec
->res
);
1250 tprintf("Nominal MSDU Size: %uB (Fixed (%u)), ",
1251 nom_msdu_size
>> 1, nom_msdu_size
& 1);
1252 tprintf("Maximum MSDU Size: %uB, ", le16_to_cpu(tspec
->max_msdu_size
));
1253 tprintf("Minimum Service Interval: %uus, ",
1254 le32_to_cpu(tspec
->min_srv_intv
));
1255 tprintf("Maximum Service Interval: %uus, ",
1256 le32_to_cpu(tspec
->max_srv_intv
));
1257 tprintf("Inactivity Interval: %uus, ",
1258 le32_to_cpu(tspec
->inactive_intv
));
1259 tprintf("Suspension Interval: %uus, ", le32_to_cpu(tspec
->susp_intv
));
1260 tprintf("Service Start Time: %uus, ",
1261 le32_to_cpu(tspec
->srv_start_time
));
1262 tprintf("Minimum Data Rate: %ub/s, ",le32_to_cpu(tspec
->min_data_rate
));
1263 tprintf("Mean Data Rate: %ub/s, ", le32_to_cpu(tspec
->mean_data_rate
));
1264 tprintf("Peak Data Rate: %ub/s, ",le32_to_cpu(tspec
->peak_data_rate
));
1265 tprintf("Burst Size: %uB, ", le32_to_cpu(tspec
->burst_size
));
1266 tprintf("Delay Bound: %uus, ", le32_to_cpu(tspec
->delay_bound
));
1267 tprintf("Minimum PHY Rate: %ub/s, ", le32_to_cpu(tspec
->min_phy_rate
));
1268 tprintf("Surplus Bandwidth: %u.%u, ", surplus_bandw_allow
>> 13,
1269 surplus_bandw_allow
& 0x1FFF);
1270 tprintf("Medium Time: %uus", le16_to_cpu(tspec
->med_time
) * 32);
1275 static const char *class_type(u8 type
)
1278 case 0: return "Ethernet parameters";
1279 case 1: return "TCP/UDP IP parameters";
1280 case 2: return "IEEE 802.1Q parameters";
1281 case 3: return "Filter Offset parameters";
1282 case 4: return "IP and higher layer parameters";
1283 case 5: return "IEEE 802.1D/Q parameters";
1284 default: return "Reserved";
1288 static int8_t inf_tclas(struct pkt_buff
*pkt
, u8
*id
)
1290 struct element_tclas
*tclas
;
1291 struct element_tclas_frm_class
*frm_class
;
1293 tclas
= (struct element_tclas
*) pkt_pull(pkt
, sizeof(*tclas
));
1297 frm_class
= (struct element_tclas_frm_class
*)
1298 pkt_pull(pkt
, sizeof(*frm_class
));
1299 if (frm_class
== NULL
)
1302 tprintf(" TCLAS (%u, Len(%u)): ", *id
, tclas
->len
);
1303 if (len_lt_error(tclas
->len
, 3))
1305 tprintf("User Priority: %u, ", tclas
->user_priority
);
1306 tprintf("Classifier Type: %s (%u), ", class_type(frm_class
->type
),
1308 tprintf("Classifier Mask: 0x%x, ", frm_class
->mask
);
1310 if(frm_class
->type
== 0) {
1311 struct element_tclas_type0
*type0
;
1313 type0
= (struct element_tclas_type0
*)
1314 pkt_pull(pkt
, sizeof(*type0
));
1318 /* I think little endian, like the rest */
1319 tprintf("Src Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1320 type0
->sa
[5], type0
->sa
[4], type0
->sa
[3],
1321 type0
->sa
[2], type0
->sa
[1], type0
->sa
[0]);
1322 tprintf("Dst Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1323 type0
->da
[5], type0
->da
[4], type0
->da
[3],
1324 type0
->da
[2], type0
->da
[1], type0
->da
[0]);
1325 tprintf("Type: 0x%x", le16_to_cpu(type0
->type
));
1327 else if(frm_class
->type
== 1) {
1328 struct element_tclas_type1
*type1
;
1330 type1
= (struct element_tclas_type1
*)
1331 pkt_pull(pkt
, sizeof(*type1
));
1335 tprintf("Version: %u, ", type1
->version
);
1336 /* big endian format follows */
1337 if(type1
->version
== 4) {
1338 struct element_tclas_type1_ip4
*type1_ip4
;
1339 char src_ip
[INET_ADDRSTRLEN
];
1340 char dst_ip
[INET_ADDRSTRLEN
];
1342 type1_ip4
= (struct element_tclas_type1_ip4
*)
1343 pkt_pull(pkt
, sizeof(*type1_ip4
));
1344 if (type1_ip4
== NULL
)
1347 inet_ntop(AF_INET
, &type1_ip4
->sa
, src_ip
, sizeof(src_ip
));
1348 inet_ntop(AF_INET
, &type1_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1350 tprintf("Src IP: %s, ", src_ip
);
1351 tprintf("Dst IP: %s, ", dst_ip
);
1352 tprintf("Src Port: %u, ", ntohs(type1_ip4
->sp
));
1353 tprintf("Dst Port: %u, ", ntohs(type1_ip4
->dp
));
1354 tprintf("DSCP: 0x%x, ", type1_ip4
->dscp
);
1355 tprintf("Proto: %u, ", type1_ip4
->proto
);
1356 tprintf("Res: 0x%x", type1_ip4
->reserved
);
1358 else if(type1
->version
== 6) {
1359 struct element_tclas_type1_ip6
*type1_ip6
;
1360 char src_ip
[INET6_ADDRSTRLEN
];
1361 char dst_ip
[INET6_ADDRSTRLEN
];
1363 type1_ip6
= (struct element_tclas_type1_ip6
*)
1364 pkt_pull(pkt
, sizeof(*type1_ip6
));
1365 if (type1_ip6
== NULL
)
1368 inet_ntop(AF_INET6
, &type1_ip6
->sa
,
1369 src_ip
, sizeof(src_ip
));
1370 inet_ntop(AF_INET6
, &type1_ip6
->da
,
1371 dst_ip
, sizeof(dst_ip
));
1373 tprintf("Src IP: %s, ", src_ip
);
1374 tprintf("Dst IP: %s, ", dst_ip
);
1375 tprintf("Src Port: %u, ", ntohs(type1_ip6
->sp
));
1376 tprintf("Dst Port: %u, ", ntohs(type1_ip6
->dp
));
1377 tprintf("Flow Label: 0x%x%x%x", type1_ip6
->flow_label1
,
1378 type1_ip6
->flow_label2
, type1_ip6
->flow_label3
);
1381 tprintf("Version (%u) not supported", type1
->version
);
1386 else if(frm_class
->type
== 2) {
1387 struct element_tclas_type2
*type2
;
1389 type2
= (struct element_tclas_type2
*)
1390 pkt_pull(pkt
, sizeof(*type2
));
1394 tprintf("802.1Q VLAN TCI: 0x%x", ntohs(type2
->vlan_tci
));
1396 else if(frm_class
->type
== 3) {
1397 struct element_tclas_type3
*type3
;
1401 type3
= (struct element_tclas_type3
*)
1402 pkt_pull(pkt
, sizeof(*type3
));
1406 len
= (tclas
->len
- 5) / 2;
1408 tprintf("Filter Offset: %u, ", type3
->offs
);
1410 if((len
& 1) || (len_lt_error(tclas
->len
, 5))) {
1411 tprintf("Length of TCLAS (%u) not correct", tclas
->len
);
1415 val
= pkt_pull(pkt
, len
);
1419 tprintf("Filter Value: 0x");
1420 for (i
= 0; i
< len
/ 2; i
++)
1421 tprintf("%x ", val
[i
]);
1423 tprintf("Filter Mask: 0x");
1424 for (i
= len
/ 2; i
< len
; i
++)
1425 tprintf("%x ", val
[i
]);
1429 else if(frm_class
->type
== 4) {
1430 struct element_tclas_type4
*type4
;
1432 type4
= (struct element_tclas_type4
*)
1433 pkt_pull(pkt
, sizeof(*type4
));
1437 tprintf("Version: %u, ", type4
->version
);
1438 /* big endian format follows */
1439 if(type4
->version
== 4) {
1440 struct element_tclas_type4_ip4
*type4_ip4
;
1441 char src_ip
[INET_ADDRSTRLEN
];
1442 char dst_ip
[INET_ADDRSTRLEN
];
1444 type4_ip4
= (struct element_tclas_type4_ip4
*)
1445 pkt_pull(pkt
, sizeof(*type4_ip4
));
1446 if (type4_ip4
== NULL
)
1449 inet_ntop(AF_INET
, &type4_ip4
->sa
, src_ip
, sizeof(src_ip
));
1450 inet_ntop(AF_INET
, &type4_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1452 tprintf("Src IP: %s, ", src_ip
);
1453 tprintf("Dst IP: %s, ", dst_ip
);
1454 tprintf("Src Port: %u, ", ntohs(type4_ip4
->sp
));
1455 tprintf("Dst Port: %u, ", ntohs(type4_ip4
->dp
));
1456 tprintf("DSCP: 0x%x, ", type4_ip4
->dscp
);
1457 tprintf("Proto: %u, ", type4_ip4
->proto
);
1458 tprintf("Res: 0x%x", type4_ip4
->reserved
);
1460 else if(type4
->version
== 6) {
1461 struct element_tclas_type4_ip6
*type4_ip6
;
1462 char src_ip
[INET6_ADDRSTRLEN
];
1463 char dst_ip
[INET6_ADDRSTRLEN
];
1465 type4_ip6
= (struct element_tclas_type4_ip6
*)
1466 pkt_pull(pkt
, sizeof(*type4_ip6
));
1467 if (type4_ip6
== NULL
)
1470 inet_ntop(AF_INET6
, &type4_ip6
->sa
,
1471 src_ip
, sizeof(src_ip
));
1472 inet_ntop(AF_INET6
, &type4_ip6
->da
,
1473 dst_ip
, sizeof(dst_ip
));
1475 tprintf("Src IP: %s, ", src_ip
);
1476 tprintf("Dst IP: %s, ", dst_ip
);
1477 tprintf("Src Port: %u, ", ntohs(type4_ip6
->sp
));
1478 tprintf("Dst Port: %u, ", ntohs(type4_ip6
->dp
));
1479 tprintf("DSCP: 0x%x, ", type4_ip6
->dscp
);
1480 tprintf("Nxt Hdr: %u, ", type4_ip6
->nxt_hdr
);
1481 tprintf("Flow Label: 0x%x%x%x", type4_ip6
->flow_label1
,
1482 type4_ip6
->flow_label2
, type4_ip6
->flow_label3
);
1485 tprintf("Version (%u) not supported", type4
->version
);
1489 else if(frm_class
->type
== 5) {
1490 struct element_tclas_type5
*type5
;
1492 type5
= (struct element_tclas_type5
*)
1493 pkt_pull(pkt
, sizeof(*type5
));
1497 tprintf("802.1Q PCP: 0x%x, ", type5
->pcp
);
1498 tprintf("802.1Q CFI: 0x%x, ", type5
->cfi
);
1499 tprintf("802.1Q VID: 0x%x", type5
->vid
);
1502 tprintf("Classifier Type (%u) not supported", frm_class
->type
);
1509 static int8_t inf_sched(struct pkt_buff
*pkt
, u8
*id
)
1511 struct element_schedule
*schedule
;
1514 schedule
= (struct element_schedule
*) pkt_pull(pkt
, sizeof(*schedule
));
1515 if (schedule
== NULL
)
1518 info
= le16_to_cpu(schedule
->inf
);
1520 tprintf(" Schedule (%u, Len(%u)): ", *id
, schedule
->len
);
1521 if (len_neq_error(schedule
->len
, 12))
1524 tprintf("Aggregation: %u, ", info
>> 15);
1525 tprintf("TSID: %u, ", (info
>> 11) & 0xF);
1526 tprintf("Direction: %u, ", (info
>> 9) & 0x3);
1527 tprintf("Res: %u, ", info
& 0x1FF);
1528 tprintf("Serv Start Time: %uus, ", le32_to_cpu(schedule
->start
));
1529 tprintf("Serv Interval: %uus, ", le32_to_cpu(schedule
->serv_intv
));
1530 tprintf("Spec Interval: %fs", le32_to_cpu(schedule
->spec_intv
) * TU
);
1535 static int8_t inf_chall_txt(struct pkt_buff
*pkt
, u8
*id
)
1537 struct element_chall_txt
*chall_txt
;
1541 chall_txt
= (struct element_chall_txt
*)
1542 pkt_pull(pkt
, sizeof(*chall_txt
));
1543 if (chall_txt
== NULL
)
1546 tprintf(" Challenge Text (%u, Len(%u)): ", *id
, chall_txt
->len
);
1547 if ((chall_txt
->len
- sizeof(*chall_txt
) + 1) > 0) {
1548 txt
= pkt_pull(pkt
, (chall_txt
->len
- sizeof(*chall_txt
) + 1));
1553 for (i
= 0; i
< (chall_txt
->len
- sizeof(*chall_txt
) + 1); i
++)
1554 tprintf("%x ", txt
[i
]);
1560 static int8_t inf_pwr_constr(struct pkt_buff
*pkt
, u8
*id
)
1562 struct element_pwr_constr
*pwr_constr
;
1564 pwr_constr
= (struct element_pwr_constr
*) pkt_pull(pkt
, sizeof(*pwr_constr
));
1565 if (pwr_constr
== NULL
)
1568 tprintf(" Power Constraint (%u, Len(%u)): ", *id
, pwr_constr
->len
);
1569 if (len_neq_error(pwr_constr
->len
, 1))
1572 tprintf("Local Power Constraint: %udB", pwr_constr
->local_pwr_constr
);
1577 static int8_t inf_pwr_cap(struct pkt_buff
*pkt
, u8
*id
)
1579 struct element_pwr_cap
*pwr_cap
;
1581 pwr_cap
= (struct element_pwr_cap
*) pkt_pull(pkt
, sizeof(*pwr_cap
));
1582 if (pwr_cap
== NULL
)
1585 tprintf(" Power Capability (%u, Len(%u)): ", *id
, pwr_cap
->len
);
1586 if (len_neq_error(pwr_cap
->len
, 2))
1589 tprintf("Min. Transm. Pwr Cap.: %ddBm, ", (int8_t)pwr_cap
->min_pwr_cap
);
1590 tprintf("Max. Transm. Pwr Cap.: %ddBm", (int8_t)pwr_cap
->max_pwr_cap
);
1595 static int8_t inf_tpc_req(struct pkt_buff
*pkt
, u8
*id
)
1597 struct element_tpc_req
*tpc_req
;
1599 tpc_req
= (struct element_tpc_req
*) pkt_pull(pkt
, sizeof(*tpc_req
));
1600 if (tpc_req
== NULL
)
1603 tprintf(" TPC Request (%u, Len(%u))", *id
, tpc_req
->len
);
1604 if (len_neq_error(tpc_req
->len
, 0))
1610 static int8_t inf_tpc_rep(struct pkt_buff
*pkt
, u8
*id
)
1612 struct element_tpc_rep
*tpc_rep
;
1614 tpc_rep
= (struct element_tpc_rep
*) pkt_pull(pkt
, sizeof(*tpc_rep
));
1615 if (tpc_rep
== NULL
)
1618 tprintf(" TPC Report (%u, Len(%u)): ", *id
, tpc_rep
->len
);
1619 if (len_neq_error(tpc_rep
->len
, 2))
1622 tprintf("Transmit Power: %udBm, ", (int8_t)tpc_rep
->trans_pwr
);
1623 tprintf("Link Margin: %udB", (int8_t)tpc_rep
->trans_pwr
);
1628 static int8_t inf_supp_ch(struct pkt_buff
*pkt
, u8
*id
)
1630 struct element_supp_ch
*supp_ch
;
1633 supp_ch
= (struct element_supp_ch
*) pkt_pull(pkt
, sizeof(*supp_ch
));
1634 if (supp_ch
== NULL
)
1637 tprintf(" Supp Channels (%u, Len(%u)): ", *id
, supp_ch
->len
);
1638 if (len_lt_error(supp_ch
->len
, 2))
1641 if(supp_ch
->len
& 1) {
1642 tprintf("Length should be modulo 2");
1646 for (i
= 0; i
< supp_ch
->len
; i
+= 2) {
1647 struct element_supp_ch_tuple
*supp_ch_tuple
;
1649 supp_ch_tuple
= (struct element_supp_ch_tuple
*)
1650 pkt_pull(pkt
, sizeof(*supp_ch_tuple
));
1651 if (supp_ch_tuple
== NULL
)
1654 tprintf("First Channel Nr: %u, ", supp_ch_tuple
->first_ch_nr
);
1655 tprintf("Nr of Channels: %u, ", supp_ch_tuple
->nr_ch
);
1661 static int8_t inf_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
)
1663 struct element_ch_sw_ann
*ch_sw_ann
;
1665 ch_sw_ann
= (struct element_ch_sw_ann
*)
1666 pkt_pull(pkt
, sizeof(*ch_sw_ann
));
1667 if (ch_sw_ann
== NULL
)
1670 tprintf(" Channel Switch Announc (%u, Len(%u)): ", *id
, ch_sw_ann
->len
);
1671 if (len_neq_error(ch_sw_ann
->len
, 3))
1674 tprintf("Switch Mode: %u, ", ch_sw_ann
->switch_mode
);
1675 tprintf("New Nr: %u, ", ch_sw_ann
->new_nr
);
1676 tprintf("Switch Count: %u", ch_sw_ann
->switch_cnt
);
1681 static const char *meas_type(u8 type
)
1684 case 0: return "Basic";
1685 case 1: return "Clear Channel assesment (CCA)";
1686 case 2: return "Receive power indication (RPI) histogram";
1687 case 3: return "Channel load";
1688 case 4: return "Noise histogram";
1689 case 5: return "Beacon";
1690 case 6: return "Frame";
1691 case 7: return "STA statistics";
1692 case 8: return "LCI";
1693 case 9: return "Transmit stream/category measurement";
1694 case 10: return "Multicast diagnostics";
1695 case 11: return "Location Civic";
1696 case 12: return "Location Identifier";
1697 case 13 ... 255: return "Reserved";
1701 static int8_t inf_meas_req(struct pkt_buff
*pkt
, u8
*id
)
1703 struct element_meas_req
*meas_req
;
1705 meas_req
= (struct element_meas_req
*) pkt_pull(pkt
, sizeof(*meas_req
));
1706 if (meas_req
== NULL
)
1709 tprintf(" Measurement Req (%u, Len(%u)): ", *id
, meas_req
->len
);
1710 if (len_lt_error(meas_req
->len
, 3))
1713 tprintf("Token: %u, ", meas_req
->token
);
1714 tprintf("Req Mode: 0x%x (Parallel (%u), Enable(%u), Request(%u), "
1715 "Report(%u), Dur Mand(%u)), ", meas_req
->req_mode
,
1716 meas_req
->req_mode
>> 7, (meas_req
->req_mode
>> 6) & 0x1,
1717 (meas_req
->req_mode
>> 5) & 0x1, (meas_req
->req_mode
>> 4) & 0x1,
1718 (meas_req
->req_mode
>> 3) & 0x1);
1719 tprintf("Type: %s (%u), ", meas_type(meas_req
->type
), meas_req
->type
);
1721 if(meas_req
->len
> 3) {
1722 if(meas_req
->type
== 0) {
1723 struct element_meas_basic
*basic
;
1725 basic
= (struct element_meas_basic
*)
1726 pkt_pull(pkt
, sizeof(*basic
));
1730 if (!(meas_req
->len
- 3 - sizeof(*basic
))) {
1731 tprintf("Length of Req matchs not Type %u",
1736 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
1737 tprintf("Meas Start Time: %lu, ",
1738 le64_to_cpu(basic
->start
));
1739 tprintf("Meas Duration: %fs",
1740 le16_to_cpu(basic
->dur
) * TU
);
1743 else if(meas_req
->type
== 1) {
1744 struct element_meas_cca
*cca
;
1746 cca
= (struct element_meas_cca
*)
1747 pkt_pull(pkt
, sizeof(*cca
));
1751 if (!(meas_req
->len
- 3 - sizeof(*cca
))) {
1752 tprintf("Length of Req matchs not Type %u",
1757 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
1758 tprintf("Meas Start Time: %lu, ",
1759 le64_to_cpu(cca
->start
));
1760 tprintf("Meas Duration: %fs",
1761 le16_to_cpu(cca
->dur
) * TU
);
1763 else if(meas_req
->type
== 2) {
1764 struct element_meas_rpi
*rpi
;
1766 rpi
= (struct element_meas_rpi
*)
1767 pkt_pull(pkt
, sizeof(*rpi
));
1771 if (!(meas_req
->len
- 3 - sizeof(*rpi
))) {
1772 tprintf("Length of Req matchs not Type %u",
1777 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
1778 tprintf("Meas Start Time: %lu, ",
1779 le64_to_cpu(rpi
->start
));
1780 tprintf("Meas Duration: %fs",
1781 le16_to_cpu(rpi
->dur
) * TU
);
1783 else if(meas_req
->type
== 3) {
1784 struct element_meas_ch_load
*ch_load
;
1786 ch_load
= (struct element_meas_ch_load
*)
1787 pkt_pull(pkt
, sizeof(*ch_load
));
1788 if (ch_load
== NULL
)
1791 if ((meas_req
->len
- 3 - sizeof(*ch_load
)) >= 0) {
1792 tprintf("Length of Req matchs not Type %u",
1797 tprintf("OP Class: %u, ", ch_load
->op_class
);
1798 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
1799 tprintf("Rand Intv: %fs, ",
1800 le16_to_cpu(ch_load
->rand_intv
) * TU
);
1801 tprintf("Meas Duration: %fs",
1802 le16_to_cpu(ch_load
->dur
) * TU
);
1804 if(!subelements(pkt
,
1805 meas_req
->len
- 3 - sizeof(*ch_load
)))
1808 else if(meas_req
->type
== 4) {
1809 struct element_meas_noise
*noise
;
1811 noise
= (struct element_meas_noise
*)
1812 pkt_pull(pkt
, sizeof(*noise
));
1816 if ((meas_req
->len
- 3 - sizeof(*noise
)) >= 0) {
1817 tprintf("Length of Req matchs not Type %u",
1822 tprintf("OP Class: %u, ", noise
->op_class
);
1823 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
1824 tprintf("Rand Intv: %fs, ",
1825 le16_to_cpu(noise
->rand_intv
) * TU
);
1826 tprintf("Meas Duration: %fs",
1827 le16_to_cpu(noise
->dur
) * TU
);
1829 if(!subelements(pkt
,
1830 meas_req
->len
- 3 - sizeof(*noise
)))
1833 else if(meas_req
->type
== 5) {
1834 struct element_meas_beacon
*beacon
;
1836 beacon
= (struct element_meas_beacon
*)
1837 pkt_pull(pkt
, sizeof(*beacon
));
1841 if ((meas_req
->len
- 3 - sizeof(*beacon
)) >= 0) {
1842 tprintf("Length of Req matchs not Type %u",
1847 tprintf("OP Class: %u, ", beacon
->op_class
);
1848 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
1849 tprintf("Rand Intv: %fs, ",
1850 le16_to_cpu(beacon
->rand_intv
) * TU
);
1851 tprintf("Meas Duration: %fs",
1852 le16_to_cpu(beacon
->dur
) * TU
);
1853 tprintf("Mode: %u, ", beacon
->mode
);
1854 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1855 beacon
->bssid
[0], beacon
->bssid
[1],
1856 beacon
->bssid
[2], beacon
->bssid
[3],
1857 beacon
->bssid
[4], beacon
->bssid
[5]);
1859 if(!subelements(pkt
,
1860 meas_req
->len
- 3 - sizeof(*beacon
)))
1863 else if(meas_req
->type
== 6) {
1864 struct element_meas_frame
*frame
;
1866 frame
= (struct element_meas_frame
*)
1867 pkt_pull(pkt
, sizeof(*frame
));
1871 if ((meas_req
->len
- 3 - sizeof(*frame
)) >= 0) {
1872 tprintf("Length of Req matchs not Type %u",
1877 tprintf("OP Class: %u, ", frame
->op_class
);
1878 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
1879 tprintf("Rand Intv: %fs, ",
1880 le16_to_cpu(frame
->rand_intv
) * TU
);
1881 tprintf("Meas Duration: %fs",
1882 le16_to_cpu(frame
->dur
) * TU
);
1883 tprintf("Request Type: %u, ", frame
->frame
);
1884 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1885 frame
->mac
[0], frame
->mac
[1],
1886 frame
->mac
[2], frame
->mac
[3],
1887 frame
->mac
[4], frame
->mac
[5]);
1889 if(!subelements(pkt
,
1890 meas_req
->len
- 3 - sizeof(*frame
)))
1893 else if(meas_req
->type
== 7) {
1894 struct element_meas_sta
*sta
;
1896 sta
= (struct element_meas_sta
*)
1897 pkt_pull(pkt
, sizeof(*sta
));
1901 if ((meas_req
->len
- 3 - sizeof(*sta
)) >= 0) {
1902 tprintf("Length of Req matchs not Type %u",
1907 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1908 sta
->peer_mac
[0], sta
->peer_mac
[1],
1909 sta
->peer_mac
[2], sta
->peer_mac
[3],
1910 sta
->peer_mac
[4], sta
->peer_mac
[5]);
1911 tprintf("Rand Intv: %fs, ",
1912 le16_to_cpu(sta
->rand_intv
) * TU
);
1913 tprintf("Meas Duration: %fs",
1914 le16_to_cpu(sta
->dur
) * TU
);
1915 tprintf("Group ID: %u, ", sta
->group_id
);
1917 if(!subelements(pkt
,
1918 meas_req
->len
- 3 - sizeof(*sta
)))
1921 else if(meas_req
->type
== 8) {
1922 struct element_meas_lci
*lci
;
1924 lci
= (struct element_meas_lci
*)
1925 pkt_pull(pkt
, sizeof(*lci
));
1929 if ((meas_req
->len
- 3 - sizeof(*lci
)) >= 0) {
1930 tprintf("Length of Req matchs not Type %u",
1935 tprintf("Location Subj: %u, ", lci
->loc_subj
);
1936 tprintf("Latitude Req Res: %udeg",
1937 lci
->latitude_req_res
);
1938 tprintf("Longitude Req Res: %udeg",
1939 lci
->longitude_req_res
);
1940 tprintf("Altitude Req Res: %udeg",
1941 lci
->altitude_req_res
);
1943 if(!subelements(pkt
,
1944 meas_req
->len
- 3 - sizeof(*lci
)))
1947 else if(meas_req
->type
== 9) {
1948 struct element_meas_trans_str_cat
*trans
;
1950 trans
= (struct element_meas_trans_str_cat
*)
1951 pkt_pull(pkt
, sizeof(*trans
));
1955 if ((meas_req
->len
- 3 - sizeof(*trans
)) >= 0) {
1956 tprintf("Length of Req matchs not Type %u",
1961 tprintf("Rand Intv: %fs, ",
1962 le16_to_cpu(trans
->rand_intv
) * TU
);
1963 tprintf("Meas Duration: %fs",
1964 le16_to_cpu(trans
->dur
) * TU
);
1965 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1966 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
1967 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
1968 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
1969 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
1970 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
1972 if(!subelements(pkt
,
1973 meas_req
->len
- 3 - sizeof(*trans
)))
1976 else if(meas_req
->type
== 10) {
1977 struct element_meas_mcast_diag
*mcast
;
1979 mcast
= (struct element_meas_mcast_diag
*)
1980 pkt_pull(pkt
, sizeof(*mcast
));
1984 if ((meas_req
->len
- 3 - sizeof(*mcast
)) >= 0) {
1985 tprintf("Length of Req matchs not Type %u",
1990 tprintf("Rand Intv: %fs, ",
1991 le16_to_cpu(mcast
->rand_intv
) * TU
);
1992 tprintf("Meas Duration: %fs",
1993 le16_to_cpu(mcast
->dur
) * TU
);
1994 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1995 mcast
->group_mac
[0], mcast
->group_mac
[1],
1996 mcast
->group_mac
[2], mcast
->group_mac
[3],
1997 mcast
->group_mac
[4], mcast
->group_mac
[5]);
1999 if(!subelements(pkt
,
2000 meas_req
->len
- 3 - sizeof(*mcast
)))
2003 else if(meas_req
->type
== 11) {
2004 struct element_meas_loc_civic
*civic
;
2006 civic
= (struct element_meas_loc_civic
*)
2007 pkt_pull(pkt
, sizeof(*civic
));
2011 if ((meas_req
->len
- 3 - sizeof(*civic
)) >= 0) {
2012 tprintf("Length of Req matchs not Type %u",
2017 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2018 tprintf("Type: %u, ", civic
->civic_loc
);
2019 tprintf("Srv Intv Units: %u, ",
2020 le16_to_cpu(civic
->loc_srv_intv_unit
));
2021 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2023 if(!subelements(pkt
,
2024 meas_req
->len
- 3 - sizeof(*civic
)))
2027 else if(meas_req
->type
== 12) {
2028 struct element_meas_loc_id
*id
;
2030 id
= (struct element_meas_loc_id
*)
2031 pkt_pull(pkt
, sizeof(*id
));
2035 if ((meas_req
->len
- 3 - sizeof(*id
)) >= 0) {
2036 tprintf("Length of Req matchs not Type %u",
2041 tprintf("Location Subj: %u, ", id
->loc_subj
);
2042 tprintf("Srv Intv Units: %u, ",
2043 le16_to_cpu(id
->loc_srv_intv_unit
));
2044 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2046 if(!subelements(pkt
,
2047 meas_req
->len
- 3 - sizeof(*id
)))
2050 else if(meas_req
->type
== 255) {
2051 struct element_meas_pause
*pause
;
2053 pause
= (struct element_meas_pause
*)
2054 pkt_pull(pkt
, sizeof(*pause
));
2058 if ((meas_req
->len
- 3 - sizeof(*pause
)) >= 0) {
2059 tprintf("Length of Req matchs not Type %u",
2064 tprintf("Pause Time: %fs, ", pause
->time
* 10 * TU
);
2066 if(!subelements(pkt
,
2067 meas_req
->len
- 3 - sizeof(*pause
)))
2071 tprintf("Length field indicates data,"
2072 " but could not interpreted");
2080 static int8_t inf_meas_rep(struct pkt_buff
*pkt
, u8
*id
)
2082 struct element_meas_rep
*meas_rep
;
2084 meas_rep
= (struct element_meas_rep
*) pkt_pull(pkt
, sizeof(*meas_rep
));
2085 if (meas_rep
== NULL
)
2088 tprintf(" Measurement Rep (%u, Len(%u)): ", *id
, meas_rep
->len
);
2089 if (len_lt_error(meas_rep
->len
, 3))
2092 tprintf("Token: %u, ", meas_rep
->token
);
2093 tprintf("Rep Mode: 0x%x (Late (%u), Incapable(%u), Refused(%u), ",
2094 meas_rep
->rep_mode
, meas_rep
->rep_mode
>> 7,
2095 (meas_rep
->rep_mode
>> 6) & 0x1,
2096 (meas_rep
->rep_mode
>> 5) & 0x1);
2097 tprintf("Type: %s (%u), ", meas_type(meas_rep
->type
), meas_rep
->type
);
2099 if(meas_rep
->len
> 3) {
2100 if(meas_rep
->type
== 0) {
2101 struct element_meas_basic
*basic
;
2103 basic
= (struct element_meas_basic
*)
2104 pkt_pull(pkt
, sizeof(*basic
));
2108 if (!(meas_rep
->len
- 3 - sizeof(*basic
))) {
2109 tprintf("Length of Req matchs not Type %u",
2114 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
2115 tprintf("Meas Start Time: %lu, ",
2116 le64_to_cpu(basic
->start
));
2117 tprintf("Meas Duration: %fs",
2118 le16_to_cpu(basic
->dur
) * TU
);
2121 else if(meas_rep
->type
== 1) {
2122 struct element_meas_cca
*cca
;
2124 cca
= (struct element_meas_cca
*)
2125 pkt_pull(pkt
, sizeof(*cca
));
2129 if (!(meas_rep
->len
- 3 - sizeof(*cca
))) {
2130 tprintf("Length of Req matchs not Type %u",
2135 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
2136 tprintf("Meas Start Time: %lu, ",
2137 le64_to_cpu(cca
->start
));
2138 tprintf("Meas Duration: %fs",
2139 le16_to_cpu(cca
->dur
) * TU
);
2141 else if(meas_rep
->type
== 2) {
2142 struct element_meas_rpi
*rpi
;
2144 rpi
= (struct element_meas_rpi
*)
2145 pkt_pull(pkt
, sizeof(*rpi
));
2149 if (!(meas_rep
->len
- 3 - sizeof(*rpi
))) {
2150 tprintf("Length of Req matchs not Type %u",
2155 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
2156 tprintf("Meas Start Time: %lu, ",
2157 le64_to_cpu(rpi
->start
));
2158 tprintf("Meas Duration: %fs",
2159 le16_to_cpu(rpi
->dur
) * TU
);
2161 else if(meas_rep
->type
== 3) {
2162 struct element_meas_ch_load
*ch_load
;
2164 ch_load
= (struct element_meas_ch_load
*)
2165 pkt_pull(pkt
, sizeof(*ch_load
));
2166 if (ch_load
== NULL
)
2169 if ((meas_rep
->len
- 3 - sizeof(*ch_load
)) >= 0) {
2170 tprintf("Length of Req matchs not Type %u",
2175 tprintf("OP Class: %u, ", ch_load
->op_class
);
2176 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
2177 tprintf("Rand Intv: %fs, ",
2178 le16_to_cpu(ch_load
->rand_intv
) * TU
);
2179 tprintf("Meas Duration: %fs",
2180 le16_to_cpu(ch_load
->dur
) * TU
);
2182 if(!subelements(pkt
,
2183 meas_rep
->len
- 3 - sizeof(*ch_load
)))
2186 else if(meas_rep
->type
== 4) {
2187 struct element_meas_noise
*noise
;
2189 noise
= (struct element_meas_noise
*)
2190 pkt_pull(pkt
, sizeof(*noise
));
2194 if ((meas_rep
->len
- 3 - sizeof(*noise
)) >= 0) {
2195 tprintf("Length of Req matchs not Type %u",
2200 tprintf("OP Class: %u, ", noise
->op_class
);
2201 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
2202 tprintf("Rand Intv: %fs, ",
2203 le16_to_cpu(noise
->rand_intv
) * TU
);
2204 tprintf("Meas Duration: %fs",
2205 le16_to_cpu(noise
->dur
) * TU
);
2207 if(!subelements(pkt
,
2208 meas_rep
->len
- 3 - sizeof(*noise
)))
2211 else if(meas_rep
->type
== 5) {
2212 struct element_meas_beacon
*beacon
;
2214 beacon
= (struct element_meas_beacon
*)
2215 pkt_pull(pkt
, sizeof(*beacon
));
2219 if ((meas_rep
->len
- 3 - sizeof(*beacon
)) >= 0) {
2220 tprintf("Length of Req matchs not Type %u",
2225 tprintf("OP Class: %u, ", beacon
->op_class
);
2226 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
2227 tprintf("Rand Intv: %fs, ",
2228 le16_to_cpu(beacon
->rand_intv
) * TU
);
2229 tprintf("Meas Duration: %fs",
2230 le16_to_cpu(beacon
->dur
) * TU
);
2231 tprintf("Mode: %u, ", beacon
->mode
);
2232 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2233 beacon
->bssid
[0], beacon
->bssid
[1],
2234 beacon
->bssid
[2], beacon
->bssid
[3],
2235 beacon
->bssid
[4], beacon
->bssid
[5]);
2237 if(!subelements(pkt
,
2238 meas_rep
->len
- 3 - sizeof(*beacon
)))
2241 else if(meas_rep
->type
== 6) {
2242 struct element_meas_frame
*frame
;
2244 frame
= (struct element_meas_frame
*)
2245 pkt_pull(pkt
, sizeof(*frame
));
2249 if ((meas_rep
->len
- 3 - sizeof(*frame
)) >= 0) {
2250 tprintf("Length of Req matchs not Type %u",
2255 tprintf("OP Class: %u, ", frame
->op_class
);
2256 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
2257 tprintf("Rand Intv: %fs, ",
2258 le16_to_cpu(frame
->rand_intv
) * TU
);
2259 tprintf("Meas Duration: %fs",
2260 le16_to_cpu(frame
->dur
) * TU
);
2261 tprintf("Request Type: %u, ", frame
->frame
);
2262 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2263 frame
->mac
[0], frame
->mac
[1],
2264 frame
->mac
[2], frame
->mac
[3],
2265 frame
->mac
[4], frame
->mac
[5]);
2267 if(!subelements(pkt
,
2268 meas_rep
->len
- 3 - sizeof(*frame
)))
2271 else if(meas_rep
->type
== 7) {
2272 struct element_meas_sta
*sta
;
2274 sta
= (struct element_meas_sta
*)
2275 pkt_pull(pkt
, sizeof(*sta
));
2279 if ((meas_rep
->len
- 3 - sizeof(*sta
)) >= 0) {
2280 tprintf("Length of Req matchs not Type %u",
2285 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2286 sta
->peer_mac
[0], sta
->peer_mac
[1],
2287 sta
->peer_mac
[2], sta
->peer_mac
[3],
2288 sta
->peer_mac
[4], sta
->peer_mac
[5]);
2289 tprintf("Rand Intv: %fs, ",
2290 le16_to_cpu(sta
->rand_intv
) * TU
);
2291 tprintf("Meas Duration: %fs",
2292 le16_to_cpu(sta
->dur
) * TU
);
2293 tprintf("Group ID: %u, ", sta
->group_id
);
2295 if(!subelements(pkt
,
2296 meas_rep
->len
- 3 - sizeof(*sta
)))
2299 else if(meas_rep
->type
== 8) {
2300 struct element_meas_lci
*lci
;
2302 lci
= (struct element_meas_lci
*)
2303 pkt_pull(pkt
, sizeof(*lci
));
2307 if ((meas_rep
->len
- 3 - sizeof(*lci
)) >= 0) {
2308 tprintf("Length of Req matchs not Type %u",
2313 tprintf("Location Subj: %u, ", lci
->loc_subj
);
2314 tprintf("Latitude Req Res: %udeg",
2315 lci
->latitude_req_res
);
2316 tprintf("Longitude Req Res: %udeg",
2317 lci
->longitude_req_res
);
2318 tprintf("Altitude Req Res: %udeg",
2319 lci
->altitude_req_res
);
2321 if(!subelements(pkt
,
2322 meas_rep
->len
- 3 - sizeof(*lci
)))
2325 else if(meas_rep
->type
== 9) {
2326 struct element_meas_trans_str_cat
*trans
;
2328 trans
= (struct element_meas_trans_str_cat
*)
2329 pkt_pull(pkt
, sizeof(*trans
));
2333 if ((meas_rep
->len
- 3 - sizeof(*trans
)) >= 0) {
2334 tprintf("Length of Req matchs not Type %u",
2339 tprintf("Rand Intv: %fs, ",
2340 le16_to_cpu(trans
->rand_intv
) * TU
);
2341 tprintf("Meas Duration: %fs",
2342 le16_to_cpu(trans
->dur
) * TU
);
2343 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2344 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
2345 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
2346 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
2347 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
2348 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
2350 if(!subelements(pkt
,
2351 meas_rep
->len
- 3 - sizeof(*trans
)))
2354 else if(meas_rep
->type
== 10) {
2355 struct element_meas_mcast_diag
*mcast
;
2357 mcast
= (struct element_meas_mcast_diag
*)
2358 pkt_pull(pkt
, sizeof(*mcast
));
2362 if ((meas_rep
->len
- 3 - sizeof(*mcast
)) >= 0) {
2363 tprintf("Length of Req matchs not Type %u",
2368 tprintf("Rand Intv: %fs, ",
2369 le16_to_cpu(mcast
->rand_intv
) * TU
);
2370 tprintf("Meas Duration: %fs",
2371 le16_to_cpu(mcast
->dur
) * TU
);
2372 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2373 mcast
->group_mac
[0], mcast
->group_mac
[1],
2374 mcast
->group_mac
[2], mcast
->group_mac
[3],
2375 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2377 if(!subelements(pkt
,
2378 meas_rep
->len
- 3 - sizeof(*mcast
)))
2381 else if(meas_rep
->type
== 11) {
2382 struct element_meas_loc_civic
*civic
;
2384 civic
= (struct element_meas_loc_civic
*)
2385 pkt_pull(pkt
, sizeof(*civic
));
2389 if ((meas_rep
->len
- 3 - sizeof(*civic
)) >= 0) {
2390 tprintf("Length of Req matchs not Type %u",
2395 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2396 tprintf("Type: %u, ", civic
->civic_loc
);
2397 tprintf("Srv Intv Units: %u, ",
2398 le16_to_cpu(civic
->loc_srv_intv_unit
));
2399 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2401 if(!subelements(pkt
,
2402 meas_rep
->len
- 3 - sizeof(*civic
)))
2405 else if(meas_rep
->type
== 12) {
2406 struct element_meas_loc_id
*id
;
2408 id
= (struct element_meas_loc_id
*)
2409 pkt_pull(pkt
, sizeof(*id
));
2413 if ((meas_rep
->len
- 3 - sizeof(*id
)) >= 0) {
2414 tprintf("Length of Req matchs not Type %u",
2419 tprintf("Location Subj: %u, ", id
->loc_subj
);
2420 tprintf("Srv Intv Units: %u, ",
2421 le16_to_cpu(id
->loc_srv_intv_unit
));
2422 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2424 if(!subelements(pkt
,
2425 meas_rep
->len
- 3 - sizeof(*id
)))
2429 tprintf("Length field indicates data,"
2430 " but could not interpreted");
2438 static int8_t inf_quiet(struct pkt_buff
*pkt
, u8
*id
)
2440 struct element_quiet
*quiet
;
2442 quiet
= (struct element_quiet
*) pkt_pull(pkt
, sizeof(*quiet
));
2446 tprintf(" Quit (%u, Len(%u)): ", *id
, quiet
->len
);
2447 if (len_neq_error(quiet
->len
, 6))
2450 tprintf("Count: %ud, ", quiet
->cnt
);
2451 tprintf("Period: %u, ", quiet
->period
);
2452 tprintf("Duration: %fs, ", le16_to_cpu(quiet
->dur
) * TU
);
2453 tprintf("Offs: %fs", le16_to_cpu(quiet
->offs
) * TU
);
2459 static int8_t inf_ibss_dfs(struct pkt_buff
*pkt
, u8
*id
)
2461 struct element_ibss_dfs
*ibss_dfs
;
2464 ibss_dfs
= (struct element_ibss_dfs
*) pkt_pull(pkt
, sizeof(*ibss_dfs
));
2465 if (ibss_dfs
== NULL
)
2468 tprintf(" IBSS DFS (%u, Len(%u)): ", *id
, ibss_dfs
->len
);
2469 if (len_lt_error(ibss_dfs
->len
, 7))
2472 tprintf("Owner: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2473 ibss_dfs
->owner
[0], ibss_dfs
->owner
[1],
2474 ibss_dfs
->owner
[2], ibss_dfs
->owner
[3],
2475 ibss_dfs
->owner
[4], ibss_dfs
->owner
[5]);
2476 tprintf("Recovery Intv: %u, ", ibss_dfs
->rec_intv
);
2478 if((ibss_dfs
->len
- sizeof(*ibss_dfs
) + 1) & 1) {
2479 tprintf("Length of Channel Map should be modulo 2");
2483 for (i
= 0; i
< ibss_dfs
->len
; i
+= 2) {
2484 struct element_ibss_dfs_tuple
*ibss_dfs_tuple
;
2486 ibss_dfs_tuple
= (struct element_ibss_dfs_tuple
*)
2487 pkt_pull(pkt
, sizeof(*ibss_dfs_tuple
));
2488 if (ibss_dfs_tuple
== NULL
)
2491 tprintf("Channel Nr: %u, ", ibss_dfs_tuple
->ch_nr
);
2492 tprintf("Map: %u, ", ibss_dfs_tuple
->map
);
2498 static int8_t inf_erp(struct pkt_buff
*pkt
, u8
*id
)
2500 struct element_erp
*erp
;
2502 erp
= (struct element_erp
*) pkt_pull(pkt
, sizeof(*erp
));
2506 tprintf(" ERP (%u, Len(%u)): ", *id
, erp
->len
);
2507 if (len_neq_error(erp
->len
, 1))
2509 tprintf("Non ERP Present (%u), ", erp
->param
& 0x1);
2510 tprintf("Use Protection (%u), ", (erp
->param
>> 1) & 0x1);
2511 tprintf("Barker Preamble Mode (%u), ", (erp
->param
>> 2) & 0x1);
2512 tprintf("Reserved (0x%.5x)", erp
->param
>> 3);
2517 static int8_t inf_ts_del(struct pkt_buff
*pkt
, u8
*id
)
2519 struct element_ts_del
*ts_del
;
2521 ts_del
= (struct element_ts_del
*) pkt_pull(pkt
, sizeof(*ts_del
));
2525 tprintf(" TS Delay (%u, Len(%u)): ", *id
, ts_del
->len
);
2526 if (len_neq_error(ts_del
->len
, 4))
2528 tprintf("Delay (%fs)", le32_to_cpu(ts_del
->delay
) * TU
);
2533 static int8_t inf_tclas_proc(struct pkt_buff
*pkt
, u8
*id
)
2535 struct element_tclas_proc
*tclas_proc
;
2537 tclas_proc
= (struct element_tclas_proc
*)
2538 pkt_pull(pkt
, sizeof(*tclas_proc
));
2539 if (tclas_proc
== NULL
)
2542 tprintf(" TCLAS Procesing (%u, Len(%u)): ", *id
, tclas_proc
->len
);
2543 if (len_neq_error(tclas_proc
->len
, 1))
2545 tprintf("Processing (%u)", tclas_proc
->proc
);
2550 static int8_t inf_ht_cap(struct pkt_buff
*pkt
, u8
*id
)
2552 struct element_ht_cap
*ht_cap
;
2553 u32 tx_param_res
, beam_cap
;
2556 ht_cap
= (struct element_ht_cap
*)
2557 pkt_pull(pkt
, sizeof(*ht_cap
));
2561 tx_param_res
= le32_to_cpu(ht_cap
->tx_param_res
);
2562 beam_cap
= le32_to_cpu(ht_cap
->beam_cap
);
2563 ext_cap
= le16_to_cpu(ht_cap
->ext_cap
);
2565 tprintf(" HT Capabilities (%u, Len(%u)): ", *id
, ht_cap
->len
);
2566 if (len_neq_error(ht_cap
->len
, 26))
2568 tprintf("Info (LDCP Cod Cap (%u), Supp Ch Width Set (%u),"
2569 " SM Pwr Save(%u), HT-Greenfield (%u), Short GI for 20/40 MHz"
2570 " (%u/%u), Tx/Rx STBC (%u/%u), HT-Delayed Block Ack (%u),"
2571 " Max A-MSDU Len (%u), DSSS/CCK Mode in 40 MHz (%u),"
2572 " Res (0x%x), Forty MHz Intol (%u), L-SIG TXOP Protection Supp"
2573 " (%u)), ", ht_cap
->ldpc
, ht_cap
->supp_width
,
2574 ht_cap
->sm_pwr
, ht_cap
->ht_green
, ht_cap
->gi_20mhz
,
2575 ht_cap
->gi_40mhz
, ht_cap
->tx_stbc
, ht_cap
->rx_stbc
,
2576 ht_cap
->ht_ack
, ht_cap
->max_msdu_length
, ht_cap
->dsss_ck_mode
,
2577 ht_cap
->res
, ht_cap
->forty_int
, ht_cap
->prot_supp
);
2578 tprintf("A-MPDU Params (Max Len Exp (%u), Min Start Spacing (%u),"
2579 " Res (0x%x)), ", ht_cap
->param
>> 6, (ht_cap
->param
>> 3) & 0x7,
2580 ht_cap
->param
& 0x07);
2581 tprintf("Supp MCS Set (Rx MCS Bitmask (0x%x%x%x%x%x%x%x%x%x%x),"
2582 " Res (0x%x), Rx High Supp Data Rate (%u), Res (0x%x),"
2583 " Tx MCS Set Def (%u), Tx Rx MCS Set Not Eq (%u),"
2584 " Tx Max Number Spat Str Supp (%u),"
2585 " Tx Uneq Mod Supp (%u), Res (0x%x)), ",
2586 ht_cap
->bitmask1
, ht_cap
->bitmask2
, ht_cap
->bitmask3
,
2587 ht_cap
->bitmask4
, ht_cap
->bitmask5
, ht_cap
->bitmask6
,
2588 ht_cap
->bitmask7
, ht_cap
->bitmask8
, ht_cap
->bitmask9
,
2589 ht_cap
->bitmask10_res
>> 3, ht_cap
->bitmask10_res
& 0x7,
2590 le16_to_cpu(ht_cap
->supp_rate_res
) >> 6,
2591 le16_to_cpu(ht_cap
->supp_rate_res
) & 0x3F,
2592 tx_param_res
>> 31, (tx_param_res
>> 30) & 1,
2593 (tx_param_res
>> 28) & 3, (tx_param_res
>> 27) & 1,
2594 tx_param_res
& 0x7FFFFFF);
2595 tprintf("Ext Cap (PCO (%u), PCO Trans Time (%u), Res (0x%x),"
2596 " MCS Feedb (%u), +HTC Supp (%u), RD Resp (%u), Res (0x%x)), ",
2597 ext_cap
>> 15, (ext_cap
>> 13) & 3, (ext_cap
>> 8) & 0x1F,
2598 (ext_cap
>> 6) & 3, (ext_cap
>> 5) & 1, (ext_cap
>> 4) & 1,
2600 tprintf("Transm Beamf (Impl Transm Beamf Rec Cap (%u),"
2601 " Rec/Transm Stagg Sound Cap (%u/%u),"
2602 " Rec/Trans NDP Cap (%u/%u), Impl Transm Beamf Cap (%u),"
2603 " Cal (%u), Expl CSI Transm Beamf Cap (%u),"
2604 " Expl Noncmpr/Compr Steering Cap (%u/%u),"
2605 " Expl Trans Beamf CSI Feedb (%u),"
2606 " Expl Noncmpr/Cmpr Feedb Cap (%u/%u),"
2607 " Min Grpg (%u), CSI Num Beamf Ant Supp (%u),"
2608 " Noncmpr/Cmpr Steering Nr Beamf Ant Supp (%u/%u),"
2609 " CSI Max Nr Rows Beamf Supp (%u),"
2610 " Ch Estim Cap (%u), Res (0x%x)), ",
2611 beam_cap
>> 31, (beam_cap
>> 30) & 1, (beam_cap
>> 29) & 1,
2612 (beam_cap
>> 28) & 1, (beam_cap
>> 27) & 1, (beam_cap
>> 26) & 1,
2613 (beam_cap
>> 24) & 3, (beam_cap
>> 23) & 1, (beam_cap
>> 22) & 1,
2614 (beam_cap
>> 21) & 1, (beam_cap
>> 19) & 3, (beam_cap
>> 17) & 3,
2615 (beam_cap
>> 15) & 3, (beam_cap
>> 13) & 3, (beam_cap
>> 11) & 3,
2616 (beam_cap
>> 9) & 3, (beam_cap
>> 7) & 3, (beam_cap
>> 5) & 3,
2617 (beam_cap
>> 3) & 3, beam_cap
& 7);
2618 tprintf("ASEL (Ant Select Cap (%u),"
2619 " Expl CSI Feedb Based Transm ASEL Cap (%u),"
2620 " Ant Indic Feedb Based Transm ASEL Cap (%u),"
2621 " Expl CSI Feedb Cap (%u), Ant Indic Feedb Cap (%u),"
2622 " Rec ASEL Cap (%u), Transm Sound PPDUs Cap (%u), Res (0x%x))",
2623 ht_cap
->asel_cap
>> 7, (ht_cap
->asel_cap
>> 6) & 1,
2624 (ht_cap
->asel_cap
>> 5) & 1, (ht_cap
->asel_cap
>> 4) & 1,
2625 (ht_cap
->asel_cap
>> 3) & 1, (ht_cap
->asel_cap
>> 2) & 1,
2626 (ht_cap
->asel_cap
>> 1) & 1, ht_cap
->asel_cap
& 1);
2631 static int8_t inf_qos_cap(struct pkt_buff
*pkt
, u8
*id
)
2633 struct element_qos_cap
*qos_cap
;
2635 qos_cap
= (struct element_qos_cap
*)
2636 pkt_pull(pkt
, sizeof(*qos_cap
));
2637 if (qos_cap
== NULL
)
2640 tprintf(" QoS Capabilities (%u, Len(%u)): ", *id
, qos_cap
->len
);
2641 if (len_neq_error(qos_cap
->len
, 1))
2644 tprintf("Info (0x%x)", qos_cap
->info
);
2649 static int8_t inf_rsn(struct pkt_buff
*pkt
, u8
*id
)
2654 static int8_t inf_ext_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
2658 struct element_ext_supp_rates
*ext_supp_rates
;
2660 ext_supp_rates
= (struct element_ext_supp_rates
*)
2661 pkt_pull(pkt
, sizeof(*ext_supp_rates
));
2662 if (ext_supp_rates
== NULL
)
2665 tprintf(" Ext Support Rates (%u, Len(%u)): ", *id
, ext_supp_rates
->len
);
2667 if ((ext_supp_rates
->len
- sizeof(*ext_supp_rates
) + 1) > 0) {
2668 rates
= pkt_pull(pkt
, ext_supp_rates
->len
);
2672 for (i
= 0; i
< ext_supp_rates
->len
; i
++)
2673 tprintf("%g ", (rates
[i
] & 0x80) ?
2674 ((rates
[i
] & 0x3f) * 0.5) :
2675 data_rates(rates
[i
]));
2682 static int8_t inf_ap_ch_exp(struct pkt_buff
*pkt
, u8
*id
) {
2686 static int8_t inf_neighb_rep(struct pkt_buff
*pkt
, u8
*id
) {
2690 static int8_t inf_rcpi(struct pkt_buff
*pkt
, u8
*id
) {
2694 static int8_t inf_mde(struct pkt_buff
*pkt
, u8
*id
) {
2698 static int8_t inf_fte(struct pkt_buff
*pkt
, u8
*id
) {
2702 static int8_t inf_time_out_int(struct pkt_buff
*pkt
, u8
*id
) {
2706 static int8_t inf_rde(struct pkt_buff
*pkt
, u8
*id
) {
2710 static int8_t inf_dse_reg_loc(struct pkt_buff
*pkt
, u8
*id
) {
2714 static int8_t inf_supp_op_class(struct pkt_buff
*pkt
, u8
*id
) {
2718 static int8_t inf_ext_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
) {
2722 static int8_t inf_ht_op(struct pkt_buff
*pkt
, u8
*id
) {
2726 static int8_t inf_sec_ch_offs(struct pkt_buff
*pkt
, u8
*id
) {
2730 static int8_t inf_bss_avg_acc_del(struct pkt_buff
*pkt
, u8
*id
) {
2734 static int8_t inf_ant(struct pkt_buff
*pkt
, u8
*id
) {
2738 static int8_t inf_rsni(struct pkt_buff
*pkt
, u8
*id
) {
2742 static int8_t inf_meas_pilot_trans(struct pkt_buff
*pkt
, u8
*id
) {
2746 static int8_t inf_bss_avl_adm_cap(struct pkt_buff
*pkt
, u8
*id
) {
2750 static int8_t inf_bss_ac_acc_del(struct pkt_buff
*pkt
, u8
*id
) {
2754 static int8_t inf_time_adv(struct pkt_buff
*pkt
, u8
*id
) {
2758 static int8_t inf_rm_ena_cap(struct pkt_buff
*pkt
, u8
*id
) {
2762 static int8_t inf_mult_bssid(struct pkt_buff
*pkt
, u8
*id
) {
2766 static int8_t inf_20_40_bss_coex(struct pkt_buff
*pkt
, u8
*id
) {
2770 static int8_t inf_20_40_bss_int_ch_rep(struct pkt_buff
*pkt
, u8
*id
) {
2774 static int8_t inf_overl_bss_scan_para(struct pkt_buff
*pkt
, u8
*id
) {
2778 static int8_t inf_ric_desc(struct pkt_buff
*pkt
, u8
*id
) {
2782 static int8_t inf_mgmt_mic(struct pkt_buff
*pkt
, u8
*id
) {
2786 static int8_t inf_ev_req(struct pkt_buff
*pkt
, u8
*id
) {
2790 static int8_t inf_ev_rep(struct pkt_buff
*pkt
, u8
*id
) {
2794 static int8_t inf_diagn_req(struct pkt_buff
*pkt
, u8
*id
) {
2798 static int8_t inf_diagn_rep(struct pkt_buff
*pkt
, u8
*id
) {
2802 static int8_t inf_loc_para(struct pkt_buff
*pkt
, u8
*id
) {
2806 static int8_t inf_nontr_bssid_cap(struct pkt_buff
*pkt
, u8
*id
) {
2810 static int8_t inf_ssid_list(struct pkt_buff
*pkt
, u8
*id
) {
2814 static int8_t inf_mult_bssid_index(struct pkt_buff
*pkt
, u8
*id
) {
2818 static int8_t inf_fms_desc(struct pkt_buff
*pkt
, u8
*id
) {
2822 static int8_t inf_fms_req(struct pkt_buff
*pkt
, u8
*id
) {
2826 static int8_t inf_fms_resp(struct pkt_buff
*pkt
, u8
*id
) {
2830 static int8_t inf_qos_tfc_cap(struct pkt_buff
*pkt
, u8
*id
) {
2834 static int8_t inf_bss_max_idle_per(struct pkt_buff
*pkt
, u8
*id
) {
2838 static int8_t inf_tfs_req(struct pkt_buff
*pkt
, u8
*id
) {
2842 static int8_t inf_tfs_resp(struct pkt_buff
*pkt
, u8
*id
) {
2846 static int8_t inf_wnm_sleep_mod(struct pkt_buff
*pkt
, u8
*id
) {
2850 static int8_t inf_tim_bcst_req(struct pkt_buff
*pkt
, u8
*id
) {
2854 static int8_t inf_tim_bcst_resp(struct pkt_buff
*pkt
, u8
*id
) {
2858 static int8_t inf_coll_interf_rep(struct pkt_buff
*pkt
, u8
*id
) {
2862 static int8_t inf_ch_usage(struct pkt_buff
*pkt
, u8
*id
) {
2866 static int8_t inf_time_zone(struct pkt_buff
*pkt
, u8
*id
) {
2870 static int8_t inf_dms_req(struct pkt_buff
*pkt
, u8
*id
) {
2874 static int8_t inf_dms_resp(struct pkt_buff
*pkt
, u8
*id
) {
2878 static int8_t inf_link_id(struct pkt_buff
*pkt
, u8
*id
) {
2882 static int8_t inf_wakeup_sched(struct pkt_buff
*pkt
, u8
*id
) {
2886 static int8_t inf_ch_sw_timing(struct pkt_buff
*pkt
, u8
*id
) {
2890 static int8_t inf_pti_ctrl(struct pkt_buff
*pkt
, u8
*id
) {
2894 static int8_t inf_tpu_buff_status(struct pkt_buff
*pkt
, u8
*id
) {
2898 static int8_t inf_interw(struct pkt_buff
*pkt
, u8
*id
) {
2902 static int8_t inf_adv_proto(struct pkt_buff
*pkt
, u8
*id
) {
2906 static int8_t inf_exp_bandw_req(struct pkt_buff
*pkt
, u8
*id
) {
2910 static int8_t inf_qos_map_set(struct pkt_buff
*pkt
, u8
*id
) {
2914 static int8_t inf_roam_cons(struct pkt_buff
*pkt
, u8
*id
) {
2918 static int8_t inf_emer_alert_id(struct pkt_buff
*pkt
, u8
*id
) {
2922 static int8_t inf_mesh_conf(struct pkt_buff
*pkt
, u8
*id
) {
2926 static int8_t inf_mesh_id(struct pkt_buff
*pkt
, u8
*id
) {
2930 static int8_t inf_mesh_link_metr_rep(struct pkt_buff
*pkt
, u8
*id
) {
2934 static int8_t inf_cong_notif(struct pkt_buff
*pkt
, u8
*id
) {
2938 static int8_t inf_mesh_peer_mgmt(struct pkt_buff
*pkt
, u8
*id
) {
2942 static int8_t inf_mesh_ch_sw_para(struct pkt_buff
*pkt
, u8
*id
) {
2946 static int8_t inf_mesh_awake_win(struct pkt_buff
*pkt
, u8
*id
) {
2950 static int8_t inf_beacon_timing(struct pkt_buff
*pkt
, u8
*id
) {
2954 static int8_t inf_mccaop_setup_req(struct pkt_buff
*pkt
, u8
*id
) {
2958 static int8_t inf_mccaop_setup_rep(struct pkt_buff
*pkt
, u8
*id
) {
2962 static int8_t inf_mccaop_adv(struct pkt_buff
*pkt
, u8
*id
) {
2966 static int8_t inf_mccaop_teardwn(struct pkt_buff
*pkt
, u8
*id
) {
2970 static int8_t inf_gann(struct pkt_buff
*pkt
, u8
*id
) {
2974 static int8_t inf_rann(struct pkt_buff
*pkt
, u8
*id
) {
2978 static int8_t inf_ext_cap(struct pkt_buff
*pkt
, u8
*id
) {
2982 static int8_t inf_preq(struct pkt_buff
*pkt
, u8
*id
) {
2986 static int8_t inf_prep(struct pkt_buff
*pkt
, u8
*id
) {
2990 static int8_t inf_perr(struct pkt_buff
*pkt
, u8
*id
) {
2994 static int8_t inf_pxu(struct pkt_buff
*pkt
, u8
*id
) {
2998 static int8_t inf_pxuc(struct pkt_buff
*pkt
, u8
*id
) {
3002 static int8_t inf_auth_mesh_peer_exch(struct pkt_buff
*pkt
, u8
*id
) {
3006 static int8_t inf_mic(struct pkt_buff
*pkt
, u8
*id
) {
3010 static int8_t inf_dest_uri(struct pkt_buff
*pkt
, u8
*id
) {
3014 static int8_t inf_u_apsd_coex(struct pkt_buff
*pkt
, u8
*id
) {
3018 static int8_t inf_mccaop_adv_overv(struct pkt_buff
*pkt
, u8
*id
) {
3022 static int8_t inf_vend_spec(struct pkt_buff
*pkt
, u8
*id
)
3026 struct element_vend_spec
*vend_spec
;
3028 vend_spec
= (struct element_vend_spec
*)
3029 pkt_pull(pkt
, sizeof(*vend_spec
));
3030 if (vend_spec
== NULL
)
3033 tprintf(" Vendor Specific (%u, Len (%u)): ", *id
, vend_spec
->len
);
3035 data
= pkt_pull(pkt
, vend_spec
->len
);
3040 for (i
= 0; i
< vend_spec
->len
; i
++)
3041 tprintf("%.2x", data
[i
]);
3046 static int8_t inf_elements(struct pkt_buff
*pkt
)
3048 u8
*id
= pkt_pull(pkt
, 1);
3053 case 0: return inf_ssid(pkt
, id
);
3054 case 1: return inf_supp_rates(pkt
, id
);
3055 case 2: return inf_fh_ps(pkt
, id
);
3056 case 3: return inf_dsss_ps(pkt
, id
);
3057 case 4: return inf_cf_ps(pkt
, id
);
3058 case 5: return inf_tim(pkt
, id
);
3059 case 6: return inf_ibss_ps(pkt
, id
);
3060 case 7: return inf_country(pkt
, id
);
3061 case 8: return inf_hop_pp(pkt
, id
);
3062 case 9: return inf_hop_pt(pkt
, id
);
3063 case 10: return inf_req(pkt
, id
);
3064 case 11: return inf_bss_load(pkt
, id
);
3065 case 12: return inf_edca_ps(pkt
, id
);
3066 case 13: return inf_tspec(pkt
, id
);
3067 case 14: return inf_tclas(pkt
, id
);
3068 case 15: return inf_sched(pkt
, id
);
3069 case 16: return inf_chall_txt(pkt
, id
);
3070 case 17 ... 31: return inf_reserved(pkt
, id
);
3071 case 32: return inf_pwr_constr(pkt
, id
);
3072 case 33: return inf_pwr_cap(pkt
, id
);
3073 case 34: return inf_tpc_req(pkt
, id
);
3074 case 35: return inf_tpc_rep(pkt
, id
);
3075 case 36: return inf_supp_ch(pkt
, id
);
3076 case 37: return inf_ch_sw_ann(pkt
, id
);
3077 case 38: return inf_meas_req(pkt
, id
);
3078 case 39: return inf_meas_rep(pkt
, id
);
3079 case 40: return inf_quiet(pkt
, id
);
3080 case 41: return inf_ibss_dfs(pkt
, id
);
3081 case 42: return inf_erp(pkt
, id
);
3082 case 43: return inf_ts_del(pkt
, id
);
3083 case 44: return inf_tclas_proc(pkt
, id
);
3084 case 45: return inf_ht_cap(pkt
, id
);
3085 case 46: return inf_qos_cap(pkt
, id
);
3086 case 47: return inf_reserved(pkt
, id
);
3087 case 48: return inf_rsn(pkt
, id
);
3088 case 49: return inf_rsn(pkt
, id
);
3089 case 50: return inf_ext_supp_rates(pkt
, id
);
3090 case 51: return inf_ap_ch_exp(pkt
, id
);
3091 case 52: return inf_neighb_rep(pkt
, id
);
3092 case 53: return inf_rcpi(pkt
, id
);
3093 case 54: return inf_mde(pkt
, id
);
3094 case 55: return inf_fte(pkt
, id
);
3095 case 56: return inf_time_out_int(pkt
, id
);
3096 case 57: return inf_rde(pkt
, id
);
3097 case 58: return inf_dse_reg_loc(pkt
, id
);
3098 case 59: return inf_supp_op_class(pkt
, id
);
3099 case 60: return inf_ext_ch_sw_ann(pkt
, id
);
3100 case 61: return inf_ht_op(pkt
, id
);
3101 case 62: return inf_sec_ch_offs(pkt
, id
);
3102 case 63: return inf_bss_avg_acc_del(pkt
, id
);
3103 case 64: return inf_ant(pkt
, id
);
3104 case 65: return inf_rsni(pkt
, id
);
3105 case 66: return inf_meas_pilot_trans(pkt
, id
);
3106 case 67: return inf_bss_avl_adm_cap(pkt
, id
);
3107 case 68: return inf_bss_ac_acc_del(pkt
, id
);
3108 case 69: return inf_time_adv(pkt
, id
);
3109 case 70: return inf_rm_ena_cap(pkt
, id
);
3110 case 71: return inf_mult_bssid(pkt
, id
);
3111 case 72: return inf_20_40_bss_coex(pkt
, id
);
3112 case 73: return inf_20_40_bss_int_ch_rep(pkt
, id
);
3113 case 74: return inf_overl_bss_scan_para(pkt
, id
);
3114 case 75: return inf_ric_desc(pkt
, id
);
3115 case 76: return inf_mgmt_mic(pkt
, id
);
3116 case 78: return inf_ev_req(pkt
, id
);
3117 case 79: return inf_ev_rep(pkt
, id
);
3118 case 80: return inf_diagn_req(pkt
, id
);
3119 case 81: return inf_diagn_rep(pkt
, id
);
3120 case 82: return inf_loc_para(pkt
, id
);
3121 case 83: return inf_nontr_bssid_cap(pkt
, id
);
3122 case 84: return inf_ssid_list(pkt
, id
);
3123 case 85: return inf_mult_bssid_index(pkt
, id
);
3124 case 86: return inf_fms_desc(pkt
, id
);
3125 case 87: return inf_fms_req(pkt
, id
);
3126 case 88: return inf_fms_resp(pkt
, id
);
3127 case 89: return inf_qos_tfc_cap(pkt
, id
);
3128 case 90: return inf_bss_max_idle_per(pkt
, id
);
3129 case 91: return inf_tfs_req(pkt
, id
);
3130 case 92: return inf_tfs_resp(pkt
, id
);
3131 case 93: return inf_wnm_sleep_mod(pkt
, id
);
3132 case 94: return inf_tim_bcst_req(pkt
, id
);
3133 case 95: return inf_tim_bcst_resp(pkt
, id
);
3134 case 96: return inf_coll_interf_rep(pkt
, id
);
3135 case 97: return inf_ch_usage(pkt
, id
);
3136 case 98: return inf_time_zone(pkt
, id
);
3137 case 99: return inf_dms_req(pkt
, id
);
3138 case 100: return inf_dms_resp(pkt
, id
);
3139 case 101: return inf_link_id(pkt
, id
);
3140 case 102: return inf_wakeup_sched(pkt
, id
);
3141 case 104: return inf_ch_sw_timing(pkt
, id
);
3142 case 105: return inf_pti_ctrl(pkt
, id
);
3143 case 106: return inf_tpu_buff_status(pkt
, id
);
3144 case 107: return inf_interw(pkt
, id
);
3145 case 108: return inf_adv_proto(pkt
, id
);
3146 case 109: return inf_exp_bandw_req(pkt
, id
);
3147 case 110: return inf_qos_map_set(pkt
, id
);
3148 case 111: return inf_roam_cons(pkt
, id
);
3149 case 112: return inf_emer_alert_id(pkt
, id
);
3150 case 113: return inf_mesh_conf(pkt
, id
);
3151 case 114: return inf_mesh_id(pkt
, id
);
3152 case 115: return inf_mesh_link_metr_rep(pkt
, id
);
3153 case 116: return inf_cong_notif(pkt
, id
);
3154 case 117: return inf_mesh_peer_mgmt(pkt
, id
);
3155 case 118: return inf_mesh_ch_sw_para(pkt
, id
);
3156 case 119: return inf_mesh_awake_win(pkt
, id
);
3157 case 120: return inf_beacon_timing(pkt
, id
);
3158 case 121: return inf_mccaop_setup_req(pkt
, id
);
3159 case 122: return inf_mccaop_setup_rep(pkt
, id
);
3160 case 123: return inf_mccaop_adv(pkt
, id
);
3161 case 124: return inf_mccaop_teardwn(pkt
, id
);
3162 case 125: return inf_gann(pkt
, id
);
3163 case 126: return inf_rann(pkt
, id
);
3164 case 127: return inf_ext_cap(pkt
, id
);
3165 case 128: return inf_reserved(pkt
, id
);
3166 case 129: return inf_reserved(pkt
, id
);
3167 case 130: return inf_preq(pkt
, id
);
3168 case 131: return inf_prep(pkt
, id
);
3169 case 132: return inf_perr(pkt
, id
);
3170 case 133: return inf_reserved(pkt
, id
);
3171 case 134: return inf_reserved(pkt
, id
);
3172 case 135: return inf_reserved(pkt
, id
);
3173 case 136: return inf_reserved(pkt
, id
);
3174 case 137: return inf_pxu(pkt
, id
);
3175 case 138: return inf_pxuc(pkt
, id
);
3176 case 139: return inf_auth_mesh_peer_exch(pkt
, id
);
3177 case 140: return inf_mic(pkt
, id
);
3178 case 141: return inf_dest_uri(pkt
, id
);
3179 case 142: return inf_u_apsd_coex(pkt
, id
);
3180 case 143 ... 173: return inf_reserved(pkt
, id
);
3181 case 174: return inf_mccaop_adv_overv(pkt
, id
);
3182 case 221: return inf_vend_spec(pkt
, id
);
3188 #define ESS 0b0000000000000001
3189 #define IBSS 0b0000000000000010
3190 #define CF_Pollable 0b0000000000000100
3191 #define CF_Poll_Req 0b0000000000001000
3192 #define Privacy 0b0000000000010000
3193 #define Short_Pre 0b0000000000100000
3194 #define PBCC 0b0000000001000000
3195 #define Ch_Agility 0b0000000010000000
3196 #define Spec_Mgmt 0b0000000100000000
3197 #define QoS 0b0000001000000000
3198 #define Short_Slot_t 0b0000010000000000
3199 #define APSD 0b0000100000000000
3200 #define Radio_Meas 0b0001000000000000
3201 #define DSSS_OFDM 0b0010000000000000
3202 #define Del_Block_ACK 0b0100000000000000
3203 #define Imm_Block_ACK 0b1000000000000000
3205 static int8_t cap_field(u16 cap_inf
)
3211 if (CF_Pollable
& cap_inf
)
3212 tprintf(" CF Pollable;");
3213 if (CF_Poll_Req
& cap_inf
)
3214 tprintf(" CF-Poll Request;");
3215 if (Privacy
& cap_inf
)
3216 tprintf(" Privacy;");
3217 if (Short_Pre
& cap_inf
)
3218 tprintf(" Short Preamble;");
3221 if (Ch_Agility
& cap_inf
)
3222 tprintf(" Channel Agility;");
3223 if (Spec_Mgmt
& cap_inf
)
3224 tprintf(" Spectrum Management;");
3227 if (Short_Slot_t
& cap_inf
)
3228 tprintf(" Short Slot Time;");
3231 if (Radio_Meas
& cap_inf
)
3232 tprintf(" Radio Measurement;");
3233 if (DSSS_OFDM
& cap_inf
)
3234 tprintf(" DSSS-OFDM;");
3235 if (Del_Block_ACK
& cap_inf
)
3236 tprintf(" Delayed Block Ack;");
3237 if (Imm_Block_ACK
& cap_inf
)
3238 tprintf(" Immediate Block Ack;");
3243 /* Management Dissectors */
3244 static int8_t assoc_req(struct pkt_buff
*pkt
) {
3248 static int8_t assoc_resp(struct pkt_buff
*pkt
) {
3252 static int8_t reassoc_req(struct pkt_buff
*pkt
) {
3256 static int8_t reassoc_resp(struct pkt_buff
*pkt
) {
3260 static int8_t probe_req(struct pkt_buff
*pkt
) {
3264 static int8_t probe_resp(struct pkt_buff
*pkt
) {
3268 static int8_t beacon(struct pkt_buff
*pkt
)
3270 struct ieee80211_mgmt_beacon
*beacon
;
3272 beacon
= (struct ieee80211_mgmt_beacon
*)
3273 pkt_pull(pkt
, sizeof(*beacon
));
3277 tprintf("Timestamp 0x%.16lx, ", le64_to_cpu(beacon
->timestamp
));
3278 tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon
->beacon_int
)*TU
);
3279 tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon
->capab_info
));
3280 cap_field(le16_to_cpu(beacon
->capab_info
));
3284 tprintf("\n\tParameters:");
3285 while (inf_elements(pkt
)) {
3295 static int8_t atim(struct pkt_buff
*pkt
) {
3299 static int8_t disassoc(struct pkt_buff
*pkt
) {
3303 static int8_t auth(struct pkt_buff
*pkt
) {
3307 static int8_t deauth(struct pkt_buff
*pkt
) {
3310 /* End Management Dissectors */
3312 /* Control Dissectors */
3313 static int8_t ps_poll(struct pkt_buff
*pkt
) {
3317 static int8_t rts(struct pkt_buff
*pkt
) {
3321 static int8_t cts(struct pkt_buff
*pkt
) {
3325 static int8_t ack(struct pkt_buff
*pkt
) {
3329 static int8_t cf_end(struct pkt_buff
*pkt
) {
3333 static int8_t cf_end_ack(struct pkt_buff
*pkt
) {
3336 /* End Control Dissectors */
3338 /* Data Dissectors */
3339 static int8_t data(struct pkt_buff
*pkt
) {
3343 static int8_t data_cf_ack(struct pkt_buff
*pkt
) {
3347 static int8_t data_cf_poll(struct pkt_buff
*pkt
) {
3351 static int8_t data_cf_ack_poll(struct pkt_buff
*pkt
) {
3355 static int8_t null(struct pkt_buff
*pkt
) {
3359 static int8_t cf_ack(struct pkt_buff
*pkt
) {
3363 static int8_t cf_poll(struct pkt_buff
*pkt
) {
3367 static int8_t cf_ack_poll(struct pkt_buff
*pkt
) {
3370 /* End Data Dissectors */
3372 static const char *mgt_sub(u8 subtype
, struct pkt_buff
*pkt
,
3373 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3376 struct ieee80211_mgmt
*mgmt
;
3377 const char *dst
, *src
, *bssid
;
3379 mgmt
= (struct ieee80211_mgmt
*) pkt_pull(pkt
, sizeof(*mgmt
));
3383 dst
= lookup_vendor((mgmt
->da
[0] << 16) |
3384 (mgmt
->da
[1] << 8) |
3386 src
= lookup_vendor((mgmt
->sa
[0] << 16) |
3387 (mgmt
->sa
[1] << 8) |
3390 bssid
= lookup_vendor((mgmt
->bssid
[0] << 16) |
3391 (mgmt
->bssid
[1] << 8) |
3393 seq_ctrl
= le16_to_cpu(mgmt
->seq_ctrl
);
3395 tprintf("Duration (%u),", le16_to_cpu(mgmt
->duration
));
3396 tprintf("\n\tDestination (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3397 mgmt
->da
[0], mgmt
->da
[1], mgmt
->da
[2],
3398 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3400 tprintf("=> (%s:%.2x:%.2x:%.2x)", dst
,
3401 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3404 tprintf("\n\tSource (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3405 mgmt
->sa
[0], mgmt
->sa
[1], mgmt
->sa
[2],
3406 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3408 tprintf("=> (%s:%.2x:%.2x:%.2x)", src
,
3409 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3412 tprintf("\n\tBSSID (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3413 mgmt
->bssid
[0], mgmt
->bssid
[1], mgmt
->bssid
[2],
3414 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3416 tprintf("=> (%s:%.2x:%.2x:%.2x)", bssid
,
3417 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3420 tprintf("\n\tFragmentnr. (%u), Seqnr. (%u). ",
3421 seq_ctrl
& 0xf, seq_ctrl
>> 4);
3425 *get_content
= assoc_req
;
3426 return "Association Request";
3428 *get_content
= assoc_resp
;
3429 return "Association Response";
3431 *get_content
= reassoc_req
;
3432 return "Reassociation Request";
3434 *get_content
= reassoc_resp
;
3435 return "Reassociation Response";
3437 *get_content
= probe_req
;
3438 return "Probe Request";
3440 *get_content
= probe_resp
;
3441 return "Probe Response";
3443 *get_content
= beacon
;
3446 *get_content
= atim
;
3449 *get_content
= disassoc
;
3450 return "Disassociation";
3452 *get_content
= auth
;
3453 return "Authentication";
3455 *get_content
= deauth
;
3456 return "Deauthentication";
3457 case 0b0110 ... 0b0111:
3458 case 0b1101 ... 0b1111:
3459 *get_content
= NULL
;
3462 *get_content
= NULL
;
3463 return "Management SubType unknown";
3467 static const char *ctrl_sub(u8 subtype
, struct pkt_buff
*pkt
,
3468 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3472 *get_content
= ps_poll
;
3484 *get_content
= cf_end
;
3487 *get_content
= cf_end_ack
;
3488 return "CF End + CF-ACK";
3489 case 0b0000 ... 0b1001:
3490 *get_content
= NULL
;
3493 return "Control SubType unkown";
3497 static const char *data_sub(u8 subtype
, struct pkt_buff
*pkt
,
3498 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3502 *get_content
= data
;
3505 *get_content
= data_cf_ack
;
3506 return "Data + CF-ACK";
3508 *get_content
= data_cf_poll
;
3509 return "Data + CF-Poll";
3511 *get_content
= data_cf_ack_poll
;
3512 return "Data + CF-ACK + CF-Poll";
3514 *get_content
= null
;
3517 *get_content
= cf_ack
;
3520 *get_content
= cf_poll
;
3523 *get_content
= cf_ack_poll
;
3524 return "CF-ACK + CF-Poll";
3525 case 0b1000 ... 0b1111:
3526 *get_content
= NULL
;
3529 *get_content
= NULL
;
3530 return "Data SubType unkown";
3535 frame_control_type(u8 type
, const char *(**get_subtype
)(u8 subtype
,
3536 struct pkt_buff
*pkt
, int8_t (**get_content
)(struct pkt_buff
*pkt
)))
3540 *get_subtype
= mgt_sub
;
3541 return "Management";
3543 *get_subtype
= ctrl_sub
;
3546 *get_subtype
= data_sub
;
3549 *get_subtype
= NULL
;
3552 *get_subtype
= NULL
;
3553 return "Control Type unkown";
3557 static void ieee80211(struct pkt_buff
*pkt
)
3559 int8_t (*get_content
)(struct pkt_buff
*pkt
) = NULL
;
3560 const char *(*get_subtype
)(u8 subtype
, struct pkt_buff
*pkt
,
3561 int8_t (**get_content
)(struct pkt_buff
*pkt
)) = NULL
;
3562 const char *subtype
= NULL
;
3563 struct ieee80211_frm_ctrl
*frm_ctrl
;
3565 frm_ctrl
= (struct ieee80211_frm_ctrl
*)
3566 pkt_pull(pkt
, sizeof(*frm_ctrl
));
3567 if (frm_ctrl
== NULL
)
3570 tprintf(" [ 802.11 Frame Control (0x%04x)]\n",
3571 le16_to_cpu(frm_ctrl
->frame_control
));
3573 tprintf(" [ Proto Version (%u), ", frm_ctrl
->proto_version
);
3574 tprintf("Type (%u, %s), ", frm_ctrl
->type
,
3575 frame_control_type(frm_ctrl
->type
, &get_subtype
));
3577 subtype
= (*get_subtype
)(frm_ctrl
->subtype
, pkt
, &get_content
);
3578 tprintf("Subtype (%u, %s)", frm_ctrl
->subtype
, subtype
);
3580 tprintf("%s%s%s", colorize_start_full(black
, red
),
3581 "No SubType Data available", colorize_end());
3584 tprintf("%s%s", frm_ctrl
->to_ds
? ", Frame goes to DS" : "",
3585 frm_ctrl
->from_ds
? ", Frame comes from DS" : "");
3586 tprintf("%s", frm_ctrl
->more_frags
? ", More Fragments" : "");
3587 tprintf("%s", frm_ctrl
->retry
? ", Frame is retransmitted" : "");
3588 tprintf("%s", frm_ctrl
->power_mgmt
? ", In Power Saving Mode" : "");
3589 tprintf("%s", frm_ctrl
->more_data
? ", More Data" : "");
3590 tprintf("%s", frm_ctrl
->wep
? ", Needs WEP" : "");
3591 tprintf("%s", frm_ctrl
->order
? ", Order" : "");
3595 tprintf(" [ Subtype %s: ", subtype
);
3596 if (!((*get_content
) (pkt
)))
3597 tprintf("%s%s%s", colorize_start_full(black
, red
),
3598 "Failed to dissect Subtype", colorize_end());
3601 tprintf("%s%s%s", colorize_start_full(black
, red
),
3602 "No SubType Data available", colorize_end());
3607 // pkt_set_proto(pkt, &ieee802_lay2, ntohs(eth->h_proto));
3610 static void ieee80211_less(struct pkt_buff
*pkt
)
3612 tprintf("802.11 frame (more on todo)");
3615 struct protocol ieee80211_ops
= {
3617 .print_full
= ieee80211
,
3618 .print_less
= ieee80211_less
,
3621 EXPORT_SYMBOL(ieee80211_ops
);