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"
29 /* Note: Fields are encoded in little-endian! */
30 struct ieee80211_frm_ctrl
{
34 #if defined(__LITTLE_ENDIAN_BITFIELD)
35 /* Correct order here ... */
36 __extension__ u16 proto_version
:2,
47 #elif defined(__BIG_ENDIAN_BITFIELD)
48 __extension__ u16 subtype
:4,
60 # error "Adjust your <asm/byteorder.h> defines"
66 /* Management Frame start */
67 /* Note: Fields are encoded in little-endian! */
68 struct ieee80211_mgmt
{
76 struct ieee80211_mgmt_auth
{
80 /* possibly followed by Challenge text */
84 struct ieee80211_mgmt_deauth
{
88 struct ieee80211_mgmt_assoc_req
{
91 /* followed by SSID and Supported rates */
95 struct ieee80211_mgmt_assoc_resp
{
99 /* followed by Supported rates */
103 struct ieee80211_mgmt_reassoc_resp
{
107 /* followed by Supported rates */
111 struct ieee80211_mgmt_reassoc_req
{
115 /* followed by SSID and Supported rates */
119 struct ieee80211_mgmt_disassoc
{
123 struct ieee80211_mgmt_probe_req
{
126 struct ieee80211_mgmt_beacon
{
130 /* followed by some of SSID, Supported rates,
131 * FH Params, DS Params, CF Params, IBSS Params, TIM */
135 struct ieee80211_mgmt_probe_resp
{
139 /* followed by some of SSID, Supported rates,
140 * FH Params, DS Params, CF Params, IBSS Params, TIM */
143 /* Management Frame end */
145 /* Control Frame start */
146 /* Note: Fields are encoded in little-endian! */
147 struct ieee80211_ctrl
{
150 struct ieee80211_ctrl_rts
{
156 struct ieee80211_ctrl_cts
{
161 struct ieee80211_ctrl_ack
{
166 struct ieee80211_ctrl_ps_poll
{
172 struct ieee80211_ctrl_cf_end
{
178 struct ieee80211_ctrl_cf_end_ack
{
183 /* Control Frame end */
185 /* Data Frame start */
186 /* Note: Fields are encoded in little-endian! */
187 struct ieee80211_data
{
193 struct element_reserved
{
197 struct element_ssid
{
202 struct element_supp_rates
{
207 struct element_fh_ps
{
215 struct element_dsss_ps
{
220 struct element_cf_ps
{
236 struct element_ibss_ps
{
241 struct element_country_tripled
{
247 struct element_country
{
249 #if defined(__LITTLE_ENDIAN_BITFIELD)
250 /* Correct order here ... */
254 #elif defined(__BIG_ENDIAN_BITFIELD)
259 # error "Adjust your <asm/byteorder.h> defines"
261 /* triplet may repeat */
262 struct element_country_tripled tripled
[0];
267 struct element_hop_pp
{
273 struct element_hop_pt
{
287 struct element_bss_load
{
294 struct element_edca_ps
{
304 struct element_tspec
{
308 #if defined(__LITTLE_ENDIAN_BITFIELD)
309 /* Correct order here ... */
310 __extension__ u32 len
:8,
321 #elif defined(__BIG_ENDIAN_BITFIELD)
322 __extension__ u32 len
:8,
334 # error "Adjust your <asm/byteorder.h> defines"
351 u16 surplus_bandw_allow
;
355 struct element_tclas
{
361 struct element_tclas_frm_class
{
367 struct element_tclas_type0
{
373 struct element_tclas_type1
{
378 struct element_tclas_type1_ip4
{
388 struct element_tclas_type1_ip6
{
396 #if defined(__LITTLE_ENDIAN_BITFIELD)
397 __extension__ u8 flow_label3
:8;
398 __extension__ u8 flow_label2
:8;
399 __extension__ u8 flow_label1
:8;
400 #elif defined(__BIG_ENDIAN_BITFIELD)
401 __extension__ u8 flow_label1
:8;
402 __extension__ u8 flow_label2
:8;
403 __extension__ u8 flow_label3
:8;
405 # error "Adjust your <asm/byteorder.h> defines"
411 struct element_tclas_type2
{
415 struct element_tclas_type3
{
421 struct element_tclas_type4
{
426 struct element_tclas_type4_ip4
{
436 struct element_tclas_type4_ip6
{
446 #if defined(__LITTLE_ENDIAN_BITFIELD)
447 __extension__ u8 flow_label3
:8;
448 __extension__ u8 flow_label2
:8;
449 __extension__ u8 flow_label1
:8;
450 #elif defined(__BIG_ENDIAN_BITFIELD)
451 __extension__ u8 flow_label1
:8;
452 __extension__ u8 flow_label2
:8;
453 __extension__ u8 flow_label3
:8;
455 # error "Adjust your <asm/byteorder.h> defines"
461 struct element_tclas_type5
{
467 struct element_schedule
{
475 struct element_chall_txt
{
480 struct element_pwr_constr
{
485 struct element_pwr_cap
{
491 struct element_tpc_req
{
495 struct element_tpc_rep
{
501 struct element_supp_ch
{
507 struct element_supp_ch_tuple
{
512 struct element_ch_sw_ann
{
519 struct element_meas_basic
{
525 struct element_meas_cca
{
531 struct element_meas_rpi
{
537 struct element_meas_ch_load
{
545 struct element_meas_noise
{
553 struct element_meas_beacon
{
563 struct element_meas_frame
{
573 struct element_meas_sta
{
581 struct element_meas_lci
{
584 u8 longitude_req_res
;
589 struct element_meas_trans_str_cat
{
598 struct element_meas_mcast_diag
{
602 u8 mcast_triggered
[0];
606 struct element_meas_loc_civic
{
609 u8 loc_srv_intv_unit
;
614 struct element_meas_loc_id
{
616 u8 loc_srv_intv_unit
;
621 struct element_meas_pause
{
626 struct element_meas_req
{
634 struct element_meas_rep
{
642 struct element_quiet
{
650 struct element_ibss_dfs
{
657 struct element_ibss_dfs_tuple
{
667 struct element_ts_del
{
672 struct element_tclas_proc
{
677 struct element_ht_cap
{
682 #if defined(__LITTLE_ENDIAN_BITFIELD)
683 /* Correct order here ... */
684 __extension__ u16 ldpc
:1,
698 #elif defined(__BIG_ENDIAN_BITFIELD)
699 __extension__ u16 rx_stbc
:2,
714 # error "Adjust your <asm/byteorder.h> defines"
722 #if defined(__LITTLE_ENDIAN_BITFIELD)
723 /* Correct order here ... */
724 __extension__ u8 bitmask1
:8;
725 __extension__ u8 bitmask2
:8;
726 __extension__ u8 bitmask3
:8;
727 __extension__ u8 bitmask4
:8;
728 __extension__ u8 bitmask5
:8;
729 __extension__ u8 bitmask6
:8;
730 __extension__ u8 bitmask7
:8;
731 __extension__ u8 bitmask8
:8;
732 __extension__ u8 bitmask9
:8;
733 __extension__ u8 bitmask10_res
:8;
734 __extension__ u16 supp_rate_res
:16;
735 __extension__ u32 tx_param_res
:32;
737 #elif defined(__BIG_ENDIAN_BITFIELD)
738 __extension__ u32 tx_param_res
:32;
739 __extension__ u16 supp_rate_res
:16;
740 __extension__ u8 bitmask10_res
:8;
741 __extension__ u8 bitmask9
:8;
742 __extension__ u8 bitmask8
:8;
743 __extension__ u8 bitmask7
:8;
744 __extension__ u8 bitmask6
:8;
745 __extension__ u8 bitmask5
:8;
746 __extension__ u8 bitmask4
:8;
747 __extension__ u8 bitmask3
:8;
748 __extension__ u8 bitmask2
:8;
749 __extension__ u8 bitmask1
:8;
751 # error "Adjust your <asm/byteorder.h> defines"
760 struct element_qos_cap
{
765 struct element_ext_supp_rates
{
770 struct element_vend_spec
{
776 struct ieee80211_radiotap_header
{
777 u8 version
; /* set to 0 */
779 u16 len
; /* entire length */
780 u32 present
; /* fields present */
783 static int8_t len_neq_error(u8 len
, u8 intended
)
785 if(intended
!= len
) {
786 tprintf("Length should be %u Bytes", intended
);
793 static int8_t len_lt_error(u8 len
, u8 intended
)
796 tprintf("Length should be greater %u Bytes", intended
);
803 static float data_rates(u8 id
)
805 /* XXX Why not (id / 2.f)? */
813 case 11: return 5.5f
;
814 case 12: return 6.0f
;
815 case 18: return 9.0f
;
816 case 22: return 11.0f
;
817 case 24: return 12.0f
;
818 case 27: return 13.5f
;
819 case 36: return 18.0f
;
820 case 44: return 22.0f
;
821 case 48: return 24.0f
;
822 case 54: return 27.0f
;
823 case 66: return 33.0f
;
824 case 72: return 36.0f
;
825 case 96: return 48.0f
;
826 case 108: return 54.0f
;
839 static int8_t subelements(struct pkt_buff
*pkt
, u8 len
)
845 struct subelement
*sub
;
847 sub
= (struct subelement
*) pkt_pull(pkt
, sizeof(*sub
));
851 tprintf(", Subelement ID %u, ", sub
->id
);
852 tprintf("Length %u, ", sub
->len
);
854 data
= pkt_pull(pkt
, sub
->len
);
859 for(j
=0; j
< sub
->len
; j
++)
860 tprintf("%.2x ", data
[j
]);
865 /* Not needed ?! Should break before*/
868 * tprintf("Length error");
876 static int8_t inf_reserved(struct pkt_buff
*pkt
, u8
*id
)
880 struct element_reserved
*reserved
;
882 reserved
= (struct element_reserved
*) pkt_pull(pkt
, sizeof(*reserved
));
883 if (reserved
== NULL
)
886 tprintf(" Reserved (%u, Len (%u)): ", *id
, reserved
->len
);
888 data
= pkt_pull(pkt
, reserved
->len
);
893 for (i
= 0; i
< reserved
->len
; i
++)
894 tprintf("%.2x", data
[i
]);
899 static int8_t inf_ssid(struct pkt_buff
*pkt
, u8
*id
)
902 struct element_ssid
*ssid
;
905 ssid
= (struct element_ssid
*) pkt_pull(pkt
, sizeof(*ssid
));
909 tprintf(" SSID (%u, Len (%u)): ", *id
, ssid
->len
);
911 if ((ssid
->len
- sizeof(*ssid
) + 1) > 0) {
912 ssid_name
= (char *) pkt_pull(pkt
, ssid
->len
);
913 if (ssid_name
== NULL
)
916 for (i
= 0; i
< ssid
->len
; i
++)
917 tprintf("%c",ssid_name
[i
]);
919 tprintf("Wildcard SSID");
925 static int8_t inf_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
929 struct element_supp_rates
*supp_rates
;
931 supp_rates
= (struct element_supp_rates
*)
932 pkt_pull(pkt
, sizeof(*supp_rates
));
933 if (supp_rates
== NULL
)
936 tprintf(" Supp. Rates (%u, Len (%u)): ", *id
, supp_rates
->len
);
937 if (len_lt_error(supp_rates
->len
, 1))
940 if ((supp_rates
->len
- sizeof(*supp_rates
) + 1) > 0) {
941 rates
= pkt_pull(pkt
, supp_rates
->len
);
945 for (i
= 0; i
< supp_rates
->len
; i
++)
946 tprintf("%g%s ", ((rates
[i
] & 0x80) >> 7) ?
947 data_rates(rates
[i
] & 0x3f) :
948 ((rates
[i
] & 0x3f) * 0.5),
949 ((rates
[i
] & 0x80) >> 7) ? "(B)" : "");
956 static int8_t inf_fh_ps(struct pkt_buff
*pkt
, u8
*id
)
958 struct element_fh_ps
*fh_ps
;
960 fh_ps
= (struct element_fh_ps
*) pkt_pull(pkt
, sizeof(*fh_ps
));
964 tprintf(" FH Param Set (%u, Len(%u)): ", *id
, fh_ps
->len
);
965 if (len_neq_error(fh_ps
->len
, 5))
967 tprintf("Dwell Time: %fs, ", le16_to_cpu(fh_ps
->dwell_time
) * TU
);
968 tprintf("HopSet: %u, ", fh_ps
->hop_set
);
969 tprintf("HopPattern: %u, ", fh_ps
->hop_pattern
);
970 tprintf("HopIndex: %u", fh_ps
->hop_index
);
975 static int8_t inf_dsss_ps(struct pkt_buff
*pkt
, u8
*id
)
977 struct element_dsss_ps
*dsss_ps
;
979 dsss_ps
= (struct element_dsss_ps
*) pkt_pull(pkt
, sizeof(*dsss_ps
));
983 tprintf(" DSSS Param Set (%u, Len(%u)): ", *id
, dsss_ps
->len
);
984 if (len_neq_error(dsss_ps
->len
, 1))
986 tprintf("Current Channel: %u", dsss_ps
->curr_ch
);
991 static int8_t inf_cf_ps(struct pkt_buff
*pkt
, u8
*id
)
993 struct element_cf_ps
*cf_ps
;
995 cf_ps
= (struct element_cf_ps
*) pkt_pull(pkt
, sizeof(*cf_ps
));
999 tprintf(" CF Param Set (%u, Len(%u)): ", *id
, cf_ps
->len
);
1000 if (len_neq_error(cf_ps
->len
, 6))
1002 tprintf("CFP Count: %u, ", cf_ps
->cfp_cnt
);
1003 tprintf("CFP Period: %u, ", cf_ps
->cfp_period
);
1004 tprintf("CFP MaxDur: %fs, ", le16_to_cpu(cf_ps
->cfp_max_dur
) * TU
);
1005 tprintf("CFP DurRem: %fs", le16_to_cpu(cf_ps
->cfp_dur_rem
) * TU
);
1010 static int8_t inf_tim(struct pkt_buff
*pkt
, u8
*id
)
1012 struct element_tim
*tim
;
1015 tim
= (struct element_tim
*) pkt_pull(pkt
, sizeof(*tim
));
1019 tprintf(" TIM (%u, Len(%u)): ", *id
, tim
->len
);
1020 if (len_lt_error(tim
->len
, 3))
1022 tprintf("DTIM Count: %u, ", tim
->dtim_cnt
);
1023 tprintf("DTIM Period: %u, ", tim
->dtim_period
);
1024 tprintf("Bitmap Control: %u, ", tim
->bmp_cntrl
);
1025 if ((tim
->len
- sizeof(*tim
) + 1) > 0) {
1026 u8
*bmp
= pkt_pull(pkt
, (tim
->len
- sizeof(*tim
) + 1));
1030 tprintf("Partial Virtual Bitmap: 0x");
1031 for (i
= 0; i
< (tim
->len
- sizeof(*tim
) + 1); i
++)
1032 tprintf("%.2x", bmp
[i
]);
1038 static int8_t inf_ibss_ps(struct pkt_buff
*pkt
, u8
*id
)
1040 struct element_ibss_ps
*ibss_ps
;
1042 ibss_ps
= (struct element_ibss_ps
*) pkt_pull(pkt
, sizeof(*ibss_ps
));
1043 if (ibss_ps
== NULL
)
1046 tprintf(" IBSS Param Set (%u, Len(%u)): ", *id
, ibss_ps
->len
);
1047 if (len_neq_error(ibss_ps
->len
, 2))
1049 tprintf("ATIM Window: %fs", le16_to_cpu(ibss_ps
->atim_win
) * TU
);
1054 static int8_t inf_country(struct pkt_buff
*pkt
, u8
*id
)
1058 struct element_country
*country
;
1060 country
= (struct element_country
*) pkt_pull(pkt
, sizeof(*country
));
1061 if (country
== NULL
)
1064 tprintf(" Country (%u, Len(%u)): ", *id
, country
->len
);
1065 if (len_lt_error(country
->len
, 6))
1067 tprintf("Country String: %c%c%c", country
->country_first
,
1068 country
->country_sec
, country
->country_third
);
1070 for (i
= country
->len
% 3; i
< (country
->len
- 3); i
+= 3) {
1071 struct element_country_tripled
*country_tripled
;
1073 country_tripled
= (struct element_country_tripled
*)
1074 pkt_pull(pkt
, sizeof(*country_tripled
));
1075 if (country_tripled
== NULL
)
1079 if(country_tripled
->frst_ch
>= 201) {
1080 tprintf("Oper Ext ID: %u, ", country_tripled
->frst_ch
);
1081 tprintf("Operating Class: %u, ", country_tripled
->nr_ch
);
1082 tprintf("Coverage Class: %u", country_tripled
->max_trans
);
1084 tprintf("First Ch Nr: %u, ", country_tripled
->frst_ch
);
1085 tprintf("Nr of Ch: %u, ", country_tripled
->nr_ch
);
1086 tprintf("Max Transmit Pwr Lvl: %u", country_tripled
->max_trans
);
1090 if(country
->len
% 3) {
1091 pad
= pkt_pull(pkt
, 1);
1095 tprintf(", Pad: 0x%x", *pad
);
1101 static int8_t inf_hop_pp(struct pkt_buff
*pkt
, u8
*id
)
1103 struct element_hop_pp
*hop_pp
;
1105 hop_pp
= (struct element_hop_pp
*) pkt_pull(pkt
, sizeof(*hop_pp
));
1109 tprintf(" Hopping Pattern Param (%u, Len(%u)): ", *id
, hop_pp
->len
);
1110 if (len_neq_error(hop_pp
->len
, 2))
1112 tprintf("Prime Radix: %u, ", hop_pp
->prime_radix
);
1113 tprintf("Nr of Ch: %u", hop_pp
->nr_ch
);
1118 static int8_t inf_hop_pt(struct pkt_buff
*pkt
, u8
*id
)
1122 struct element_hop_pt
*hop_pt
;
1124 hop_pt
= (struct element_hop_pt
*) pkt_pull(pkt
, sizeof(*hop_pt
));
1128 tprintf(" Hopping Pattern Table (%u, Len(%u)): ", *id
, hop_pt
->len
);
1129 if (len_lt_error(hop_pt
->len
, 4))
1131 tprintf("Flag: %u, ", hop_pt
->flag
);
1132 tprintf("Nr of Sets: %u, ", hop_pt
->nr_sets
);
1133 tprintf("Modulus: %u, ", hop_pt
->modules
);
1134 tprintf("Offs: %u", hop_pt
->offs
);
1136 if ((hop_pt
->len
- sizeof(*hop_pt
) + 1) > 0) {
1137 rand_tabl
= pkt_pull(pkt
, (hop_pt
->len
- sizeof(*hop_pt
) + 1));
1138 if (rand_tabl
== NULL
)
1141 tprintf(", Rand table: 0x");
1142 for (i
= 0; i
< (hop_pt
->len
- sizeof(*hop_pt
) + 1); i
++)
1143 tprintf("%.2x", rand_tabl
[i
]);
1149 static int8_t inf_req(struct pkt_buff
*pkt
, u8
*id
)
1152 struct element_req
*req
;
1155 req
= (struct element_req
*) pkt_pull(pkt
, sizeof(*req
));
1159 tprintf(" Request Element (%u, Len(%u)): ", *id
, req
->len
);
1160 if ((req
->len
- sizeof(*req
) + 1) > 0) {
1161 req_ids
= pkt_pull(pkt
, (req
->len
- sizeof(*req
) + 1));
1162 if (req_ids
== NULL
)
1165 tprintf(", Requested Element IDs: ");
1166 for (i
= 0; i
< (req
->len
- sizeof(*req
) + 1); i
++)
1167 tprintf("%u ", req_ids
[i
]);
1173 static int8_t inf_bss_load(struct pkt_buff
*pkt
, u8
*id
)
1175 struct element_bss_load
*bss_load
;
1177 bss_load
= (struct element_bss_load
*) pkt_pull(pkt
, sizeof(*bss_load
));
1178 if (bss_load
== NULL
)
1181 tprintf(" BSS Load element (%u, Len(%u)): ", *id
, bss_load
->len
);
1182 if (len_neq_error(bss_load
->len
, 5))
1184 tprintf("Station Count: %u, ", le16_to_cpu(bss_load
->station_cnt
));
1185 tprintf("Channel Utilization: %u, ", bss_load
->ch_util
);
1186 tprintf("Available Admission Capacity: %uus",
1187 bss_load
->avlb_adm_cap
* 32);
1192 static int8_t inf_edca_ps(struct pkt_buff
*pkt
, u8
*id
)
1194 u32 ac_be
, ac_bk
, ac_vi
, ac_vo
;
1195 struct element_edca_ps
*edca_ps
;
1197 edca_ps
= (struct element_edca_ps
*) pkt_pull(pkt
, sizeof(*edca_ps
));
1198 if (edca_ps
== NULL
)
1201 ac_be
= le32_to_cpu(edca_ps
->ac_be
);
1202 ac_bk
= le32_to_cpu(edca_ps
->ac_bk
);
1203 ac_vi
= le32_to_cpu(edca_ps
->ac_vi
);
1204 ac_vo
= le32_to_cpu(edca_ps
->ac_vo
);
1206 tprintf(" EDCA Param Set (%u, Len(%u)): ", *id
, edca_ps
->len
);
1207 if (len_neq_error(edca_ps
->len
, 18))
1209 tprintf("QoS Info: 0x%x (-> EDCA Param Set Update Count (%u),"
1210 "Q-Ack (%u), Queue Re (%u), TXOP Req(%u), Res(%u)), ",
1211 edca_ps
->qos_inf
, edca_ps
->qos_inf
>> 4,
1212 (edca_ps
->qos_inf
>> 3) & 1, (edca_ps
->qos_inf
>> 2) & 1,
1213 (edca_ps
->qos_inf
>> 1) & 1, edca_ps
->qos_inf
& 1);
1214 tprintf("Reserved: 0x%x, ", edca_ps
->res
);
1215 tprintf("AC_BE Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1216 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_be
,
1217 ac_be
>> 28, (ac_be
>> 27) & 1, (ac_be
>> 25) & 3,
1218 (ac_be
>> 24) & 1, (ac_be
>> 20) & 15, (ac_be
>> 16) & 15,
1219 bswap_16(ac_be
& 0xFFFF) * 32);
1220 tprintf("AC_BK Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1221 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_bk
,
1222 ac_bk
>> 28, (ac_bk
>> 27) & 1, (ac_bk
>> 25) & 3,
1223 (ac_bk
>> 24) & 1, (ac_bk
>> 20) & 15, (ac_bk
>> 16) & 15,
1224 bswap_16(ac_bk
& 0xFFFF) * 32);
1225 tprintf("AC_VI Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1226 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)), ", ac_vi
,
1227 ac_vi
>> 28, (ac_vi
>> 27) & 1, (ac_vi
>> 25) & 3,
1228 (ac_vi
>> 24) & 1, (ac_vi
>> 20) & 15, (ac_vi
>> 16) & 15,
1229 bswap_16(ac_vi
& 0xFFFF) * 32);
1230 tprintf("AC_VO Param Rec: 0x%x (-> AIFSN (%u), ACM (%u), ACI (%u),"
1231 "Res (%u), ECWmin (%u), ECWmax(%u)), TXOP Limit (%uus)", ac_vo
,
1232 ac_vo
>> 28, (ac_vo
>> 27) & 1, (ac_vo
>> 25) & 3,
1233 (ac_vo
>> 24) & 1, (ac_vo
>> 20) & 15, (ac_vo
>> 16) & 15,
1234 bswap_16(ac_vo
& 0xFFFF) * 32);
1239 static int8_t inf_tspec(struct pkt_buff
*pkt
, u8
*id
)
1241 u16 nom_msdu_size
, surplus_bandw_allow
;
1242 struct element_tspec
*tspec
;
1244 tspec
= (struct element_tspec
*) pkt_pull(pkt
, sizeof(*tspec
));
1248 nom_msdu_size
= le16_to_cpu(tspec
->nom_msdu_size
);
1249 surplus_bandw_allow
= le16_to_cpu(tspec
->surplus_bandw_allow
);
1251 tprintf(" TSPEC (%u, Len(%u)): ", *id
, tspec
->len
);
1252 if (len_neq_error(tspec
->len
, 55))
1254 tprintf("Traffic Type: %u, ", tspec
->traffic_type
);
1255 tprintf("TSID: %u, ", tspec
->tsid
);
1256 tprintf("Direction: %u, ", tspec
->direction
);
1257 tprintf("Access Policy: %u, ", tspec
->access_policy
);
1258 tprintf("Aggregation: %u, ", tspec
->aggr
);
1259 tprintf("APSD: %u, ", tspec
->apsd
);
1260 tprintf("User Priority: %u, ", tspec
->user_prior
);
1261 tprintf("TSinfo Ack Policy: %u, ", tspec
->tsinfo_ack_pol
);
1262 tprintf("Schedule: %u, ", tspec
->schedule
);
1263 tprintf("Reserved: 0x%x, ", tspec
->res
);
1264 tprintf("Nominal MSDU Size: %uB (Fixed (%u)), ",
1265 nom_msdu_size
>> 1, nom_msdu_size
& 1);
1266 tprintf("Maximum MSDU Size: %uB, ", le16_to_cpu(tspec
->max_msdu_size
));
1267 tprintf("Minimum Service Interval: %uus, ",
1268 le32_to_cpu(tspec
->min_srv_intv
));
1269 tprintf("Maximum Service Interval: %uus, ",
1270 le32_to_cpu(tspec
->max_srv_intv
));
1271 tprintf("Inactivity Interval: %uus, ",
1272 le32_to_cpu(tspec
->inactive_intv
));
1273 tprintf("Suspension Interval: %uus, ", le32_to_cpu(tspec
->susp_intv
));
1274 tprintf("Service Start Time: %uus, ",
1275 le32_to_cpu(tspec
->srv_start_time
));
1276 tprintf("Minimum Data Rate: %ub/s, ",le32_to_cpu(tspec
->min_data_rate
));
1277 tprintf("Mean Data Rate: %ub/s, ", le32_to_cpu(tspec
->mean_data_rate
));
1278 tprintf("Peak Data Rate: %ub/s, ",le32_to_cpu(tspec
->peak_data_rate
));
1279 tprintf("Burst Size: %uB, ", le32_to_cpu(tspec
->burst_size
));
1280 tprintf("Delay Bound: %uus, ", le32_to_cpu(tspec
->delay_bound
));
1281 tprintf("Minimum PHY Rate: %ub/s, ", le32_to_cpu(tspec
->min_phy_rate
));
1282 tprintf("Surplus Bandwidth: %u.%u, ", surplus_bandw_allow
>> 13,
1283 surplus_bandw_allow
& 0x1FFF);
1284 tprintf("Medium Time: %uus", le16_to_cpu(tspec
->med_time
) * 32);
1289 static const char *class_type(u8 type
)
1292 case 0: return "Ethernet parameters";
1293 case 1: return "TCP/UDP IP parameters";
1294 case 2: return "IEEE 802.1Q parameters";
1295 case 3: return "Filter Offset parameters";
1296 case 4: return "IP and higher layer parameters";
1297 case 5: return "IEEE 802.1D/Q parameters";
1298 default: return "Reserved";
1302 static int8_t inf_tclas(struct pkt_buff
*pkt
, u8
*id
)
1304 struct element_tclas
*tclas
;
1305 struct element_tclas_frm_class
*frm_class
;
1307 tclas
= (struct element_tclas
*) pkt_pull(pkt
, sizeof(*tclas
));
1311 frm_class
= (struct element_tclas_frm_class
*)
1312 pkt_pull(pkt
, sizeof(*frm_class
));
1313 if (frm_class
== NULL
)
1316 tprintf(" TCLAS (%u, Len(%u)): ", *id
, tclas
->len
);
1317 if (len_lt_error(tclas
->len
, 3))
1319 tprintf("User Priority: %u, ", tclas
->user_priority
);
1320 tprintf("Classifier Type: %s (%u), ", class_type(frm_class
->type
),
1322 tprintf("Classifier Mask: 0x%x, ", frm_class
->mask
);
1324 if(frm_class
->type
== 0) {
1325 struct element_tclas_type0
*type0
;
1327 type0
= (struct element_tclas_type0
*)
1328 pkt_pull(pkt
, sizeof(*type0
));
1332 /* I think little endian, like the rest */
1333 tprintf("Src Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1334 type0
->sa
[5], type0
->sa
[4], type0
->sa
[3],
1335 type0
->sa
[2], type0
->sa
[1], type0
->sa
[0]);
1336 tprintf("Dst Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
1337 type0
->da
[5], type0
->da
[4], type0
->da
[3],
1338 type0
->da
[2], type0
->da
[1], type0
->da
[0]);
1339 tprintf("Type: 0x%x", le16_to_cpu(type0
->type
));
1341 else if(frm_class
->type
== 1) {
1342 struct element_tclas_type1
*type1
;
1344 type1
= (struct element_tclas_type1
*)
1345 pkt_pull(pkt
, sizeof(*type1
));
1349 tprintf("Version: %u, ", type1
->version
);
1350 /* big endian format follows */
1351 if(type1
->version
== 4) {
1352 struct element_tclas_type1_ip4
*type1_ip4
;
1353 char src_ip
[INET_ADDRSTRLEN
];
1354 char dst_ip
[INET_ADDRSTRLEN
];
1356 type1_ip4
= (struct element_tclas_type1_ip4
*)
1357 pkt_pull(pkt
, sizeof(*type1_ip4
));
1358 if (type1_ip4
== NULL
)
1361 inet_ntop(AF_INET
, &type1_ip4
->sa
, src_ip
, sizeof(src_ip
));
1362 inet_ntop(AF_INET
, &type1_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1364 tprintf("Src IP: %s, ", src_ip
);
1365 tprintf("Dst IP: %s, ", dst_ip
);
1366 tprintf("Src Port: %u, ", ntohs(type1_ip4
->sp
));
1367 tprintf("Dst Port: %u, ", ntohs(type1_ip4
->dp
));
1368 tprintf("DSCP: 0x%x, ", type1_ip4
->dscp
);
1369 tprintf("Proto: %u, ", type1_ip4
->proto
);
1370 tprintf("Res: 0x%x", type1_ip4
->reserved
);
1372 else if(type1
->version
== 6) {
1373 struct element_tclas_type1_ip6
*type1_ip6
;
1374 char src_ip
[INET6_ADDRSTRLEN
];
1375 char dst_ip
[INET6_ADDRSTRLEN
];
1377 type1_ip6
= (struct element_tclas_type1_ip6
*)
1378 pkt_pull(pkt
, sizeof(*type1_ip6
));
1379 if (type1_ip6
== NULL
)
1382 inet_ntop(AF_INET6
, &type1_ip6
->sa
,
1383 src_ip
, sizeof(src_ip
));
1384 inet_ntop(AF_INET6
, &type1_ip6
->da
,
1385 dst_ip
, sizeof(dst_ip
));
1387 tprintf("Src IP: %s, ", src_ip
);
1388 tprintf("Dst IP: %s, ", dst_ip
);
1389 tprintf("Src Port: %u, ", ntohs(type1_ip6
->sp
));
1390 tprintf("Dst Port: %u, ", ntohs(type1_ip6
->dp
));
1391 tprintf("Flow Label: 0x%x%x%x", type1_ip6
->flow_label1
,
1392 type1_ip6
->flow_label2
, type1_ip6
->flow_label3
);
1395 tprintf("Version (%u) not supported", type1
->version
);
1400 else if(frm_class
->type
== 2) {
1401 struct element_tclas_type2
*type2
;
1403 type2
= (struct element_tclas_type2
*)
1404 pkt_pull(pkt
, sizeof(*type2
));
1408 tprintf("802.1Q VLAN TCI: 0x%x", ntohs(type2
->vlan_tci
));
1410 else if(frm_class
->type
== 3) {
1411 struct element_tclas_type3
*type3
;
1415 type3
= (struct element_tclas_type3
*)
1416 pkt_pull(pkt
, sizeof(*type3
));
1420 len
= (tclas
->len
- 5) / 2;
1422 tprintf("Filter Offset: %u, ", type3
->offs
);
1424 if((len
& 1) || (len_lt_error(tclas
->len
, 5))) {
1425 tprintf("Length of TCLAS (%u) not correct", tclas
->len
);
1429 val
= pkt_pull(pkt
, len
);
1433 tprintf("Filter Value: 0x");
1434 for (i
= 0; i
< len
/ 2; i
++)
1435 tprintf("%x ", val
[i
]);
1437 tprintf("Filter Mask: 0x");
1438 for (i
= len
/ 2; i
< len
; i
++)
1439 tprintf("%x ", val
[i
]);
1443 else if(frm_class
->type
== 4) {
1444 struct element_tclas_type4
*type4
;
1446 type4
= (struct element_tclas_type4
*)
1447 pkt_pull(pkt
, sizeof(*type4
));
1451 tprintf("Version: %u, ", type4
->version
);
1452 /* big endian format follows */
1453 if(type4
->version
== 4) {
1454 struct element_tclas_type4_ip4
*type4_ip4
;
1455 char src_ip
[INET_ADDRSTRLEN
];
1456 char dst_ip
[INET_ADDRSTRLEN
];
1458 type4_ip4
= (struct element_tclas_type4_ip4
*)
1459 pkt_pull(pkt
, sizeof(*type4_ip4
));
1460 if (type4_ip4
== NULL
)
1463 inet_ntop(AF_INET
, &type4_ip4
->sa
, src_ip
, sizeof(src_ip
));
1464 inet_ntop(AF_INET
, &type4_ip4
->da
, dst_ip
, sizeof(dst_ip
));
1466 tprintf("Src IP: %s, ", src_ip
);
1467 tprintf("Dst IP: %s, ", dst_ip
);
1468 tprintf("Src Port: %u, ", ntohs(type4_ip4
->sp
));
1469 tprintf("Dst Port: %u, ", ntohs(type4_ip4
->dp
));
1470 tprintf("DSCP: 0x%x, ", type4_ip4
->dscp
);
1471 tprintf("Proto: %u, ", type4_ip4
->proto
);
1472 tprintf("Res: 0x%x", type4_ip4
->reserved
);
1474 else if(type4
->version
== 6) {
1475 struct element_tclas_type4_ip6
*type4_ip6
;
1476 char src_ip
[INET6_ADDRSTRLEN
];
1477 char dst_ip
[INET6_ADDRSTRLEN
];
1479 type4_ip6
= (struct element_tclas_type4_ip6
*)
1480 pkt_pull(pkt
, sizeof(*type4_ip6
));
1481 if (type4_ip6
== NULL
)
1484 inet_ntop(AF_INET6
, &type4_ip6
->sa
,
1485 src_ip
, sizeof(src_ip
));
1486 inet_ntop(AF_INET6
, &type4_ip6
->da
,
1487 dst_ip
, sizeof(dst_ip
));
1489 tprintf("Src IP: %s, ", src_ip
);
1490 tprintf("Dst IP: %s, ", dst_ip
);
1491 tprintf("Src Port: %u, ", ntohs(type4_ip6
->sp
));
1492 tprintf("Dst Port: %u, ", ntohs(type4_ip6
->dp
));
1493 tprintf("DSCP: 0x%x, ", type4_ip6
->dscp
);
1494 tprintf("Nxt Hdr: %u, ", type4_ip6
->nxt_hdr
);
1495 tprintf("Flow Label: 0x%x%x%x", type4_ip6
->flow_label1
,
1496 type4_ip6
->flow_label2
, type4_ip6
->flow_label3
);
1499 tprintf("Version (%u) not supported", type4
->version
);
1503 else if(frm_class
->type
== 5) {
1504 struct element_tclas_type5
*type5
;
1506 type5
= (struct element_tclas_type5
*)
1507 pkt_pull(pkt
, sizeof(*type5
));
1511 tprintf("802.1Q PCP: 0x%x, ", type5
->pcp
);
1512 tprintf("802.1Q CFI: 0x%x, ", type5
->cfi
);
1513 tprintf("802.1Q VID: 0x%x", type5
->vid
);
1516 tprintf("Classifier Type (%u) not supported", frm_class
->type
);
1523 static int8_t inf_sched(struct pkt_buff
*pkt
, u8
*id
)
1525 struct element_schedule
*schedule
;
1528 schedule
= (struct element_schedule
*) pkt_pull(pkt
, sizeof(*schedule
));
1529 if (schedule
== NULL
)
1532 info
= le16_to_cpu(schedule
->inf
);
1534 tprintf(" Schedule (%u, Len(%u)): ", *id
, schedule
->len
);
1535 if (len_neq_error(schedule
->len
, 12))
1538 tprintf("Aggregation: %u, ", info
>> 15);
1539 tprintf("TSID: %u, ", (info
>> 11) & 0xF);
1540 tprintf("Direction: %u, ", (info
>> 9) & 0x3);
1541 tprintf("Res: %u, ", info
& 0x1FF);
1542 tprintf("Serv Start Time: %uus, ", le32_to_cpu(schedule
->start
));
1543 tprintf("Serv Interval: %uus, ", le32_to_cpu(schedule
->serv_intv
));
1544 tprintf("Spec Interval: %fs", le32_to_cpu(schedule
->spec_intv
) * TU
);
1549 static int8_t inf_chall_txt(struct pkt_buff
*pkt
, u8
*id
)
1551 struct element_chall_txt
*chall_txt
;
1555 chall_txt
= (struct element_chall_txt
*)
1556 pkt_pull(pkt
, sizeof(*chall_txt
));
1557 if (chall_txt
== NULL
)
1560 tprintf(" Challenge Text (%u, Len(%u)): ", *id
, chall_txt
->len
);
1561 if ((chall_txt
->len
- sizeof(*chall_txt
) + 1) > 0) {
1562 txt
= pkt_pull(pkt
, (chall_txt
->len
- sizeof(*chall_txt
) + 1));
1567 for (i
= 0; i
< (chall_txt
->len
- sizeof(*chall_txt
) + 1); i
++)
1568 tprintf("%x", txt
[i
]);
1574 static int8_t inf_pwr_constr(struct pkt_buff
*pkt
, u8
*id
)
1576 struct element_pwr_constr
*pwr_constr
;
1578 pwr_constr
= (struct element_pwr_constr
*) pkt_pull(pkt
, sizeof(*pwr_constr
));
1579 if (pwr_constr
== NULL
)
1582 tprintf(" Power Constraint (%u, Len(%u)): ", *id
, pwr_constr
->len
);
1583 if (len_neq_error(pwr_constr
->len
, 1))
1586 tprintf("Local Power Constraint: %udB", pwr_constr
->local_pwr_constr
);
1591 static int8_t inf_pwr_cap(struct pkt_buff
*pkt
, u8
*id
)
1593 struct element_pwr_cap
*pwr_cap
;
1595 pwr_cap
= (struct element_pwr_cap
*) pkt_pull(pkt
, sizeof(*pwr_cap
));
1596 if (pwr_cap
== NULL
)
1599 tprintf(" Power Capability (%u, Len(%u)): ", *id
, pwr_cap
->len
);
1600 if (len_neq_error(pwr_cap
->len
, 2))
1603 tprintf("Min. Transm. Pwr Cap.: %ddBm, ", (int8_t)pwr_cap
->min_pwr_cap
);
1604 tprintf("Max. Transm. Pwr Cap.: %ddBm", (int8_t)pwr_cap
->max_pwr_cap
);
1609 static int8_t inf_tpc_req(struct pkt_buff
*pkt
, u8
*id
)
1611 struct element_tpc_req
*tpc_req
;
1613 tpc_req
= (struct element_tpc_req
*) pkt_pull(pkt
, sizeof(*tpc_req
));
1614 if (tpc_req
== NULL
)
1617 tprintf(" TPC Request (%u, Len(%u))", *id
, tpc_req
->len
);
1618 if (len_neq_error(tpc_req
->len
, 0))
1624 static int8_t inf_tpc_rep(struct pkt_buff
*pkt
, u8
*id
)
1626 struct element_tpc_rep
*tpc_rep
;
1628 tpc_rep
= (struct element_tpc_rep
*) pkt_pull(pkt
, sizeof(*tpc_rep
));
1629 if (tpc_rep
== NULL
)
1632 tprintf(" TPC Report (%u, Len(%u)): ", *id
, tpc_rep
->len
);
1633 if (len_neq_error(tpc_rep
->len
, 2))
1636 tprintf("Transmit Power: %udBm, ", (int8_t)tpc_rep
->trans_pwr
);
1637 tprintf("Link Margin: %udB", (int8_t)tpc_rep
->trans_pwr
);
1642 static int8_t inf_supp_ch(struct pkt_buff
*pkt
, u8
*id
)
1644 struct element_supp_ch
*supp_ch
;
1647 supp_ch
= (struct element_supp_ch
*) pkt_pull(pkt
, sizeof(*supp_ch
));
1648 if (supp_ch
== NULL
)
1651 tprintf(" Supp Channels (%u, Len(%u)): ", *id
, supp_ch
->len
);
1652 if (len_lt_error(supp_ch
->len
, 2))
1655 if(supp_ch
->len
& 1) {
1656 tprintf("Length should be even");
1660 for (i
= 0; i
< supp_ch
->len
; i
+= 2) {
1661 struct element_supp_ch_tuple
*supp_ch_tuple
;
1663 supp_ch_tuple
= (struct element_supp_ch_tuple
*)
1664 pkt_pull(pkt
, sizeof(*supp_ch_tuple
));
1665 if (supp_ch_tuple
== NULL
)
1668 tprintf("First Channel Nr: %u, ", supp_ch_tuple
->first_ch_nr
);
1669 tprintf("Nr of Channels: %u, ", supp_ch_tuple
->nr_ch
);
1675 static int8_t inf_ch_sw_ann(struct pkt_buff
*pkt
, u8
*id
)
1677 struct element_ch_sw_ann
*ch_sw_ann
;
1679 ch_sw_ann
= (struct element_ch_sw_ann
*)
1680 pkt_pull(pkt
, sizeof(*ch_sw_ann
));
1681 if (ch_sw_ann
== NULL
)
1684 tprintf(" Channel Switch Announc (%u, Len(%u)): ", *id
, ch_sw_ann
->len
);
1685 if (len_neq_error(ch_sw_ann
->len
, 3))
1688 tprintf("Switch Mode: %u, ", ch_sw_ann
->switch_mode
);
1689 tprintf("New Nr: %u, ", ch_sw_ann
->new_nr
);
1690 tprintf("Switch Count: %u", ch_sw_ann
->switch_cnt
);
1695 static const char *meas_type(u8 type
)
1698 case 0: return "Basic";
1699 case 1: return "Clear Channel assesment (CCA)";
1700 case 2: return "Receive power indication (RPI) histogram";
1701 case 3: return "Channel load";
1702 case 4: return "Noise histogram";
1703 case 5: return "Beacon";
1704 case 6: return "Frame";
1705 case 7: return "STA statistics";
1706 case 8: return "LCI";
1707 case 9: return "Transmit stream/category measurement";
1708 case 10: return "Multicast diagnostics";
1709 case 11: return "Location Civic";
1710 case 12: return "Location Identifier";
1711 default: return "Reserved";
1715 static int8_t inf_meas_req(struct pkt_buff
*pkt
, u8
*id
)
1717 struct element_meas_req
*meas_req
;
1719 meas_req
= (struct element_meas_req
*) pkt_pull(pkt
, sizeof(*meas_req
));
1720 if (meas_req
== NULL
)
1723 tprintf(" Measurement Req (%u, Len(%u)): ", *id
, meas_req
->len
);
1724 if (len_lt_error(meas_req
->len
, 3))
1727 tprintf("Token: %u, ", meas_req
->token
);
1728 tprintf("Req Mode: 0x%x (Parallel (%u), Enable(%u), Request(%u), "
1729 "Report(%u), Dur Mand(%u), Res(0x%x)), ", meas_req
->req_mode
,
1730 meas_req
->req_mode
& 0x1,
1731 (meas_req
->req_mode
>> 1) & 0x1,
1732 (meas_req
->req_mode
>> 2) & 0x1,
1733 (meas_req
->req_mode
>> 3) & 0x1,
1734 (meas_req
->req_mode
>> 4) & 0x1,
1735 meas_req
->req_mode
>> 7);
1736 tprintf("Type: %s (%u), ", meas_type(meas_req
->type
), meas_req
->type
);
1738 if(meas_req
->len
> 3) {
1739 if(meas_req
->type
== 0) {
1740 struct element_meas_basic
*basic
;
1742 basic
= (struct element_meas_basic
*)
1743 pkt_pull(pkt
, sizeof(*basic
));
1747 if ((meas_req
->len
- 3 - sizeof(*basic
)) != 0) {
1748 tprintf("Length of Req matchs not Type %u",
1753 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
1754 tprintf("Meas Start Time: %"PRIu64
", ",
1755 le64_to_cpu(basic
->start
));
1756 tprintf("Meas Duration: %fs",
1757 le16_to_cpu(basic
->dur
) * TU
);
1760 else if(meas_req
->type
== 1) {
1761 struct element_meas_cca
*cca
;
1763 cca
= (struct element_meas_cca
*)
1764 pkt_pull(pkt
, sizeof(*cca
));
1768 if ((meas_req
->len
- 3 - sizeof(*cca
)) != 0) {
1769 tprintf("Length of Req matchs not Type %u",
1774 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
1775 tprintf("Meas Start Time: %"PRIu64
", ",
1776 le64_to_cpu(cca
->start
));
1777 tprintf("Meas Duration: %fs",
1778 le16_to_cpu(cca
->dur
) * TU
);
1780 else if(meas_req
->type
== 2) {
1781 struct element_meas_rpi
*rpi
;
1783 rpi
= (struct element_meas_rpi
*)
1784 pkt_pull(pkt
, sizeof(*rpi
));
1788 if ((meas_req
->len
- 3 - sizeof(*rpi
)) != 0) {
1789 tprintf("Length of Req matchs not Type %u",
1794 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
1795 tprintf("Meas Start Time: %"PRIu64
", ",
1796 le64_to_cpu(rpi
->start
));
1797 tprintf("Meas Duration: %fs",
1798 le16_to_cpu(rpi
->dur
) * TU
);
1800 else if(meas_req
->type
== 3) {
1801 struct element_meas_ch_load
*ch_load
;
1803 ch_load
= (struct element_meas_ch_load
*)
1804 pkt_pull(pkt
, sizeof(*ch_load
));
1805 if (ch_load
== NULL
)
1808 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*ch_load
)) < 0) {
1809 tprintf("Length of Req matchs not Type %u",
1814 tprintf("OP Class: %u, ", ch_load
->op_class
);
1815 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
1816 tprintf("Rand Intv: %fs, ",
1817 le16_to_cpu(ch_load
->rand_intv
) * TU
);
1818 tprintf("Meas Duration: %fs",
1819 le16_to_cpu(ch_load
->dur
) * TU
);
1821 if(!subelements(pkt
,
1822 meas_req
->len
- 3 - sizeof(*ch_load
)))
1825 else if(meas_req
->type
== 4) {
1826 struct element_meas_noise
*noise
;
1828 noise
= (struct element_meas_noise
*)
1829 pkt_pull(pkt
, sizeof(*noise
));
1833 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*noise
)) < 0) {
1834 tprintf("Length of Req matchs not Type %u",
1839 tprintf("OP Class: %u, ", noise
->op_class
);
1840 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
1841 tprintf("Rand Intv: %fs, ",
1842 le16_to_cpu(noise
->rand_intv
) * TU
);
1843 tprintf("Meas Duration: %fs",
1844 le16_to_cpu(noise
->dur
) * TU
);
1846 if(!subelements(pkt
,
1847 meas_req
->len
- 3 - sizeof(*noise
)))
1850 else if(meas_req
->type
== 5) {
1851 struct element_meas_beacon
*beacon
;
1853 beacon
= (struct element_meas_beacon
*)
1854 pkt_pull(pkt
, sizeof(*beacon
));
1858 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*beacon
)) < 0) {
1859 tprintf("Length of Req matchs not Type %u",
1864 tprintf("OP Class: %u, ", beacon
->op_class
);
1865 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
1866 tprintf("Rand Intv: %fs, ",
1867 le16_to_cpu(beacon
->rand_intv
) * TU
);
1868 tprintf("Meas Duration: %fs",
1869 le16_to_cpu(beacon
->dur
) * TU
);
1870 tprintf("Mode: %u, ", beacon
->mode
);
1871 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1872 beacon
->bssid
[0], beacon
->bssid
[1],
1873 beacon
->bssid
[2], beacon
->bssid
[3],
1874 beacon
->bssid
[4], beacon
->bssid
[5]);
1876 if(!subelements(pkt
,
1877 meas_req
->len
- 3 - sizeof(*beacon
)))
1880 else if(meas_req
->type
== 6) {
1881 struct element_meas_frame
*frame
;
1883 frame
= (struct element_meas_frame
*)
1884 pkt_pull(pkt
, sizeof(*frame
));
1888 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*frame
)) < 0) {
1889 tprintf("Length of Req matchs not Type %u",
1894 tprintf("OP Class: %u, ", frame
->op_class
);
1895 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
1896 tprintf("Rand Intv: %fs, ",
1897 le16_to_cpu(frame
->rand_intv
) * TU
);
1898 tprintf("Meas Duration: %fs",
1899 le16_to_cpu(frame
->dur
) * TU
);
1900 tprintf("Request Type: %u, ", frame
->frame
);
1901 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1902 frame
->mac
[0], frame
->mac
[1],
1903 frame
->mac
[2], frame
->mac
[3],
1904 frame
->mac
[4], frame
->mac
[5]);
1906 if(!subelements(pkt
,
1907 meas_req
->len
- 3 - sizeof(*frame
)))
1910 else if(meas_req
->type
== 7) {
1911 struct element_meas_sta
*sta
;
1913 sta
= (struct element_meas_sta
*)
1914 pkt_pull(pkt
, sizeof(*sta
));
1918 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*sta
)) < 0) {
1919 tprintf("Length of Req matchs not Type %u",
1924 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1925 sta
->peer_mac
[0], sta
->peer_mac
[1],
1926 sta
->peer_mac
[2], sta
->peer_mac
[3],
1927 sta
->peer_mac
[4], sta
->peer_mac
[5]);
1928 tprintf("Rand Intv: %fs, ",
1929 le16_to_cpu(sta
->rand_intv
) * TU
);
1930 tprintf("Meas Duration: %fs",
1931 le16_to_cpu(sta
->dur
) * TU
);
1932 tprintf("Group ID: %u, ", sta
->group_id
);
1934 if(!subelements(pkt
,
1935 meas_req
->len
- 3 - sizeof(*sta
)))
1938 else if(meas_req
->type
== 8) {
1939 struct element_meas_lci
*lci
;
1941 lci
= (struct element_meas_lci
*)
1942 pkt_pull(pkt
, sizeof(*lci
));
1946 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*lci
)) < 0) {
1947 tprintf("Length of Req matchs not Type %u",
1952 tprintf("Location Subj: %u, ", lci
->loc_subj
);
1953 tprintf("Latitude Req Res: %udeg",
1954 lci
->latitude_req_res
);
1955 tprintf("Longitude Req Res: %udeg",
1956 lci
->longitude_req_res
);
1957 tprintf("Altitude Req Res: %udeg",
1958 lci
->altitude_req_res
);
1960 if(!subelements(pkt
,
1961 meas_req
->len
- 3 - sizeof(*lci
)))
1964 else if(meas_req
->type
== 9) {
1965 struct element_meas_trans_str_cat
*trans
;
1967 trans
= (struct element_meas_trans_str_cat
*)
1968 pkt_pull(pkt
, sizeof(*trans
));
1972 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*trans
)) < 0) {
1973 tprintf("Length of Req matchs not Type %u",
1978 tprintf("Rand Intv: %fs, ",
1979 le16_to_cpu(trans
->rand_intv
) * TU
);
1980 tprintf("Meas Duration: %fs",
1981 le16_to_cpu(trans
->dur
) * TU
);
1982 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
1983 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
1984 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
1985 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
1986 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
1987 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
1989 if(!subelements(pkt
,
1990 meas_req
->len
- 3 - sizeof(*trans
)))
1993 else if(meas_req
->type
== 10) {
1994 struct element_meas_mcast_diag
*mcast
;
1996 mcast
= (struct element_meas_mcast_diag
*)
1997 pkt_pull(pkt
, sizeof(*mcast
));
2001 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*mcast
)) < 0) {
2002 tprintf("Length of Req matchs not Type %u",
2007 tprintf("Rand Intv: %fs, ",
2008 le16_to_cpu(mcast
->rand_intv
) * TU
);
2009 tprintf("Meas Duration: %fs",
2010 le16_to_cpu(mcast
->dur
) * TU
);
2011 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2012 mcast
->group_mac
[0], mcast
->group_mac
[1],
2013 mcast
->group_mac
[2], mcast
->group_mac
[3],
2014 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2016 if(!subelements(pkt
,
2017 meas_req
->len
- 3 - sizeof(*mcast
)))
2020 else if(meas_req
->type
== 11) {
2021 struct element_meas_loc_civic
*civic
;
2023 civic
= (struct element_meas_loc_civic
*)
2024 pkt_pull(pkt
, sizeof(*civic
));
2028 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*civic
)) < 0) {
2029 tprintf("Length of Req matchs not Type %u",
2034 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2035 tprintf("Type: %u, ", civic
->civic_loc
);
2036 tprintf("Srv Intv Units: %u, ",
2037 le16_to_cpu(civic
->loc_srv_intv_unit
));
2038 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2040 if(!subelements(pkt
,
2041 meas_req
->len
- 3 - sizeof(*civic
)))
2044 else if(meas_req
->type
== 12) {
2045 struct element_meas_loc_id
*id
;
2047 id
= (struct element_meas_loc_id
*)
2048 pkt_pull(pkt
, sizeof(*id
));
2052 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*id
)) < 0) {
2053 tprintf("Length of Req matchs not Type %u",
2058 tprintf("Location Subj: %u, ", id
->loc_subj
);
2059 tprintf("Srv Intv Units: %u, ",
2060 le16_to_cpu(id
->loc_srv_intv_unit
));
2061 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2063 if(!subelements(pkt
,
2064 meas_req
->len
- 3 - sizeof(*id
)))
2067 else if(meas_req
->type
== 255) {
2068 struct element_meas_pause
*pause
;
2070 pause
= (struct element_meas_pause
*)
2071 pkt_pull(pkt
, sizeof(*pause
));
2075 if ((ssize_t
)(meas_req
->len
- 3 - sizeof(*pause
)) < 0) {
2076 tprintf("Length of Req matchs not Type %u",
2081 tprintf("Pause Time: %fs, ", pause
->time
* 10 * TU
);
2083 if(!subelements(pkt
,
2084 meas_req
->len
- 3 - sizeof(*pause
)))
2088 tprintf("Length field indicates data,"
2089 " but could not interpreted");
2097 static int8_t inf_meas_rep(struct pkt_buff
*pkt
, u8
*id
)
2099 struct element_meas_rep
*meas_rep
;
2101 meas_rep
= (struct element_meas_rep
*) pkt_pull(pkt
, sizeof(*meas_rep
));
2102 if (meas_rep
== NULL
)
2105 tprintf(" Measurement Rep (%u, Len(%u)): ", *id
, meas_rep
->len
);
2106 if (len_lt_error(meas_rep
->len
, 3))
2109 tprintf("Token: %u, ", meas_rep
->token
);
2110 tprintf("Rep Mode: 0x%x (Late (%u), Incapable(%u), Refused(%u), ",
2111 meas_rep
->rep_mode
, meas_rep
->rep_mode
>> 7,
2112 (meas_rep
->rep_mode
>> 6) & 0x1,
2113 (meas_rep
->rep_mode
>> 5) & 0x1);
2114 tprintf("Type: %s (%u), ", meas_type(meas_rep
->type
), meas_rep
->type
);
2116 if(meas_rep
->len
> 3) {
2117 if(meas_rep
->type
== 0) {
2118 struct element_meas_basic
*basic
;
2120 basic
= (struct element_meas_basic
*)
2121 pkt_pull(pkt
, sizeof(*basic
));
2125 if ((meas_rep
->len
- 3 - sizeof(*basic
)) != 0) {
2126 tprintf("Length of Req matchs not Type %u",
2131 tprintf("Ch Nr: %uus, ", basic
->ch_nr
);
2132 tprintf("Meas Start Time: %"PRIu64
", ",
2133 le64_to_cpu(basic
->start
));
2134 tprintf("Meas Duration: %fs",
2135 le16_to_cpu(basic
->dur
) * TU
);
2138 else if(meas_rep
->type
== 1) {
2139 struct element_meas_cca
*cca
;
2141 cca
= (struct element_meas_cca
*)
2142 pkt_pull(pkt
, sizeof(*cca
));
2146 if ((meas_rep
->len
- 3 - sizeof(*cca
)) != 0) {
2147 tprintf("Length of Req matchs not Type %u",
2152 tprintf("Ch Nr: %uus, ", cca
->ch_nr
);
2153 tprintf("Meas Start Time: %"PRIu64
", ",
2154 le64_to_cpu(cca
->start
));
2155 tprintf("Meas Duration: %fs",
2156 le16_to_cpu(cca
->dur
) * TU
);
2158 else if(meas_rep
->type
== 2) {
2159 struct element_meas_rpi
*rpi
;
2161 rpi
= (struct element_meas_rpi
*)
2162 pkt_pull(pkt
, sizeof(*rpi
));
2166 if ((meas_rep
->len
- 3 - sizeof(*rpi
)) != 0) {
2167 tprintf("Length of Req matchs not Type %u",
2172 tprintf("Ch Nr: %uus, ", rpi
->ch_nr
);
2173 tprintf("Meas Start Time: %"PRIu64
", ",
2174 le64_to_cpu(rpi
->start
));
2175 tprintf("Meas Duration: %fs",
2176 le16_to_cpu(rpi
->dur
) * TU
);
2178 else if(meas_rep
->type
== 3) {
2179 struct element_meas_ch_load
*ch_load
;
2181 ch_load
= (struct element_meas_ch_load
*)
2182 pkt_pull(pkt
, sizeof(*ch_load
));
2183 if (ch_load
== NULL
)
2186 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*ch_load
)) < 0) {
2187 tprintf("Length of Req matchs not Type %u",
2192 tprintf("OP Class: %u, ", ch_load
->op_class
);
2193 tprintf("Ch Nr: %u, ", ch_load
->ch_nr
);
2194 tprintf("Rand Intv: %fs, ",
2195 le16_to_cpu(ch_load
->rand_intv
) * TU
);
2196 tprintf("Meas Duration: %fs",
2197 le16_to_cpu(ch_load
->dur
) * TU
);
2199 if(!subelements(pkt
,
2200 meas_rep
->len
- 3 - sizeof(*ch_load
)))
2203 else if(meas_rep
->type
== 4) {
2204 struct element_meas_noise
*noise
;
2206 noise
= (struct element_meas_noise
*)
2207 pkt_pull(pkt
, sizeof(*noise
));
2211 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*noise
)) < 0) {
2212 tprintf("Length of Req matchs not Type %u",
2217 tprintf("OP Class: %u, ", noise
->op_class
);
2218 tprintf("Ch Nr: %u, ", noise
->ch_nr
);
2219 tprintf("Rand Intv: %fs, ",
2220 le16_to_cpu(noise
->rand_intv
) * TU
);
2221 tprintf("Meas Duration: %fs",
2222 le16_to_cpu(noise
->dur
) * TU
);
2224 if(!subelements(pkt
,
2225 meas_rep
->len
- 3 - sizeof(*noise
)))
2228 else if(meas_rep
->type
== 5) {
2229 struct element_meas_beacon
*beacon
;
2231 beacon
= (struct element_meas_beacon
*)
2232 pkt_pull(pkt
, sizeof(*beacon
));
2236 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*beacon
)) < 0) {
2237 tprintf("Length of Req matchs not Type %u",
2242 tprintf("OP Class: %u, ", beacon
->op_class
);
2243 tprintf("Ch Nr: %u, ", beacon
->ch_nr
);
2244 tprintf("Rand Intv: %fs, ",
2245 le16_to_cpu(beacon
->rand_intv
) * TU
);
2246 tprintf("Meas Duration: %fs",
2247 le16_to_cpu(beacon
->dur
) * TU
);
2248 tprintf("Mode: %u, ", beacon
->mode
);
2249 tprintf("BSSID: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2250 beacon
->bssid
[0], beacon
->bssid
[1],
2251 beacon
->bssid
[2], beacon
->bssid
[3],
2252 beacon
->bssid
[4], beacon
->bssid
[5]);
2254 if(!subelements(pkt
,
2255 meas_rep
->len
- 3 - sizeof(*beacon
)))
2258 else if(meas_rep
->type
== 6) {
2259 struct element_meas_frame
*frame
;
2261 frame
= (struct element_meas_frame
*)
2262 pkt_pull(pkt
, sizeof(*frame
));
2266 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*frame
)) < 0) {
2267 tprintf("Length of Req matchs not Type %u",
2272 tprintf("OP Class: %u, ", frame
->op_class
);
2273 tprintf("Ch Nr: %u, ", frame
->ch_nr
);
2274 tprintf("Rand Intv: %fs, ",
2275 le16_to_cpu(frame
->rand_intv
) * TU
);
2276 tprintf("Meas Duration: %fs",
2277 le16_to_cpu(frame
->dur
) * TU
);
2278 tprintf("Request Type: %u, ", frame
->frame
);
2279 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2280 frame
->mac
[0], frame
->mac
[1],
2281 frame
->mac
[2], frame
->mac
[3],
2282 frame
->mac
[4], frame
->mac
[5]);
2284 if(!subelements(pkt
,
2285 meas_rep
->len
- 3 - sizeof(*frame
)))
2288 else if(meas_rep
->type
== 7) {
2289 struct element_meas_sta
*sta
;
2291 sta
= (struct element_meas_sta
*)
2292 pkt_pull(pkt
, sizeof(*sta
));
2296 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*sta
)) < 0) {
2297 tprintf("Length of Req matchs not Type %u",
2302 tprintf("Peer MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2303 sta
->peer_mac
[0], sta
->peer_mac
[1],
2304 sta
->peer_mac
[2], sta
->peer_mac
[3],
2305 sta
->peer_mac
[4], sta
->peer_mac
[5]);
2306 tprintf("Rand Intv: %fs, ",
2307 le16_to_cpu(sta
->rand_intv
) * TU
);
2308 tprintf("Meas Duration: %fs",
2309 le16_to_cpu(sta
->dur
) * TU
);
2310 tprintf("Group ID: %u, ", sta
->group_id
);
2312 if(!subelements(pkt
,
2313 meas_rep
->len
- 3 - sizeof(*sta
)))
2316 else if(meas_rep
->type
== 8) {
2317 struct element_meas_lci
*lci
;
2319 lci
= (struct element_meas_lci
*)
2320 pkt_pull(pkt
, sizeof(*lci
));
2324 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*lci
)) < 0) {
2325 tprintf("Length of Req matchs not Type %u",
2330 tprintf("Location Subj: %u, ", lci
->loc_subj
);
2331 tprintf("Latitude Req Res: %udeg",
2332 lci
->latitude_req_res
);
2333 tprintf("Longitude Req Res: %udeg",
2334 lci
->longitude_req_res
);
2335 tprintf("Altitude Req Res: %udeg",
2336 lci
->altitude_req_res
);
2338 if(!subelements(pkt
,
2339 meas_rep
->len
- 3 - sizeof(*lci
)))
2342 else if(meas_rep
->type
== 9) {
2343 struct element_meas_trans_str_cat
*trans
;
2345 trans
= (struct element_meas_trans_str_cat
*)
2346 pkt_pull(pkt
, sizeof(*trans
));
2350 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*trans
)) < 0) {
2351 tprintf("Length of Req matchs not Type %u",
2356 tprintf("Rand Intv: %fs, ",
2357 le16_to_cpu(trans
->rand_intv
) * TU
);
2358 tprintf("Meas Duration: %fs",
2359 le16_to_cpu(trans
->dur
) * TU
);
2360 tprintf("MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2361 trans
->peer_sta_addr
[0], trans
->peer_sta_addr
[1],
2362 trans
->peer_sta_addr
[2], trans
->peer_sta_addr
[3],
2363 trans
->peer_sta_addr
[4], trans
->peer_sta_addr
[5]);
2364 tprintf("Traffic ID: %u, ", trans
->traffic_id
);
2365 tprintf("Bin 0 Range: %u, ", trans
->bin_0_range
);
2367 if(!subelements(pkt
,
2368 meas_rep
->len
- 3 - sizeof(*trans
)))
2371 else if(meas_rep
->type
== 10) {
2372 struct element_meas_mcast_diag
*mcast
;
2374 mcast
= (struct element_meas_mcast_diag
*)
2375 pkt_pull(pkt
, sizeof(*mcast
));
2379 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*mcast
)) < 0) {
2380 tprintf("Length of Req matchs not Type %u",
2385 tprintf("Rand Intv: %fs, ",
2386 le16_to_cpu(mcast
->rand_intv
) * TU
);
2387 tprintf("Meas Duration: %fs",
2388 le16_to_cpu(mcast
->dur
) * TU
);
2389 tprintf("Group MAC Addr: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
2390 mcast
->group_mac
[0], mcast
->group_mac
[1],
2391 mcast
->group_mac
[2], mcast
->group_mac
[3],
2392 mcast
->group_mac
[4], mcast
->group_mac
[5]);
2394 if(!subelements(pkt
,
2395 meas_rep
->len
- 3 - sizeof(*mcast
)))
2398 else if(meas_rep
->type
== 11) {
2399 struct element_meas_loc_civic
*civic
;
2401 civic
= (struct element_meas_loc_civic
*)
2402 pkt_pull(pkt
, sizeof(*civic
));
2406 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*civic
)) < 0) {
2407 tprintf("Length of Req matchs not Type %u",
2412 tprintf("Location Subj: %u, ", civic
->loc_subj
);
2413 tprintf("Type: %u, ", civic
->civic_loc
);
2414 tprintf("Srv Intv Units: %u, ",
2415 le16_to_cpu(civic
->loc_srv_intv_unit
));
2416 tprintf("Srv Intv: %u, ", civic
->loc_srv_intv
);
2418 if(!subelements(pkt
,
2419 meas_rep
->len
- 3 - sizeof(*civic
)))
2422 else if(meas_rep
->type
== 12) {
2423 struct element_meas_loc_id
*id
;
2425 id
= (struct element_meas_loc_id
*)
2426 pkt_pull(pkt
, sizeof(*id
));
2430 if ((ssize_t
)(meas_rep
->len
- 3 - sizeof(*id
)) < 0) {
2431 tprintf("Length of Req matchs not Type %u",
2436 tprintf("Location Subj: %u, ", id
->loc_subj
);
2437 tprintf("Srv Intv Units: %u, ",
2438 le16_to_cpu(id
->loc_srv_intv_unit
));
2439 tprintf("Srv Intv: %u", id
->loc_srv_intv
);
2441 if(!subelements(pkt
,
2442 meas_rep
->len
- 3 - sizeof(*id
)))
2446 tprintf("Length field indicates data,"
2447 " but could not interpreted");
2455 static int8_t inf_quiet(struct pkt_buff
*pkt
, u8
*id
)
2457 struct element_quiet
*quiet
;
2459 quiet
= (struct element_quiet
*) pkt_pull(pkt
, sizeof(*quiet
));
2463 tprintf(" Quit (%u, Len(%u)): ", *id
, quiet
->len
);
2464 if (len_neq_error(quiet
->len
, 6))
2467 tprintf("Count: %ud, ", quiet
->cnt
);
2468 tprintf("Period: %u, ", quiet
->period
);
2469 tprintf("Duration: %fs, ", le16_to_cpu(quiet
->dur
) * TU
);
2470 tprintf("Offs: %fs", le16_to_cpu(quiet
->offs
) * TU
);
2476 static int8_t inf_ibss_dfs(struct pkt_buff
*pkt
, u8
*id
)
2478 struct element_ibss_dfs
*ibss_dfs
;
2481 ibss_dfs
= (struct element_ibss_dfs
*) pkt_pull(pkt
, sizeof(*ibss_dfs
));
2482 if (ibss_dfs
== NULL
)
2485 tprintf(" IBSS DFS (%u, Len(%u)): ", *id
, ibss_dfs
->len
);
2486 if (len_lt_error(ibss_dfs
->len
, 7))
2489 tprintf("Owner: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x, ",
2490 ibss_dfs
->owner
[0], ibss_dfs
->owner
[1],
2491 ibss_dfs
->owner
[2], ibss_dfs
->owner
[3],
2492 ibss_dfs
->owner
[4], ibss_dfs
->owner
[5]);
2493 tprintf("Recovery Intv: %u, ", ibss_dfs
->rec_intv
);
2495 if((ibss_dfs
->len
- sizeof(*ibss_dfs
) + 1) & 1) {
2496 tprintf("Length of Channel Map should be modulo 2");
2500 for (i
= 0; i
< ibss_dfs
->len
; i
+= 2) {
2501 struct element_ibss_dfs_tuple
*ibss_dfs_tuple
;
2503 ibss_dfs_tuple
= (struct element_ibss_dfs_tuple
*)
2504 pkt_pull(pkt
, sizeof(*ibss_dfs_tuple
));
2505 if (ibss_dfs_tuple
== NULL
)
2508 tprintf("Channel Nr: %u, ", ibss_dfs_tuple
->ch_nr
);
2509 tprintf("Map: %u, ", ibss_dfs_tuple
->map
);
2515 static int8_t inf_erp(struct pkt_buff
*pkt
, u8
*id
)
2517 struct element_erp
*erp
;
2519 erp
= (struct element_erp
*) pkt_pull(pkt
, sizeof(*erp
));
2523 tprintf(" ERP (%u, Len(%u)): ", *id
, erp
->len
);
2524 if (len_neq_error(erp
->len
, 1))
2526 tprintf("Non ERP Present (%u), ", erp
->param
& 0x1);
2527 tprintf("Use Protection (%u), ", (erp
->param
>> 1) & 0x1);
2528 tprintf("Barker Preamble Mode (%u), ", (erp
->param
>> 2) & 0x1);
2529 tprintf("Reserved (0x%.5x)", erp
->param
>> 3);
2534 static int8_t inf_ts_del(struct pkt_buff
*pkt
, u8
*id
)
2536 struct element_ts_del
*ts_del
;
2538 ts_del
= (struct element_ts_del
*) pkt_pull(pkt
, sizeof(*ts_del
));
2542 tprintf(" TS Delay (%u, Len(%u)): ", *id
, ts_del
->len
);
2543 if (len_neq_error(ts_del
->len
, 4))
2545 tprintf("Delay (%fs)", le32_to_cpu(ts_del
->delay
) * TU
);
2550 static int8_t inf_tclas_proc(struct pkt_buff
*pkt
, u8
*id
)
2552 struct element_tclas_proc
*tclas_proc
;
2554 tclas_proc
= (struct element_tclas_proc
*)
2555 pkt_pull(pkt
, sizeof(*tclas_proc
));
2556 if (tclas_proc
== NULL
)
2559 tprintf(" TCLAS Procesing (%u, Len(%u)): ", *id
, tclas_proc
->len
);
2560 if (len_neq_error(tclas_proc
->len
, 1))
2562 tprintf("Processing (%u)", tclas_proc
->proc
);
2567 static int8_t inf_ht_cap(struct pkt_buff
*pkt
, u8
*id
)
2569 struct element_ht_cap
*ht_cap
;
2570 u32 tx_param_res
, beam_cap
;
2573 ht_cap
= (struct element_ht_cap
*)
2574 pkt_pull(pkt
, sizeof(*ht_cap
));
2578 tx_param_res
= le32_to_cpu(ht_cap
->tx_param_res
);
2579 beam_cap
= le32_to_cpu(ht_cap
->beam_cap
);
2580 ext_cap
= le16_to_cpu(ht_cap
->ext_cap
);
2582 tprintf(" HT Capabilities (%u, Len(%u)):\n", *id
, ht_cap
->len
);
2583 if (len_neq_error(ht_cap
->len
, 26))
2586 tprintf("\t\t Info:\n");
2587 tprintf("\t\t\t LDCP Cod Cap (%u)\n", ht_cap
->ldpc
);
2588 tprintf("\t\t\t Supp Ch Width Set (%u)\n", ht_cap
->supp_width
);
2589 tprintf("\t\t\t SM Pwr Save(%u)\n", ht_cap
->sm_pwr
);
2590 tprintf("\t\t\t HT-Greenfield (%u)\n", ht_cap
->ht_green
);
2591 tprintf("\t\t\t Short GI for 20/40 MHz (%u/%u)\n", ht_cap
->gi_20mhz
,
2593 tprintf("\t\t\t Tx/Rx STBC (%u/%u)\n", ht_cap
->tx_stbc
,
2595 tprintf("\t\t\t HT-Delayed Block Ack (%u)\n", ht_cap
->ht_ack
);
2596 tprintf("\t\t\t Max A-MSDU Len (%u)\n", ht_cap
->max_msdu_length
);
2597 tprintf("\t\t\t DSSS/CCK Mode in 40 MHz (%u)\n",
2598 ht_cap
->dsss_ck_mode
);
2599 tprintf("\t\t\t Res (0x%x)\n", ht_cap
->res
);
2600 tprintf("\t\t\t Forty MHz Intol (%u)\n", ht_cap
->forty_int
);
2601 tprintf("\t\t\t L-SIG TXOP Protection Supp (%u)\n",
2604 tprintf("\t\t A-MPDU Params:\n");
2605 tprintf("\t\t\t Max Len Exp (%u)\n", ht_cap
->param
>> 6);
2606 tprintf("\t\t\t Min Start Spacing (%u)\n",
2607 (ht_cap
->param
>> 3) & 0x7);
2608 tprintf("\t\t\t Res (0x%x)\n", ht_cap
->param
& 0x07);
2610 tprintf("\t\t Supp MCS Set:\n");
2611 tprintf("\t\t\t Rx MCS Bitmask (0x%x%x%x%x%x%x%x%x%x%x)\n",
2612 ht_cap
->bitmask1
, ht_cap
->bitmask2
, ht_cap
->bitmask3
,
2613 ht_cap
->bitmask4
, ht_cap
->bitmask5
, ht_cap
->bitmask6
,
2614 ht_cap
->bitmask7
, ht_cap
->bitmask8
, ht_cap
->bitmask9
,
2615 ht_cap
->bitmask10_res
>> 3);
2616 tprintf("\t\t\t Res (0x%x)\n", ht_cap
->bitmask10_res
& 0x7);
2617 tprintf("\t\t\t Rx High Supp Data Rate (%u)\n",
2618 le16_to_cpu(ht_cap
->supp_rate_res
) >> 6);
2619 tprintf("\t\t\t Res (0x%x)\n",
2620 le16_to_cpu(ht_cap
->supp_rate_res
) & 0x3F);
2621 tprintf("\t\t\t Tx MCS Set Def (%u)\n", tx_param_res
>> 31);
2622 tprintf("\t\t\t Tx Rx MCS Set Not Eq (%u)\n",
2623 (tx_param_res
>> 30) & 1);
2624 tprintf("\t\t\t Tx Max Number Spat Str Supp (%u)\n",
2625 (tx_param_res
>> 28) & 3);
2626 tprintf("\t\t\t Tx Uneq Mod Supp (%u)\n", (tx_param_res
>> 27) & 1);
2627 tprintf("\t\t\t Res (0x%x)\n", tx_param_res
& 0x7FFFFFF);
2629 tprintf("\t\t Ext Cap:\n");
2630 tprintf("\t\t\t PCO (%u)\n", ext_cap
>> 15);
2631 tprintf("\t\t\t PCO Trans Time (%u)\n", (ext_cap
>> 13) & 3);
2632 tprintf("\t\t\t Res (0x%x)\n", (ext_cap
>> 8) & 0x1F);
2633 tprintf("\t\t\t MCS Feedb (%u)\n", (ext_cap
>> 6) & 3);
2634 tprintf("\t\t\t +HTC Supp (%u)\n", (ext_cap
>> 5) & 1);
2635 tprintf("\t\t\t RD Resp (%u)\n", (ext_cap
>> 4) & 1);
2636 tprintf("\t\t\t Res (0x%x)\n", ext_cap
& 0xF);
2638 tprintf("\t\t Transm Beamf:\n");
2639 tprintf("\t\t\t Impl Transm Beamf Rec Cap (%u)\n", beam_cap
>> 31);
2640 tprintf("\t\t\t Rec/Transm Stagg Sound Cap (%u/%u)\n",
2641 (beam_cap
>> 30) & 1, (beam_cap
>> 29) & 1);
2642 tprintf("\t\t\t Rec/Trans NDP Cap (%u/%u)\n",
2643 (beam_cap
>> 28) & 1, (beam_cap
>> 27) & 1);
2644 tprintf("\t\t\t Impl Transm Beamf Cap (%u)\n", (beam_cap
>> 26) & 1);
2645 tprintf("\t\t\t Cal (%u)\n", (beam_cap
>> 24) & 3);
2646 tprintf("\t\t\t Expl CSI Transm Beamf Cap (%u)\n",
2647 (beam_cap
>> 23) & 1);
2648 tprintf("\t\t\t Expl Noncmpr/Compr Steering Cap (%u/%u)\n",
2649 (beam_cap
>> 22) & 1, (beam_cap
>> 21) & 1);
2650 tprintf("\t\t\t Expl Trans Beamf CSI Feedb (%u)\n",
2651 (beam_cap
>> 19) & 3);
2652 tprintf("\t\t\t Expl Noncmpr/Cmpr Feedb Cap (%u/%u)\n",
2653 (beam_cap
>> 17) & 3, (beam_cap
>> 15) & 3);
2654 tprintf("\t\t\t Min Grpg (%u)\n", (beam_cap
>> 13) & 3);
2655 tprintf("\t\t\t CSI Num Beamf Ant Supp (%u)\n", (beam_cap
>> 11) & 3);
2656 tprintf("\t\t\t Noncmpr/Cmpr Steering Nr Beamf Ant Supp (%u/%u)\n",
2657 (beam_cap
>> 9) & 3, (beam_cap
>> 7) & 3);
2658 tprintf("\t\t\t CSI Max Nr Rows Beamf Supp (%u)\n",
2659 (beam_cap
>> 5) & 3);
2660 tprintf("\t\t\t Ch Estim Cap (%u)\n", (beam_cap
>> 3) & 3);
2661 tprintf("\t\t\t Res (0x%x)\n", beam_cap
& 7);
2663 tprintf("\t\t ASEL:\n");
2664 tprintf("\t\t\t Ant Select Cap (%u)\n", ht_cap
->asel_cap
>> 7);
2665 tprintf("\t\t\t Expl CSI Feedb Based Transm ASEL Cap (%u)\n",
2666 (ht_cap
->asel_cap
>> 6) & 1);
2667 tprintf("\t\t\t Ant Indic Feedb Based Transm ASEL Cap (%u)\n",
2668 (ht_cap
->asel_cap
>> 5) & 1);
2669 tprintf("\t\t\t Expl CSI Feedb Cap (%u)\n",
2670 (ht_cap
->asel_cap
>> 4) & 1);
2671 tprintf("\t\t\t Ant Indic Feedb Cap (%u)\n",
2672 (ht_cap
->asel_cap
>> 3) & 1);
2673 tprintf("\t\t\t Rec ASEL Cap (%u)\n", (ht_cap
->asel_cap
>> 2) & 1);
2674 tprintf("\t\t\t Transm Sound PPDUs Cap (%u)\n",
2675 (ht_cap
->asel_cap
>> 1) & 1);
2676 tprintf("\t\t\t Res (0x%x)", ht_cap
->asel_cap
& 1);
2681 static int8_t inf_qos_cap(struct pkt_buff
*pkt
, u8
*id
)
2683 struct element_qos_cap
*qos_cap
;
2685 qos_cap
= (struct element_qos_cap
*)
2686 pkt_pull(pkt
, sizeof(*qos_cap
));
2687 if (qos_cap
== NULL
)
2690 tprintf(" QoS Capabilities (%u, Len(%u)): ", *id
, qos_cap
->len
);
2691 if (len_neq_error(qos_cap
->len
, 1))
2694 tprintf("Info (0x%x)", qos_cap
->info
);
2699 static int8_t inf_ext_supp_rates(struct pkt_buff
*pkt
, u8
*id
)
2703 struct element_ext_supp_rates
*ext_supp_rates
;
2705 ext_supp_rates
= (struct element_ext_supp_rates
*)
2706 pkt_pull(pkt
, sizeof(*ext_supp_rates
));
2707 if (ext_supp_rates
== NULL
)
2710 tprintf(" Ext Support Rates (%u, Len(%u)): ", *id
, ext_supp_rates
->len
);
2712 if ((ext_supp_rates
->len
- sizeof(*ext_supp_rates
) + 1) > 0) {
2713 rates
= pkt_pull(pkt
, ext_supp_rates
->len
);
2717 for (i
= 0; i
< ext_supp_rates
->len
; i
++)
2718 tprintf("%g ", (rates
[i
] & 0x80) ?
2719 ((rates
[i
] & 0x3f) * 0.5) :
2720 data_rates(rates
[i
]));
2727 static int8_t inf_vend_spec(struct pkt_buff
*pkt
, u8
*id
)
2731 struct element_vend_spec
*vend_spec
;
2733 vend_spec
= (struct element_vend_spec
*)
2734 pkt_pull(pkt
, sizeof(*vend_spec
));
2735 if (vend_spec
== NULL
)
2738 tprintf(" Vendor Specific (%u, Len (%u)): ", *id
, vend_spec
->len
);
2740 data
= pkt_pull(pkt
, vend_spec
->len
);
2745 for (i
= 0; i
< vend_spec
->len
; i
++)
2746 tprintf("%.2x", data
[i
]);
2751 static int8_t inf_unimplemented(struct pkt_buff
*pkt __maybe_unused
,
2752 u8
*id __maybe_unused
)
2757 static int8_t inf_elements(struct pkt_buff
*pkt
)
2759 u8
*id
= pkt_pull(pkt
, 1);
2764 case 0: return inf_ssid(pkt
, id
);
2765 case 1: return inf_supp_rates(pkt
, id
);
2766 case 2: return inf_fh_ps(pkt
, id
);
2767 case 3: return inf_dsss_ps(pkt
, id
);
2768 case 4: return inf_cf_ps(pkt
, id
);
2769 case 5: return inf_tim(pkt
, id
);
2770 case 6: return inf_ibss_ps(pkt
, id
);
2771 case 7: return inf_country(pkt
, id
);
2772 case 8: return inf_hop_pp(pkt
, id
);
2773 case 9: return inf_hop_pt(pkt
, id
);
2774 case 10: return inf_req(pkt
, id
);
2775 case 11: return inf_bss_load(pkt
, id
);
2776 case 12: return inf_edca_ps(pkt
, id
);
2777 case 13: return inf_tspec(pkt
, id
);
2778 case 14: return inf_tclas(pkt
, id
);
2779 case 15: return inf_sched(pkt
, id
);
2780 case 16: return inf_chall_txt(pkt
, id
);
2781 case 17 ... 31: return inf_reserved(pkt
, id
);
2782 case 32: return inf_pwr_constr(pkt
, id
);
2783 case 33: return inf_pwr_cap(pkt
, id
);
2784 case 34: return inf_tpc_req(pkt
, id
);
2785 case 35: return inf_tpc_rep(pkt
, id
);
2786 case 36: return inf_supp_ch(pkt
, id
);
2787 case 37: return inf_ch_sw_ann(pkt
, id
);
2788 case 38: return inf_meas_req(pkt
, id
);
2789 case 39: return inf_meas_rep(pkt
, id
);
2790 case 40: return inf_quiet(pkt
, id
);
2791 case 41: return inf_ibss_dfs(pkt
, id
);
2792 case 42: return inf_erp(pkt
, id
);
2793 case 43: return inf_ts_del(pkt
, id
);
2794 case 44: return inf_tclas_proc(pkt
, id
);
2795 case 45: return inf_ht_cap(pkt
, id
);
2796 case 46: return inf_qos_cap(pkt
, id
);
2797 case 47: return inf_reserved(pkt
, id
);
2798 case 48: return inf_unimplemented(pkt
, id
);
2799 case 49: return inf_unimplemented(pkt
, id
);
2800 case 50: return inf_ext_supp_rates(pkt
, id
);
2801 case 51: return inf_unimplemented(pkt
, id
);
2802 case 52: return inf_unimplemented(pkt
, id
);
2803 case 53: return inf_unimplemented(pkt
, id
);
2804 case 54: return inf_unimplemented(pkt
, id
);
2805 case 55: return inf_unimplemented(pkt
, id
);
2806 case 56: return inf_unimplemented(pkt
, id
);
2807 case 57: return inf_unimplemented(pkt
, id
);
2808 case 58: return inf_unimplemented(pkt
, id
);
2809 case 59: return inf_unimplemented(pkt
, id
);
2810 case 60: return inf_unimplemented(pkt
, id
);
2811 case 61: return inf_unimplemented(pkt
, id
);
2812 case 62: return inf_unimplemented(pkt
, id
);
2813 case 63: return inf_unimplemented(pkt
, id
);
2814 case 64: return inf_unimplemented(pkt
, id
);
2815 case 65: return inf_unimplemented(pkt
, id
);
2816 case 66: return inf_unimplemented(pkt
, id
);
2817 case 67: return inf_unimplemented(pkt
, id
);
2818 case 68: return inf_unimplemented(pkt
, id
);
2819 case 69: return inf_unimplemented(pkt
, id
);
2820 case 70: return inf_unimplemented(pkt
, id
);
2821 case 71: return inf_unimplemented(pkt
, id
);
2822 case 72: return inf_unimplemented(pkt
, id
);
2823 case 73: return inf_unimplemented(pkt
, id
);
2824 case 74: return inf_unimplemented(pkt
, id
);
2825 case 75: return inf_unimplemented(pkt
, id
);
2826 case 76: return inf_unimplemented(pkt
, id
);
2827 case 78: return inf_unimplemented(pkt
, id
);
2828 case 79: return inf_unimplemented(pkt
, id
);
2829 case 80: return inf_unimplemented(pkt
, id
);
2830 case 81: return inf_unimplemented(pkt
, id
);
2831 case 82: return inf_unimplemented(pkt
, id
);
2832 case 83: return inf_unimplemented(pkt
, id
);
2833 case 84: return inf_unimplemented(pkt
, id
);
2834 case 85: return inf_unimplemented(pkt
, id
);
2835 case 86: return inf_unimplemented(pkt
, id
);
2836 case 87: return inf_unimplemented(pkt
, id
);
2837 case 88: return inf_unimplemented(pkt
, id
);
2838 case 89: return inf_unimplemented(pkt
, id
);
2839 case 90: return inf_unimplemented(pkt
, id
);
2840 case 91: return inf_unimplemented(pkt
, id
);
2841 case 92: return inf_unimplemented(pkt
, id
);
2842 case 93: return inf_unimplemented(pkt
, id
);
2843 case 94: return inf_unimplemented(pkt
, id
);
2844 case 95: return inf_unimplemented(pkt
, id
);
2845 case 96: return inf_unimplemented(pkt
, id
);
2846 case 97: return inf_unimplemented(pkt
, id
);
2847 case 98: return inf_unimplemented(pkt
, id
);
2848 case 99: return inf_unimplemented(pkt
, id
);
2849 case 100: return inf_unimplemented(pkt
, id
);
2850 case 101: return inf_unimplemented(pkt
, id
);
2851 case 102: return inf_unimplemented(pkt
, id
);
2852 case 104: return inf_unimplemented(pkt
, id
);
2853 case 105: return inf_unimplemented(pkt
, id
);
2854 case 106: return inf_unimplemented(pkt
, id
);
2855 case 107: return inf_unimplemented(pkt
, id
);
2856 case 108: return inf_unimplemented(pkt
, id
);
2857 case 109: return inf_unimplemented(pkt
, id
);
2858 case 110: return inf_unimplemented(pkt
, id
);
2859 case 111: return inf_unimplemented(pkt
, id
);
2860 case 112: return inf_unimplemented(pkt
, id
);
2861 case 113: return inf_unimplemented(pkt
, id
);
2862 case 114: return inf_unimplemented(pkt
, id
);
2863 case 115: return inf_unimplemented(pkt
, id
);
2864 case 116: return inf_unimplemented(pkt
, id
);
2865 case 117: return inf_unimplemented(pkt
, id
);
2866 case 118: return inf_unimplemented(pkt
, id
);
2867 case 119: return inf_unimplemented(pkt
, id
);
2868 case 120: return inf_unimplemented(pkt
, id
);
2869 case 121: return inf_unimplemented(pkt
, id
);
2870 case 122: return inf_unimplemented(pkt
, id
);
2871 case 123: return inf_unimplemented(pkt
, id
);
2872 case 124: return inf_unimplemented(pkt
, id
);
2873 case 125: return inf_unimplemented(pkt
, id
);
2874 case 126: return inf_unimplemented(pkt
, id
);
2875 case 127: return inf_unimplemented(pkt
, id
);
2876 case 128: return inf_reserved(pkt
, id
);
2877 case 129: return inf_reserved(pkt
, id
);
2878 case 130: return inf_unimplemented(pkt
, id
);
2879 case 131: return inf_unimplemented(pkt
, id
);
2880 case 132: return inf_unimplemented(pkt
, id
);
2881 case 133: return inf_reserved(pkt
, id
);
2882 case 134: return inf_reserved(pkt
, id
);
2883 case 135: return inf_reserved(pkt
, id
);
2884 case 136: return inf_reserved(pkt
, id
);
2885 case 137: return inf_unimplemented(pkt
, id
);
2886 case 138: return inf_unimplemented(pkt
, id
);
2887 case 139: return inf_unimplemented(pkt
, id
);
2888 case 140: return inf_unimplemented(pkt
, id
);
2889 case 141: return inf_unimplemented(pkt
, id
);
2890 case 142: return inf_unimplemented(pkt
, id
);
2891 case 143 ... 173: return inf_reserved(pkt
, id
);
2892 case 174: return inf_unimplemented(pkt
, id
);
2893 case 221: return inf_vend_spec(pkt
, id
);
2901 #define CF_Pollable 0x0004
2902 #define CF_Poll_Req 0x0008
2903 #define Privacy 0x0010
2904 #define Short_Pre 0x0020
2906 #define Ch_Agility 0x0080
2907 #define Spec_Mgmt 0x0100
2909 #define Short_Slot_t 0x0400
2911 #define Radio_Meas 0x1000
2912 #define DSSS_OFDM 0x2000
2913 #define Del_Block_ACK 0x4000
2914 #define Imm_Block_ACK 0x8000
2916 static int8_t cap_field(u16 cap_inf
)
2922 if (CF_Pollable
& cap_inf
)
2923 tprintf(" CF Pollable;");
2924 if (CF_Poll_Req
& cap_inf
)
2925 tprintf(" CF-Poll Request;");
2926 if (Privacy
& cap_inf
)
2927 tprintf(" Privacy;");
2928 if (Short_Pre
& cap_inf
)
2929 tprintf(" Short Preamble;");
2932 if (Ch_Agility
& cap_inf
)
2933 tprintf(" Channel Agility;");
2934 if (Spec_Mgmt
& cap_inf
)
2935 tprintf(" Spectrum Management;");
2938 if (Short_Slot_t
& cap_inf
)
2939 tprintf(" Short Slot Time;");
2942 if (Radio_Meas
& cap_inf
)
2943 tprintf(" Radio Measurement;");
2944 if (DSSS_OFDM
& cap_inf
)
2945 tprintf(" DSSS-OFDM;");
2946 if (Del_Block_ACK
& cap_inf
)
2947 tprintf(" Delayed Block Ack;");
2948 if (Imm_Block_ACK
& cap_inf
)
2949 tprintf(" Immediate Block Ack;");
2954 static void print_inf_elements(struct pkt_buff
*pkt
)
2961 } while (inf_elements(pkt
));
2965 /* Management Dissectors */
2966 static int8_t mgmt_beacon_dissect(struct pkt_buff
*pkt
)
2968 struct ieee80211_mgmt_beacon
*beacon
;
2970 beacon
= (struct ieee80211_mgmt_beacon
*)
2971 pkt_pull(pkt
, sizeof(*beacon
));
2975 tprintf("Timestamp 0x%.16"PRIx64
", ", le64_to_cpu(beacon
->timestamp
));
2976 tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon
->beacon_int
)*TU
);
2977 tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon
->capab_info
));
2978 cap_field(le16_to_cpu(beacon
->capab_info
));
2981 print_inf_elements(pkt
);
2989 static int8_t mgmt_probe_request_dissect(struct pkt_buff
*pkt
)
2991 print_inf_elements(pkt
);
2999 static int8_t mgmt_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
3003 /* End Management Dissectors */
3005 /* Control Dissectors */
3006 static int8_t ctrl_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
3010 /* End Control Dissectors */
3012 /* Data Dissectors */
3013 static int8_t data_unimplemented(struct pkt_buff
*pkt __maybe_unused
)
3017 /* End Data Dissectors */
3019 static const char *mgt_sub(u8 subtype
, struct pkt_buff
*pkt
,
3020 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3023 struct ieee80211_mgmt
*mgmt
;
3024 const char *dst
, *src
, *bssid
;
3026 mgmt
= (struct ieee80211_mgmt
*) pkt_pull(pkt
, sizeof(*mgmt
));
3030 dst
= lookup_vendor((mgmt
->da
[0] << 16) |
3031 (mgmt
->da
[1] << 8) |
3033 src
= lookup_vendor((mgmt
->sa
[0] << 16) |
3034 (mgmt
->sa
[1] << 8) |
3037 bssid
= lookup_vendor((mgmt
->bssid
[0] << 16) |
3038 (mgmt
->bssid
[1] << 8) |
3040 seq_ctrl
= le16_to_cpu(mgmt
->seq_ctrl
);
3042 tprintf("Duration (%u),", le16_to_cpu(mgmt
->duration
));
3043 tprintf("\n\tDestination (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3044 mgmt
->da
[0], mgmt
->da
[1], mgmt
->da
[2],
3045 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3047 tprintf("=> (%s:%.2x:%.2x:%.2x)", dst
,
3048 mgmt
->da
[3], mgmt
->da
[4], mgmt
->da
[5]);
3051 tprintf("\n\tSource (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3052 mgmt
->sa
[0], mgmt
->sa
[1], mgmt
->sa
[2],
3053 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3055 tprintf("=> (%s:%.2x:%.2x:%.2x)", src
,
3056 mgmt
->sa
[3], mgmt
->sa
[4], mgmt
->sa
[5]);
3059 tprintf("\n\tBSSID (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x) ",
3060 mgmt
->bssid
[0], mgmt
->bssid
[1], mgmt
->bssid
[2],
3061 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3063 tprintf("=> (%s:%.2x:%.2x:%.2x)", bssid
,
3064 mgmt
->bssid
[3], mgmt
->bssid
[4], mgmt
->bssid
[5]);
3067 tprintf("\n\tFragmentnr. (%u), Seqnr. (%u). ",
3068 seq_ctrl
& 0xf, seq_ctrl
>> 4);
3072 *get_content
= mgmt_unimplemented
;
3073 return "Association Request";
3075 *get_content
= mgmt_unimplemented
;
3076 return "Association Response";
3078 *get_content
= mgmt_unimplemented
;
3079 return "Reassociation Request";
3081 *get_content
= mgmt_unimplemented
;
3082 return "Reassociation Response";
3084 *get_content
= mgmt_probe_request_dissect
;
3085 return "Probe Request";
3087 /* Probe Response is very similar to Beacon except some IEs */
3088 *get_content
= mgmt_beacon_dissect
;
3089 return "Probe Response";
3091 *get_content
= mgmt_beacon_dissect
;
3094 *get_content
= mgmt_unimplemented
;
3097 *get_content
= mgmt_unimplemented
;
3098 return "Disassociation";
3100 *get_content
= mgmt_unimplemented
;
3101 return "Authentication";
3103 *get_content
= mgmt_unimplemented
;
3104 return "Deauthentication";
3106 *get_content
= NULL
;
3111 static const char *ctrl_sub(u8 subtype
, struct pkt_buff
*pkt __maybe_unused
,
3112 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3116 *get_content
= ctrl_unimplemented
;
3119 *get_content
= ctrl_unimplemented
;
3122 *get_content
= ctrl_unimplemented
;
3125 *get_content
= ctrl_unimplemented
;
3128 *get_content
= ctrl_unimplemented
;
3131 *get_content
= ctrl_unimplemented
;
3132 return "CF End + CF-ACK";
3134 *get_content
= NULL
;
3139 static const char *data_sub(u8 subtype
, struct pkt_buff
*pkt __maybe_unused
,
3140 int8_t (**get_content
)(struct pkt_buff
*pkt
))
3144 *get_content
= data_unimplemented
;
3147 *get_content
= data_unimplemented
;
3148 return "Data + CF-ACK";
3150 *get_content
= data_unimplemented
;
3151 return "Data + CF-Poll";
3153 *get_content
= data_unimplemented
;
3154 return "Data + CF-ACK + CF-Poll";
3156 *get_content
= data_unimplemented
;
3159 *get_content
= data_unimplemented
;
3162 *get_content
= data_unimplemented
;
3165 *get_content
= data_unimplemented
;
3166 return "CF-ACK + CF-Poll";
3168 *get_content
= NULL
;
3174 frame_control_type(u8 type
, const char *(**get_subtype
)(u8 subtype
,
3175 struct pkt_buff
*pkt
, int8_t (**get_content
)(struct pkt_buff
*pkt
)))
3179 *get_subtype
= mgt_sub
;
3180 return "Management";
3182 *get_subtype
= ctrl_sub
;
3185 *get_subtype
= data_sub
;
3188 *get_subtype
= NULL
;
3191 *get_subtype
= NULL
;
3192 return "Control Type unknown";
3196 static void ieee80211(struct pkt_buff
*pkt
)
3198 int8_t (*get_content
)(struct pkt_buff
*pkt
) = NULL
;
3199 const char *(*get_subtype
)(u8 subtype
, struct pkt_buff
*pkt
,
3200 int8_t (**get_content
)(struct pkt_buff
*pkt
)) = NULL
;
3201 const char *subtype
= NULL
;
3202 struct ieee80211_frm_ctrl
*frm_ctrl
;
3204 if (pkt
->link_type
== LINKTYPE_IEEE802_11_RADIOTAP
) {
3205 struct ieee80211_radiotap_header
*rtap
;
3207 rtap
= (struct ieee80211_radiotap_header
*)pkt_pull(pkt
,
3212 tprintf(" [ Radiotap ");
3213 tprintf("Version (%u), ", rtap
->version
);
3214 tprintf("Length (%u), ", le16_to_cpu(rtap
->len
));
3215 tprintf("Flags (0x%08x) ]\n", le32_to_cpu(rtap
->present
));
3217 pkt_pull(pkt
, le16_to_cpu(rtap
->len
) - sizeof(*rtap
));
3220 frm_ctrl
= (struct ieee80211_frm_ctrl
*)pkt_pull(pkt
, sizeof(*frm_ctrl
));
3221 if (frm_ctrl
== NULL
)
3224 tprintf(" [ 802.11 Frame Control (0x%04x)]\n",
3225 le16_to_cpu(frm_ctrl
->frame_control
));
3227 tprintf(" [ Proto Version (%u), ", frm_ctrl
->proto_version
);
3228 tprintf("Type (%u, %s), ", frm_ctrl
->type
,
3229 frame_control_type(frm_ctrl
->type
, &get_subtype
));
3231 subtype
= (*get_subtype
)(frm_ctrl
->subtype
, pkt
, &get_content
);
3232 tprintf("Subtype (%u, %s)", frm_ctrl
->subtype
, subtype
);
3234 tprintf("%s%s%s", colorize_start_full(black
, red
),
3235 "No SubType Data available", colorize_end());
3238 tprintf("%s%s", frm_ctrl
->to_ds
? ", Frame goes to DS" : "",
3239 frm_ctrl
->from_ds
? ", Frame comes from DS" : "");
3240 tprintf("%s", frm_ctrl
->more_frags
? ", More Fragments" : "");
3241 tprintf("%s", frm_ctrl
->retry
? ", Frame is retransmitted" : "");
3242 tprintf("%s", frm_ctrl
->power_mgmt
? ", In Power Saving Mode" : "");
3243 tprintf("%s", frm_ctrl
->more_data
? ", More Data" : "");
3244 tprintf("%s", frm_ctrl
->wep
? ", Needs WEP" : "");
3245 tprintf("%s", frm_ctrl
->order
? ", Order" : "");
3249 tprintf(" [ Subtype %s: ", subtype
);
3250 if (!((*get_content
) (pkt
)))
3251 tprintf("%s%s%s", colorize_start_full(black
, red
),
3252 "Failed to dissect Subtype", colorize_end());
3255 tprintf("%s%s%s", colorize_start_full(black
, red
),
3256 "No SubType Data available", colorize_end());
3261 // pkt_set_dissector(pkt, &ieee802_lay2, ntohs(eth->h_proto));
3264 static void ieee80211_less(struct pkt_buff
*pkt __maybe_unused
)
3266 tprintf("802.11 frame (more on todo)");
3269 struct protocol ieee80211_ops
= {
3271 .print_full
= ieee80211
,
3272 .print_less
= ieee80211_less
,