Codebase list iw / 22dbf6e
New upstream version 5.8 Paride Legovini 3 years ago
15 changed file(s) with 1388 addition(s) and 92 deletion(s). Raw diff Collapse all Expand all
1313 CFLAGS_EVAL := $(call cc-option,-Wstringop-overflow=4)
1414
1515 CFLAGS ?= -O2 -g
16 CFLAGS += -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common \
17 -Werror-implicit-function-declaration -Wsign-compare -Wno-unused-parameter \
18 $(CFLAGS_EVAL)
16 CFLAGS += -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
17 CFLAGS += -Werror-implicit-function-declaration -Wsign-compare -Wno-unused-parameter
18 CFLAGS += -Wdeclaration-after-statement
19 CFLAGS += $(CFLAGS_EVAL)
1920
2021 _OBJS := $(sort $(patsubst %.c,%.o,$(wildcard *.c)))
2122 VERSION_OBJS := $(filter-out version.o, $(_OBJS))
6363 memset(txrate_vht, 0, sizeof(*txrate_vht));
6464
6565 for (i = 0; i < argc; i++) {
66 if(!parse_vht_chunk(argv[i], &nss, &mcs))
66 if (!parse_vht_chunk(argv[i], &nss, &mcs))
6767 return 0;
6868
6969 nss--;
199199 }
200200
201201 if (have_vht_mcs_24)
202 if(!setup_vht(&txrate_vht_24, vht_argc_24, vht_argv_24))
202 if (!setup_vht(&txrate_vht_24, vht_argc_24, vht_argv_24))
203203 return -EINVAL;
204204
205205 if (have_vht_mcs_5)
206 if(!setup_vht(&txrate_vht_5, vht_argc_5, vht_argv_5))
206 if (!setup_vht(&txrate_vht_5, vht_argc_5, vht_argv_5))
207207 return -EINVAL;
208208
209209 if (sgi_5 && lgi_5)
121121
122122 if (cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]) {
123123 enum nl80211_cqm_rssi_threshold_event rssi_event;
124 int32_t rssi_level = -1;
124125 bool found_one = false;
125126
126127 rssi_event = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]);
128 if (cqm[NL80211_ATTR_CQM_RSSI_LEVEL])
129 rssi_level = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_LEVEL]);
127130
128131 switch (rssi_event) {
129132 case NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH:
130 printf("RSSI went above threshold\n");
133 printf("RSSI (%i dBm) went above threshold\n", rssi_level);
131134 found_one = true;
132135 break;
133136 case NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW:
134 printf("RSSI went below threshold\n");
137 printf("RSSI (%i dBm) went below threshold\n", rssi_level);
135138 found_one = true;
136139 break;
137140 case NL80211_CQM_RSSI_BEACON_LOSS_EVENT:
290293 printf("\t* TCP connection lost\n");
291294 if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS])
292295 printf("\t* TCP connection ran out of tokens\n");
296 }
297
298 extern struct vendor_event *__start_vendor_event[];
299 extern struct vendor_event *__stop_vendor_event;
300
301 // Dummy to force the section to exist
302 VENDOR_EVENT(0xffffffff, 0xffffffff, NULL);
303
304 static void parse_vendor_event(struct nlattr **attrs, bool dump)
305 {
306 __u32 vendor_id, subcmd;
307 unsigned int i;
308
309 if (!attrs[NL80211_ATTR_VENDOR_ID] ||
310 !attrs[NL80211_ATTR_VENDOR_SUBCMD])
311 return;
312
313 vendor_id = nla_get_u32(attrs[NL80211_ATTR_VENDOR_ID]);
314 subcmd = nla_get_u32(attrs[NL80211_ATTR_VENDOR_SUBCMD]);
315
316 printf("vendor event %.6x:%d", vendor_id, subcmd);
317
318 for (i = 0; i < &__stop_vendor_event - __start_vendor_event; i++) {
319 struct vendor_event *ev = __start_vendor_event[i];
320
321 if (!ev)
322 continue;
323
324 if (ev->vendor_id != vendor_id)
325 continue;
326 if (ev->subcmd != subcmd)
327 continue;
328 if (!ev->callback)
329 continue;
330
331 ev->callback(vendor_id, subcmd, attrs[NL80211_ATTR_VENDOR_DATA]);
332 goto out;
333 }
334
335 if (dump && attrs[NL80211_ATTR_VENDOR_DATA])
336 iw_hexdump("vendor event",
337 nla_data(attrs[NL80211_ATTR_VENDOR_DATA]),
338 nla_len(attrs[NL80211_ATTR_VENDOR_DATA]));
339 out:
340 printf("\n");
293341 }
294342
295343 static void parse_nan_term(struct nlattr **attrs)
649697 printf("\n");
650698 }
651699
700 static void parse_new_peer_candidate(struct nlattr **attrs)
701 {
702 char macbuf[ETH_ALEN * 3];
703 int32_t sig_dbm;
704
705 printf("new peer candidate");
706 if (attrs[NL80211_ATTR_MAC]) {
707 mac_addr_n2a(macbuf, nla_data(attrs[NL80211_ATTR_MAC]));
708 printf(" %s", macbuf);
709 }
710 if (attrs[NL80211_ATTR_RX_SIGNAL_DBM]) {
711 sig_dbm = nla_get_u32(attrs[NL80211_ATTR_RX_SIGNAL_DBM]);
712 printf(" %d dBm", sig_dbm);
713 }
714
715 printf("\n");
716 }
717
718 static void parse_recv_interface(struct nlattr **attrs, int command)
719 {
720 switch (command) {
721 case NL80211_CMD_NEW_INTERFACE:
722 printf("new interface");
723 break;
724 case NL80211_CMD_DEL_INTERFACE:
725 printf("del interface");
726 break;
727 case NL80211_CMD_SET_INTERFACE:
728 printf("set interface");
729 break;
730 default:
731 printf("unknown interface command (%i) received\n", command);
732 return;
733 }
734
735 if (attrs[NL80211_ATTR_IFTYPE]) {
736 printf(" type ");
737 switch (nla_get_u32(attrs[NL80211_ATTR_IFTYPE])) {
738 case NL80211_IFTYPE_STATION:
739 printf("station");
740 break;
741 case NL80211_IFTYPE_AP:
742 printf("access point");
743 break;
744 case NL80211_IFTYPE_MESH_POINT:
745 printf("mesh point");
746 break;
747 case NL80211_IFTYPE_ADHOC:
748 printf("IBSS");
749 break;
750 case NL80211_IFTYPE_MONITOR:
751 printf("monitor");
752 break;
753 case NL80211_IFTYPE_AP_VLAN:
754 printf("AP-VLAN");
755 break;
756 case NL80211_IFTYPE_WDS:
757 printf("WDS");
758 break;
759 case NL80211_IFTYPE_P2P_CLIENT:
760 printf("P2P-client");
761 break;
762 case NL80211_IFTYPE_P2P_GO:
763 printf("P2P-GO");
764 break;
765 case NL80211_IFTYPE_P2P_DEVICE:
766 printf("P2P-Device");
767 break;
768 case NL80211_IFTYPE_OCB:
769 printf("OCB");
770 break;
771 case NL80211_IFTYPE_NAN:
772 printf("NAN");
773 break;
774 default:
775 printf("unknown (%d)",
776 nla_get_u32(attrs[NL80211_ATTR_IFTYPE]));
777 break;
778 }
779 }
780
781 if (attrs[NL80211_ATTR_MESH_ID]) {
782 printf(" meshid ");
783 print_ssid_escaped(nla_len(attrs[NL80211_ATTR_MESH_ID]),
784 nla_data(attrs[NL80211_ATTR_MESH_ID]));
785 }
786
787 if (attrs[NL80211_ATTR_4ADDR]) {
788 printf(" use 4addr %d", nla_get_u8(attrs[NL80211_ATTR_4ADDR]));
789 }
790
791 printf("\n");
792 }
793
794 static void parse_sta_opmode_changed(struct nlattr **attrs)
795 {
796 char macbuf[ETH_ALEN*3];
797
798 printf("sta opmode changed");
799
800 if (attrs[NL80211_ATTR_MAC]) {
801 mac_addr_n2a(macbuf, nla_data(attrs[NL80211_ATTR_MAC]));
802 printf(" %s", macbuf);
803 }
804
805 if (attrs[NL80211_ATTR_SMPS_MODE])
806 printf(" smps mode %d", nla_get_u8(attrs[NL80211_ATTR_SMPS_MODE]));
807
808 if (attrs[NL80211_ATTR_CHANNEL_WIDTH])
809 printf(" chan width %d", nla_get_u8(attrs[NL80211_ATTR_CHANNEL_WIDTH]));
810
811 if (attrs[NL80211_ATTR_NSS])
812 printf(" nss %d", nla_get_u8(attrs[NL80211_ATTR_NSS]));
813
814 printf("\n");
815 }
816
817 static void parse_ch_switch_notify(struct nlattr **attrs, int command)
818 {
819 switch (command) {
820 case NL80211_CMD_CH_SWITCH_STARTED_NOTIFY:
821 printf("channel switch started");
822 break;
823 case NL80211_CMD_CH_SWITCH_NOTIFY:
824 printf("channel switch");
825 break;
826 default:
827 printf("unknown channel switch command (%i) received\n", command);
828 return;
829 }
830
831 if (attrs[NL80211_ATTR_CH_SWITCH_COUNT])
832 printf(" (count=%d)", nla_get_u32(attrs[NL80211_ATTR_CH_SWITCH_COUNT]));
833
834 if (attrs[NL80211_ATTR_WIPHY_FREQ])
835 printf(" freq=%d", nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]));
836
837 if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) {
838 printf(" width=");
839 switch(nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH])) {
840 case NL80211_CHAN_WIDTH_20_NOHT:
841 case NL80211_CHAN_WIDTH_20:
842 printf("\"20 MHz\"");
843 break;
844 case NL80211_CHAN_WIDTH_40:
845 printf("\"40 MHz\"");
846 break;
847 case NL80211_CHAN_WIDTH_80:
848 printf("\"80 MHz\"");
849 break;
850 case NL80211_CHAN_WIDTH_80P80:
851 printf("\"80+80 MHz\"");
852 break;
853 case NL80211_CHAN_WIDTH_160:
854 printf("\"160 MHz\"");
855 break;
856 case NL80211_CHAN_WIDTH_5:
857 printf("\"5 MHz\"");
858 break;
859 case NL80211_CHAN_WIDTH_10:
860 printf("\"10 MHz\"");
861 break;
862 default:
863 printf("\"unknown\"");
864 }
865 }
866
867 if (attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
868 printf(" type=");
869 switch(nla_get_u32(attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE])) {
870 case NL80211_CHAN_NO_HT:
871 printf("\"No HT\"");
872 break;
873 case NL80211_CHAN_HT20:
874 printf("\"HT20\"");
875 break;
876 case NL80211_CHAN_HT40MINUS:
877 printf("\"HT40-\"");
878 break;
879 case NL80211_CHAN_HT40PLUS:
880 printf("\"HT40+\"");
881 break;
882 }
883 }
884
885 if (attrs[NL80211_ATTR_CENTER_FREQ1])
886 printf(" freq1=%d", nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]));
887
888 if (attrs[NL80211_ATTR_CENTER_FREQ2])
889 printf(" freq2=%d", nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ2]));
890
891 printf("\n");
892 }
893
652894 static int print_event(struct nl_msg *msg, void *arg)
653895 {
654896 struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
682924 genlmsg_attrlen(gnlh, 0), NULL);
683925
684926 if (tb[NL80211_ATTR_IFINDEX] && tb[NL80211_ATTR_WIPHY]) {
685 if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), ifname);
686 printf("%s (phy #%d): ", ifname, nla_get_u32(tb[NL80211_ATTR_WIPHY]));
927 /* if_indextoname may fails on delete interface/wiphy event */
928 if (if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), ifname))
929 printf("%s (phy #%d): ", ifname, nla_get_u32(tb[NL80211_ATTR_WIPHY]));
930 else
931 printf("phy #%d: ", nla_get_u32(tb[NL80211_ATTR_WIPHY]));
687932 } else if (tb[NL80211_ATTR_WDEV] && tb[NL80211_ATTR_WIPHY]) {
688933 printf("wdev 0x%llx (phy #%d): ",
689934 (unsigned long long)nla_get_u64(tb[NL80211_ATTR_WDEV]),
733978 case NL80211_CMD_SCHED_SCAN_RESULTS:
734979 printf("got scheduled scan results\n");
735980 break;
981 case NL80211_CMD_WIPHY_REG_CHANGE:
736982 case NL80211_CMD_REG_CHANGE:
737 printf("regulatory domain change: ");
983 if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
984 printf("regulatory domain change (phy): ");
985 else
986 printf("regulatory domain change: ");
738987
739988 reg_type = nla_get_u8(tb[NL80211_ATTR_REG_TYPE]);
740989
9051154 nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]),
9061155 (unsigned long long)nla_get_u64(tb[NL80211_ATTR_COOKIE]));
9071156 break;
1157 case NL80211_CMD_FRAME_WAIT_CANCEL:
1158 printf("frame wait cancel on freq %d (cookie %llx)\n",
1159 nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]),
1160 (unsigned long long)nla_get_u64(tb[NL80211_ATTR_COOKIE]));
1161 break;
9081162 case NL80211_CMD_NOTIFY_CQM:
9091163 parse_cqm_event(tb);
9101164 break;
9331187 tb[NL80211_ATTR_ACK] ? "acked" : "no ack");
9341188 break;
9351189 case NL80211_CMD_VENDOR:
936 printf("vendor event %.6x:%d\n",
937 nla_get_u32(tb[NL80211_ATTR_VENDOR_ID]),
938 nla_get_u32(tb[NL80211_ATTR_VENDOR_SUBCMD]));
939 if (args->frame && tb[NL80211_ATTR_VENDOR_DATA])
940 iw_hexdump("vendor event",
941 nla_data(tb[NL80211_ATTR_VENDOR_DATA]),
942 nla_len(tb[NL80211_ATTR_VENDOR_DATA]));
1190 parse_vendor_event(tb, args->frame);
9431191 break;
9441192 case NL80211_CMD_RADAR_DETECT: {
9451193 enum nl80211_radar_event event_type;
9841232 case NL80211_CMD_DEL_NAN_FUNCTION:
9851233 parse_nan_term(tb);
9861234 break;
987 case NL80211_CMD_NAN_MATCH: {
1235 case NL80211_CMD_NAN_MATCH:
9881236 parse_nan_match(tb);
9891237 break;
990 }
1238 case NL80211_CMD_NEW_PEER_CANDIDATE:
1239 parse_new_peer_candidate(tb);
1240 break;
1241 case NL80211_CMD_NEW_INTERFACE:
1242 case NL80211_CMD_SET_INTERFACE:
1243 case NL80211_CMD_DEL_INTERFACE:
1244 parse_recv_interface(tb, gnlh->cmd);
1245 break;
1246 case NL80211_CMD_STA_OPMODE_CHANGED:
1247 parse_sta_opmode_changed(tb);
1248 break;
1249 case NL80211_CMD_STOP_AP:
1250 printf("stop ap\n");
1251 break;
1252 case NL80211_CMD_CH_SWITCH_STARTED_NOTIFY:
1253 case NL80211_CMD_CH_SWITCH_NOTIFY:
1254 parse_ch_switch_notify(tb, gnlh->cmd);
1255 break;
9911256 default:
9921257 printf("unknown event %d (%s)\n",
9931258 gnlh->cmd, command_name(gnlh->cmd));
131131 }
132132 if (print_name && tb_msg[NL80211_ATTR_WIPHY_NAME])
133133 printf("Wiphy %s\n", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME]));
134
135 if (print_name && tb_msg[NL80211_ATTR_WIPHY])
136 printf("\twiphy index: %u\n", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]));
134137
135138 /* needed for split dump */
136139 if (tb_msg[NL80211_ATTR_WIPHY_BANDS]) {
675678 ext_feat_print(tb, DFS_OFFLOAD, "DFS offload");
676679 ext_feat_print(tb, CONTROL_PORT_OVER_NL80211,
677680 "control port over nl80211");
681 ext_feat_print(tb, ACK_SIGNAL_SUPPORT,
682 "ack signal level support");
678683 ext_feat_print(tb, TXQS, "FQ-CoDel-enabled intermediate TXQs");
679684 ext_feat_print(tb, AIRTIME_FAIRNESS,
680685 "airtime fairness scheduling");
686 ext_feat_print(tb, AQL,
687 "Airtime Queue Limits (AQL)");
688 ext_feat_print(tb, SCAN_RANDOM_SN,
689 "use random sequence numbers in scans");
690 ext_feat_print(tb, SCAN_MIN_PREQ_CONTENT,
691 "use probe request with only rate IEs in scans");
692 ext_feat_print(tb, CAN_REPLACE_PTK0,
693 "can safely replace PTK 0 when rekeying");
694 ext_feat_print(tb, ENABLE_FTM_RESPONDER,
695 "enable FTM (Fine Time Measurement) responder");
681696 ext_feat_print(tb, AP_PMKSA_CACHING,
682697 "PMKSA caching supported in AP mode");
683698 ext_feat_print(tb, SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
684699 "band specific RSSI thresholds for scheduled scan");
685 ext_feat_print(tb, EXT_KEY_ID, "extended key ID support");
700 ext_feat_print(tb, EXT_KEY_ID, "Extended Key ID support");
686701 ext_feat_print(tb, STA_TX_PWR, "TX power control per station");
687702 ext_feat_print(tb, SAE_OFFLOAD, "SAE offload support");
703 ext_feat_print(tb, VLAN_OFFLOAD, "VLAN offload support");
704 ext_feat_print(tb, BEACON_PROTECTION, "beacon protection support");
705 ext_feat_print(tb, CONTROL_PORT_NO_PREAUTH, "disable pre-auth over nl80211 control port support");
706 ext_feat_print(tb, PROTECTED_TWT, "protected Target Wake Time (TWT) support");
707 ext_feat_print(tb, DEL_IBSS_STA, "deletion of IBSS station support");
708 ext_feat_print(tb, MULTICAST_REGISTRATIONS, "mgmt frame registration for multicast");
709 ext_feat_print(tb, BEACON_PROTECTION_CLIENT, "beacon prot. for clients support");
710 ext_feat_print(tb, SCAN_FREQ_KHZ, "scan on kHz frequency support");
711 ext_feat_print(tb, CONTROL_PORT_OVER_NL80211_TX_STATUS, "tx status for nl80211 control port support");
712 ext_feat_print(tb, OPERATING_CHANNEL_VALIDATION, "Operating Channel Validation (OCV) support");
713 ext_feat_print(tb, 4WAY_HANDSHAKE_AP_PSK, "AP mode PSK offload support");
688714 }
689715
690716 if (tb_msg[NL80211_ATTR_COALESCE_RULE]) {
701727 rule->max_rules, pat->max_patterns, pat->min_pattern_len,
702728 pat->max_pattern_len, pat->max_pkt_offset, rule->max_delay);
703729 }
730
731 if (tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA])
732 printf("\tMaximum associated stations in AP mode: %u\n",
733 nla_get_u16(tb_msg[NL80211_ATTR_MAX_AP_ASSOC_STA]));
704734
705735 return NL_SKIP;
706736 }
434434 }
435435
436436 if (tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]) {
437 uint32_t txp = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]);
437 int32_t txp = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]);
438438
439439 printf("%s\ttxpower %d.%.2d dBm\n",
440440 indent, txp / 100, txp % 100);
726726 "Switch the operating channel by sending a channel switch announcement (CSA).");
727727 COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
728728 NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
729
730
731 static int toggle_tid_param(const char *argv0, const char *argv1,
732 struct nl_msg *msg, uint32_t attr)
733 {
734 uint8_t val;
735
736 if (strcmp(argv1, "on") == 0) {
737 val = NL80211_TID_CONFIG_ENABLE;
738 } else if (strcmp(argv1, "off") == 0) {
739 val = NL80211_TID_CONFIG_DISABLE;
740 } else {
741 fprintf(stderr, "Invalid %s parameter: %s\n", argv0, argv1);
742 return 2;
743 }
744
745 NLA_PUT_U8(msg, attr, val);
746 return 0;
747
748 nla_put_failure:
749 return -ENOBUFS;
750 }
751
752 static int handle_tid_config(struct nl80211_state *state,
753 struct nl_msg *msg,
754 int argc, char **argv,
755 enum id_input id)
756 {
757 struct nlattr *tids_array = NULL;
758 struct nlattr *tids_entry = NULL;
759 unsigned char peer[ETH_ALEN];
760 int tids_num = 0;
761 char *end;
762 int ret;
763 enum {
764 PS_ADDR,
765 PS_TIDS,
766 PS_CONF,
767 } parse_state = PS_ADDR;
768
769 while (argc) {
770 switch (parse_state) {
771 case PS_ADDR:
772 if (strcmp(argv[0], "peer") == 0) {
773 if (argc < 2) {
774 fprintf(stderr, "Not enough args for %s\n", argv[0]);
775 return HANDLER_RET_USAGE;
776 }
777
778 if (mac_addr_a2n(peer, argv[1])) {
779 fprintf(stderr, "Invalid MAC address\n");
780 return 2;
781 }
782
783 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer);
784
785 argc -= 2;
786 argv += 2;
787 parse_state = PS_TIDS;
788
789 } else if (strcmp(argv[0], "tids") == 0) {
790 parse_state = PS_TIDS;
791 } else {
792 fprintf(stderr, "Peer MAC address expected\n");
793 return HANDLER_RET_USAGE;
794 }
795
796 break;
797 case PS_TIDS:
798 if (strcmp(argv[0], "tids") == 0) {
799 if (argc < 2) {
800 fprintf(stderr, "not enough args for %s\n", argv[0]);
801 return HANDLER_RET_USAGE;
802 }
803
804 if (!tids_array) {
805 tids_array = nla_nest_start(msg, NL80211_ATTR_TID_CONFIG);
806 if (!tids_array)
807 return -ENOBUFS;
808 }
809
810 if (tids_entry) {
811 nla_nest_end(msg, tids_entry);
812 tids_num++;
813 }
814
815 tids_entry = nla_nest_start(msg, tids_num);
816 if (!tids_entry)
817 return -ENOBUFS;
818
819 NLA_PUT_U16(msg, NL80211_TID_CONFIG_ATTR_TIDS, strtol(argv[1], &end, 0));
820 if (*end) {
821 fprintf(stderr, "Invalid TID mask value: %s\n", argv[1]);
822 return 2;
823 }
824
825 argc -= 2;
826 argv += 2;
827 parse_state = PS_CONF;
828 } else {
829 fprintf(stderr, "TID mask expected\n");
830 return HANDLER_RET_USAGE;
831 }
832
833 break;
834 case PS_CONF:
835 if (strcmp(argv[0], "tids") == 0) {
836 parse_state = PS_TIDS;
837 } else if (strcmp(argv[0], "override") == 0) {
838 NLA_PUT_FLAG(msg, NL80211_TID_CONFIG_ATTR_OVERRIDE);
839
840 argc -= 1;
841 argv += 1;
842 } else if (strcmp(argv[0], "ampdu") == 0) {
843 if (argc < 2) {
844 fprintf(stderr, "not enough args for %s\n", argv[0]);
845 return HANDLER_RET_USAGE;
846 }
847
848 ret = toggle_tid_param(argv[0], argv[1], msg,
849 NL80211_TID_CONFIG_ATTR_AMPDU_CTRL);
850 if (ret)
851 return ret;
852
853 argc -= 2;
854 argv += 2;
855 } else if (strcmp(argv[0], "amsdu") == 0) {
856 if (argc < 2) {
857 fprintf(stderr, "not enough args for %s\n", argv[0]);
858 return HANDLER_RET_USAGE;
859 }
860
861 ret = toggle_tid_param(argv[0], argv[1], msg,
862 NL80211_TID_CONFIG_ATTR_AMSDU_CTRL);
863 if (ret)
864 return ret;
865
866 argc -= 2;
867 argv += 2;
868 } else if (strcmp(argv[0], "noack") == 0) {
869 if (argc < 2) {
870 fprintf(stderr, "not enough args for %s\n", argv[0]);
871 return HANDLER_RET_USAGE;
872 }
873
874 ret = toggle_tid_param(argv[0], argv[1], msg,
875 NL80211_TID_CONFIG_ATTR_NOACK);
876 if (ret)
877 return ret;
878
879 argc -= 2;
880 argv += 2;
881 } else if (strcmp(argv[0], "rtscts") == 0) {
882 if (argc < 2) {
883 fprintf(stderr, "not enough args for %s\n", argv[0]);
884 return HANDLER_RET_USAGE;
885 }
886
887 ret = toggle_tid_param(argv[0], argv[1], msg,
888 NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL);
889 if (ret)
890 return ret;
891
892 argc -= 2;
893 argv += 2;
894 } else if (strcmp(argv[0], "sretry") == 0) {
895 if (argc < 2) {
896 fprintf(stderr, "not enough args for %s\n", argv[0]);
897 return HANDLER_RET_USAGE;
898 }
899
900 NLA_PUT_U8(msg, NL80211_TID_CONFIG_ATTR_RETRY_SHORT, strtol(argv[1], &end, 0));
901 if (*end) {
902 fprintf(stderr, "Invalid short_retry value: %s\n", argv[1]);
903 return 2;
904 }
905
906 argc -= 2;
907 argv += 2;
908 } else if (strcmp(argv[0], "lretry") == 0) {
909 if (argc < 2) {
910 fprintf(stderr, "not enough args for %s\n", argv[0]);
911 return HANDLER_RET_USAGE;
912 }
913
914 NLA_PUT_U8(msg, NL80211_TID_CONFIG_ATTR_RETRY_LONG, strtol(argv[1], &end, 0));
915 if (*end) {
916 fprintf(stderr, "Invalid long_retry value: %s\n", argv[1]);
917 return 2;
918 }
919
920 argc -= 2;
921 argv += 2;
922 } else {
923 fprintf(stderr, "Unknown parameter: %s\n", argv[0]);
924 return HANDLER_RET_USAGE;
925 }
926
927 break;
928 default:
929 fprintf(stderr, "Failed to parse: internal failure\n");
930 return HANDLER_RET_USAGE;
931 }
932 }
933
934 if (tids_entry)
935 nla_nest_end(msg, tids_entry);
936
937 if (tids_array)
938 nla_nest_end(msg, tids_array);
939
940 return 0;
941
942 nla_put_failure:
943 return -ENOBUFS;
944 }
945
946 COMMAND(set, tidconf, "[peer <MAC address>] tids <mask> [override] [sretry <num>] [lretry <num>] "
947 "[ampdu [on|off]] [amsdu [on|off]] [noack [on|off]] [rtscts [on|off]]",
948 NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_tid_config,
949 "Setup per-node TID specific configuration for TIDs selected by bitmask.\n"
950 "If MAC address is not specified, then supplied TID configuration\n"
951 "applied to all the peers.\n"
952 "Examples:\n"
953 " $ iw dev wlan0 tids 0x1 ampdu off\n"
954 " $ iw dev wlan0 tids 0x5 ampdu off amsdu off rtscts on\n"
955 " $ iw dev wlan0 tids 0x3 override ampdu on noack on rtscts on\n"
956 " $ iw dev wlan0 peer xx:xx:xx:xx:xx:xx tids 0x1 ampdu off tids 0x3 amsdu off rtscts on\n"
957 );
154154 #define DECLARE_SECTION(_name) \
155155 extern struct cmd __section ## _ ## _name;
156156
157 struct vendor_event {
158 unsigned int vendor_id, subcmd;
159 void (*callback)(unsigned int vendor_id, unsigned int subcmd,
160 struct nlattr *data);
161 };
162
163 #define VENDOR_EVENT(_id, _subcmd, _callback) \
164 const struct vendor_event \
165 vendor_event_ ## _id ## _ ## _subcmd = { \
166 .vendor_id = _id, \
167 .subcmd = _subcmd, \
168 .callback = _callback, \
169 }, * const vendor_event_ ## _id ## _ ## _subcmd ## _p \
170 __attribute__((used,section("vendor_event"))) = \
171 &vendor_event_ ## _id ## _ ## _subcmd
172
157173 extern const char iw_version[];
158174
159175 extern int iw_debug;
138138 printf("Invalid preamble %s\n", pos + 9);
139139 return HANDLER_RET_USAGE;
140140 }
141 preamble = true;
142 } else if (strncmp(pos, "tb", 2) == 0) {
143 NLA_PUT_FLAG(msg,
144 NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED);
145 NLA_PUT_U32(msg, NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE,
146 NL80211_PREAMBLE_HE);
147 preamble = true;
148 } else if (strncmp(pos, "non_tb", 6) == 0) {
149 NLA_PUT_FLAG(msg,
150 NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED);
151 NLA_PUT_U32(msg, NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE,
152 NL80211_PREAMBLE_HE);
141153 preamble = true;
142154 } else {
143155 printf("Unknown parameter %s\n", pos);
165177 case NL80211_CHAN_WIDTH_160:
166178 preamble = NL80211_PREAMBLE_VHT;
167179 break;
180 default:
181 return HANDLER_RET_USAGE;
168182 }
169183
170184 NLA_PUT_U32(msg, NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE, preamble);
314328 CIB_NETDEV, handle_ftm_req,
315329 "Send an FTM request to the targets supplied in the config file.\n"
316330 "Each line in the file represents a target, with the following format:\n"
317 "<addr> bw=<[20|40|80|80+80|160]> cf=<center_freq> [cf1=<center_freq1>] [cf2=<center_freq2>] [ftms_per_burst=<samples per burst>] [ap-tsf] [asap] [bursts_exp=<num of bursts exponent>] [burst_period=<burst period>] [retries=<num of retries>] [burst_duration=<burst duration>] [preamble=<legacy,ht,vht,dmg>] [lci] [civic]");
331 "<addr> bw=<[20|40|80|80+80|160]> cf=<center_freq> [cf1=<center_freq1>] [cf2=<center_freq2>] [ftms_per_burst=<samples per burst>] [ap-tsf] [asap] [bursts_exp=<num of bursts exponent>] [burst_period=<burst period>] [retries=<num of retries>] [burst_duration=<burst duration>] [preamble=<legacy,ht,vht,dmg>] [lci] [civic] [tb] [non_tb]");
318332 HIDDEN(measurement, ftm_request_send, "", NL80211_CMD_PEER_MEASUREMENT_START,
319333 0, CIB_NETDEV, handle_ftm_req_send);
263263 _my_nla_put_u16, _parse_u16, _print_u16_in_TUs},
264264 {"mesh_plink_timeout", NL80211_MESHCONF_PLINK_TIMEOUT,
265265 _my_nla_put_u32, _parse_u32, _print_u32_in_seconds},
266 {"mesh_connected_to_gate", NL80211_MESHCONF_CONNECTED_TO_GATE,
267 _my_nla_put_u8, _parse_u8_as_bool, _print_u8},
268 {"mesh_nolearn", NL80211_MESHCONF_NOLEARN,
269 _my_nla_put_u8, _parse_u8_as_bool, _print_u8},
270 {"mesh_connected_to_as", NL80211_MESHCONF_CONNECTED_TO_AS,
271 _my_nla_put_u8, _parse_u8_as_bool, _print_u8},
266272 };
267273
268274 static void print_all_mesh_param_descr(void)
3737 [NL80211_MPATH_INFO_DISCOVERY_TIMEOUT] = { .type = NLA_U32 },
3838 [NL80211_MPATH_INFO_DISCOVERY_RETRIES] = { .type = NLA_U8 },
3939 [NL80211_MPATH_INFO_FLAGS] = { .type = NLA_U8 },
40 [NL80211_MPATH_INFO_HOP_COUNT] = { .type = NLA_U8 },
41 [NL80211_MPATH_INFO_PATH_CHANGE] = { .type = NLA_U32 },
4042 };
4143
4244 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
8486 if (pinfo[NL80211_MPATH_INFO_FLAGS])
8587 printf("\t0x%x",
8688 nla_get_u8(pinfo[NL80211_MPATH_INFO_FLAGS]));
89 if (pinfo[NL80211_MPATH_INFO_HOP_COUNT])
90 printf("\t%u",
91 nla_get_u8(pinfo[NL80211_MPATH_INFO_HOP_COUNT]));
92 if (pinfo[NL80211_MPATH_INFO_PATH_CHANGE])
93 printf("\t%u",
94 nla_get_u32(pinfo[NL80211_MPATH_INFO_PATH_CHANGE]));
8795
8896 printf("\n");
8997 return NL_SKIP;
217225 enum id_input id)
218226 {
219227 printf("DEST ADDR NEXT HOP IFACE\tSN\tMETRIC\tQLEN\t"
220 "EXPTIME\t\tDTIM\tDRET\tFLAGS\n");
228 "EXPTIME\t\tDTIM\tDRET\tFLAGS\tHOP_COUNT\tPATH_CHANGE\n");
221229 register_handler(print_mpath_handler, NULL);
222230 return 0;
223231 }
1010 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
1111 * Copyright 2008 Colin McCabe <colin@cozybit.com>
1212 * Copyright 2015-2017 Intel Deutschland GmbH
13 * Copyright (C) 2018-2019 Intel Corporation
13 * Copyright (C) 2018-2020 Intel Corporation
1414 *
1515 * Permission to use, copy, modify, and/or distribute this software for any
1616 * purpose with or without fee is hereby granted, provided that the above
182182 *
183183 * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag drivers
184184 * can indicate they support offloading EAPOL handshakes for WPA/WPA2
185 * preshared key authentication. In %NL80211_CMD_CONNECT the preshared
186 * key should be specified using %NL80211_ATTR_PMK. Drivers supporting
187 * this offload may reject the %NL80211_CMD_CONNECT when no preshared
188 * key material is provided, for example when that driver does not
189 * support setting the temporal keys through %CMD_NEW_KEY.
185 * preshared key authentication in station mode. In %NL80211_CMD_CONNECT
186 * the preshared key should be specified using %NL80211_ATTR_PMK. Drivers
187 * supporting this offload may reject the %NL80211_CMD_CONNECT when no
188 * preshared key material is provided, for example when that driver does
189 * not support setting the temporal keys through %NL80211_CMD_NEW_KEY.
190190 *
191191 * Similarly @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X flag can be
192192 * set by drivers indicating offload support of the PTK/GTK EAPOL
193 * handshakes during 802.1X authentication. In order to use the offload
194 * the %NL80211_CMD_CONNECT should have %NL80211_ATTR_WANT_1X_4WAY_HS
195 * attribute flag. Drivers supporting this offload may reject the
196 * %NL80211_CMD_CONNECT when the attribute flag is not present.
193 * handshakes during 802.1X authentication in station mode. In order to
194 * use the offload the %NL80211_CMD_CONNECT should have
195 * %NL80211_ATTR_WANT_1X_4WAY_HS attribute flag. Drivers supporting this
196 * offload may reject the %NL80211_CMD_CONNECT when the attribute flag is
197 * not present.
198 *
199 * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK flag drivers
200 * can indicate they support offloading EAPOL handshakes for WPA/WPA2
201 * preshared key authentication in AP mode. In %NL80211_CMD_START_AP
202 * the preshared key should be specified using %NL80211_ATTR_PMK. Drivers
203 * supporting this offload may reject the %NL80211_CMD_START_AP when no
204 * preshared key material is provided, for example when that driver does
205 * not support setting the temporal keys through %NL80211_CMD_NEW_KEY.
197206 *
198207 * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK
199208 * using %NL80211_CMD_SET_PMK. For offloaded FT support also
248257 */
249258
250259 /**
260 * DOC: VLAN offload support for setting group keys and binding STAs to VLANs
261 *
262 * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they
263 * support offloading VLAN functionality in a manner where the driver exposes a
264 * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs
265 * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet
266 * case. Frames received from stations that are not assigned to any VLAN are
267 * delivered on the main netdev and frames to such stations can be sent through
268 * that main netdev.
269 *
270 * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and
271 * %NL80211_CMD_SET_STATION will optionally specify vlan_id using
272 * %NL80211_ATTR_VLAN_ID.
273 */
274
275 /**
276 * DOC: TID configuration
277 *
278 * TID config support can be checked in the %NL80211_ATTR_TID_CONFIG
279 * attribute given in wiphy capabilities.
280 *
281 * The necessary configuration parameters are mentioned in
282 * &enum nl80211_tid_config_attr and it will be passed to the
283 * %NL80211_CMD_SET_TID_CONFIG command in %NL80211_ATTR_TID_CONFIG.
284 *
285 * If the configuration needs to be applied for specific peer then the MAC
286 * address of the peer needs to be passed in %NL80211_ATTR_MAC, otherwise the
287 * configuration will be applied for all the connected peers in the vif except
288 * any peers that have peer specific configuration for the TID by default; if
289 * the %NL80211_TID_CONFIG_ATTR_OVERRIDE flag is set, peer specific values
290 * will be overwritten.
291 *
292 * All this configuration is valid only for STA's current connection
293 * i.e. the configuration will be reset to default when the STA connects back
294 * after disconnection/roaming, and this configuration will be cleared when
295 * the interface goes down.
296 */
297
298 /**
251299 * enum nl80211_commands - supported nl80211 commands
252300 *
253301 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
256304 * to get a list of all present wiphys.
257305 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
258306 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
259 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the
260 * attributes determining the channel width; this is used for setting
261 * monitor mode channel), %NL80211_ATTR_WIPHY_RETRY_SHORT,
262 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
263 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
264 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
265 * instead, the support here is for backward compatibility only.
307 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
308 * %NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the
309 * channel width; this is used for setting monitor mode channel),
310 * %NL80211_ATTR_WIPHY_RETRY_SHORT, %NL80211_ATTR_WIPHY_RETRY_LONG,
311 * %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, and/or
312 * %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel,
313 * see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward
314 * compatibility only.
266315 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
267316 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
268317 * %NL80211_ATTR_WIPHY_NAME.
311360 * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
312361 * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
313362 * The channel to use can be set on the interface or be given using the
314 * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
363 * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the
364 * attributes determining channel width.
315365 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
316366 * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
317367 * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
321371 * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
322372 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
323373 * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
324 * the interface identified by %NL80211_ATTR_IFINDEX.
374 * interface identified by %NL80211_ATTR_IFINDEX.
325375 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
326376 * or, if no MAC address given, all stations, on the interface identified
327377 * by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
341391 * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
342392 * %NL80211_ATTR_MAC.
343393 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
344 * the interface identified by %NL80211_ATTR_IFINDEX.
394 * interface identified by %NL80211_ATTR_IFINDEX.
345395 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
346396 * or, if no MAC address given, all mesh paths, on the interface identified
347397 * by %NL80211_ATTR_IFINDEX.
496546 * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
497547 * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
498548 * the SSID (mainly for association, but is included in authentication
499 * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used
500 * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE
501 * is used to specify the authentication type. %NL80211_ATTR_IE is used to
502 * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs)
503 * to be added to the frame.
549 * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ +
550 * %NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequence of the
551 * channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the
552 * authentication type. %NL80211_ATTR_IE is used to define IEs
553 * (VendorSpecificInfo, but also including RSN IE and FT IEs) to be added
554 * to the frame.
504555 * When used as an event, this reports reception of an Authentication
505556 * frame in station and IBSS modes when the local MLME processed the
506557 * frame, i.e., it was for the local STA and was received in correct
555606 * requests to connect to a specified network but without separating
556607 * auth and assoc steps. For this, you need to specify the SSID in a
557608 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
558 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
559 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
609 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE,
610 * %NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ,
611 * %NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT,
560612 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
561613 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
562614 * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
570622 * set of BSSID,frequency parameters is used (i.e., either the enforcing
571623 * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
572624 * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
625 * Driver shall not modify the IEs specified through %NL80211_ATTR_IE if
626 * %NL80211_ATTR_MAC is included. However, if %NL80211_ATTR_MAC_HINT is
627 * included, these IEs through %NL80211_ATTR_IE are specified by the user
628 * space based on the best possible BSS selected. Thus, if the driver ends
629 * up selecting a different BSS, it can modify these IEs accordingly (e.g.
630 * userspace asks the driver to perform PMKSA caching with BSS1 and the
631 * driver ends up selecting BSS2 with different PMKSA cache entry; RSNIE
632 * has to get updated with the apt PMKID).
573633 * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
574634 * the ESS in case the device is already associated and an association with
575635 * a different BSS is desired.
639699 * four bytes for vendor frames including the OUI. The registration
640700 * cannot be dropped, but is removed automatically when the netlink
641701 * socket is closed. Multiple registrations can be made.
702 * The %NL80211_ATTR_RECEIVE_MULTICAST flag attribute can be given if
703 * %NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS is available, in which
704 * case the registration can also be modified to include/exclude the
705 * flag, rather than requiring unregistration to change it.
642706 * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for
643707 * backward compatibility
644708 * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This
738802 * various triggers. These triggers can be configured through this
739803 * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
740804 * more background information, see
741 * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
805 * https://wireless.wiki.kernel.org/en/users/Documentation/WoWLAN.
742806 * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
743807 * from the driver reporting the wakeup reason. In this case, the
744808 * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
878942 * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
879943 *
880944 * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the
881 * the new channel information (Channel Switch Announcement - CSA)
945 * new channel information (Channel Switch Announcement - CSA)
882946 * in the beacon for some time (as defined in the
883947 * %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the
884948 * new channel. Userspace provides the new channel information (using
10571121 * randomization may be enabled and configured by specifying the
10581122 * %NL80211_ATTR_MAC and %NL80211_ATTR_MAC_MASK attributes.
10591123 * If a timeout is requested, use the %NL80211_ATTR_TIMEOUT attribute.
1060 * A u64 cookie for further %NL80211_ATTR_COOKIE use is is returned in
1124 * A u64 cookie for further %NL80211_ATTR_COOKIE use is returned in
10611125 * the netlink extended ack message.
10621126 *
10631127 * To cancel a measurement, close the socket that requested it.
11001164 * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
11011165 * content. The frame is ethernet data.
11021166 *
1167 * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
1168 * is passed using %NL80211_ATTR_TID_CONFIG attribute.
1169 *
1170 * @NL80211_CMD_UNPROT_BEACON: Unprotected or incorrectly protected Beacon
1171 * frame. This event is used to indicate that a received Beacon frame was
1172 * dropped because it did not include a valid MME MIC while beacon
1173 * protection was enabled (BIGTK configured in station mode).
1174 *
1175 * @NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS: Report TX status of a control
1176 * port frame transmitted with %NL80211_CMD_CONTROL_PORT_FRAME.
1177 * %NL80211_ATTR_COOKIE identifies the TX command and %NL80211_ATTR_FRAME
1178 * includes the contents of the frame. %NL80211_ATTR_ACK flag is included
1179 * if the recipient acknowledged the frame.
1180 *
11031181 * @NL80211_CMD_MAX: highest used command number
11041182 * @__NL80211_CMD_AFTER_LAST: internal use
11051183 */
13231401 NL80211_CMD_UPDATE_OWE_INFO,
13241402
13251403 NL80211_CMD_PROBE_MESH_LINK,
1404
1405 NL80211_CMD_SET_TID_CONFIG,
1406
1407 NL80211_CMD_UNPROT_BEACON,
1408
1409 NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
13261410
13271411 /* add new commands above here */
13281412
13691453 * of &enum nl80211_chan_width, describing the channel width. See the
13701454 * documentation of the enum for more information.
13711455 * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the
1372 * channel, used for anything but 20 MHz bandwidth
1456 * channel, used for anything but 20 MHz bandwidth. In S1G this is the
1457 * operating channel center frequency.
13731458 * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the
13741459 * channel, used only for 80+80 MHz bandwidth
13751460 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
14341519 * rates as defined by IEEE 802.11 7.3.2.2 but without the length
14351520 * restriction (at most %NL80211_MAX_SUPP_RATES).
14361521 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
1437 * to, or the AP interface the station was originally added to to.
1522 * to, or the AP interface the station was originally added to.
14381523 * @NL80211_ATTR_STA_INFO: information about a station, part of station info
14391524 * given for %NL80211_CMD_GET_STATION, nested attribute containing
14401525 * info as possible, see &enum nl80211_sta_info.
15791664 * flag is included, then control port frames are sent over NL80211 instead
15801665 * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is
15811666 * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
1582 * flag.
1667 * flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth
1668 * frames are not forwared over the control port.
15831669 *
15841670 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
15851671 * We recommend using nested, driver-specific attributes within this.
20062092 * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
20072093 *
20082094 * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
2009 * supported operating classes.
2095 * operating classes.
20102096 *
20112097 * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space
20122098 * controls DFS operation in IBSS mode. If the flag is included in
22842370 *
22852371 * @NL80211_ATTR_PMK: attribute for passing PMK key material. Used with
22862372 * %NL80211_CMD_SET_PMKSA for the PMKSA identified by %NL80211_ATTR_PMKID.
2287 * For %NL80211_CMD_CONNECT it is used to provide PSK for offloading 4-way
2288 * handshake for WPA/WPA2-PSK networks. For 802.1X authentication it is
2289 * used with %NL80211_CMD_SET_PMK. For offloaded FT support this attribute
2290 * specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME is included as well.
2373 * For %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP it is used to provide
2374 * PSK for offloading 4-way handshake for WPA/WPA2-PSK networks. For 802.1X
2375 * authentication it is used with %NL80211_CMD_SET_PMK. For offloaded FT
2376 * support this attribute specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME
2377 * is included as well.
22912378 *
22922379 * @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to
22932380 * indicate that it supports multiple active scheduled scan requests.
23172404 * nl80211_txq_stats)
23182405 * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy.
23192406 * The smaller of this and the memory limit is enforced.
2320 * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the
2407 * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory limit (in bytes) for the
23212408 * TXQ queues for this phy. The smaller of this and the packet limit is
23222409 * enforced.
23232410 * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes
23722459 * the allowed channel bandwidth configurations. (u8 attribute)
23732460 * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
23742461 *
2462 * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
2463 * (u16).
2464 *
2465 * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings.
2466 *
2467 * @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry
2468 * using attributes from &enum nl80211_iftype_akm_attributes. This
2469 * attribute is sent in a response to %NL80211_CMD_GET_WIPHY indicating
2470 * supported AKM suites capability per interface. AKMs advertised in
2471 * %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not
2472 * advertised for a specific interface type.
2473 *
2474 * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
2475 * nested attribute with &enum nl80211_tid_config_attr sub-attributes;
2476 * on output (in wiphy attributes) it contains only the feature sub-
2477 * attributes.
2478 *
2479 * @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control
2480 * port in order to forward/receive them as ordinary data frames.
2481 *
2482 * @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32,
2483 * dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value).
2484 * An optional parameter configured through %NL80211_CMD_SET_PMKSA.
2485 * Drivers that trigger roaming need to know the lifetime of the
2486 * configured PMKSA for triggering the full vs. PMKSA caching based
2487 * authentication. This timeout helps authentication methods like SAE,
2488 * where PMK gets updated only by going through a full (new SAE)
2489 * authentication instead of getting updated during an association for EAP
2490 * authentication. No new full authentication within the PMK expiry shall
2491 * result in a disassociation at the end of the lifetime.
2492 *
2493 * @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in
2494 * terms of percentage of %NL80211_ATTR_PMK_LIFETIME
2495 * (u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional
2496 * parameter configured through %NL80211_CMD_SET_PMKSA. Requests the
2497 * driver to trigger a full authentication roam (without PMKSA caching)
2498 * after the reauthentication threshold time, but before the PMK lifetime
2499 * has expired.
2500 *
2501 * Authentication methods like SAE need to be able to generate a new PMKSA
2502 * entry without having to force a disconnection after the PMK timeout. If
2503 * no roaming occurs between the reauth threshold and PMK expiration,
2504 * disassociation is still forced.
2505 * @NL80211_ATTR_RECEIVE_MULTICAST: multicast flag for the
2506 * %NL80211_CMD_REGISTER_FRAME command, see the description there.
2507 * @NL80211_ATTR_WIPHY_FREQ_OFFSET: offset of the associated
2508 * %NL80211_ATTR_WIPHY_FREQ in positive KHz. Only valid when supplied with
2509 * an %NL80211_ATTR_WIPHY_FREQ_OFFSET.
2510 * @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the
2511 * first channel segment specified in %NL80211_ATTR_CENTER_FREQ1.
2512 * @NL80211_ATTR_SCAN_FREQ_KHZ: nested attribute with KHz frequencies
2513 *
2514 * @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from
2515 * association request when used with NL80211_CMD_NEW_STATION).
2516 *
23752517 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
23762518 * @NL80211_ATTR_MAX: highest attribute number currently defined
23772519 * @__NL80211_ATTR_AFTER_LAST: internal use
28332975
28342976 NL80211_ATTR_WIPHY_EDMG_CHANNELS,
28352977 NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
2978
2979 NL80211_ATTR_VLAN_ID,
2980
2981 NL80211_ATTR_HE_BSS_COLOR,
2982
2983 NL80211_ATTR_IFTYPE_AKM_SUITES,
2984
2985 NL80211_ATTR_TID_CONFIG,
2986
2987 NL80211_ATTR_CONTROL_PORT_NO_PREAUTH,
2988
2989 NL80211_ATTR_PMK_LIFETIME,
2990 NL80211_ATTR_PMK_REAUTH_THRESHOLD,
2991
2992 NL80211_ATTR_RECEIVE_MULTICAST,
2993 NL80211_ATTR_WIPHY_FREQ_OFFSET,
2994 NL80211_ATTR_CENTER_FREQ1_OFFSET,
2995 NL80211_ATTR_SCAN_FREQ_KHZ,
2996
2997 NL80211_ATTR_HE_6GHZ_CAPABILITY,
28362998
28372999 /* add attributes here, update the policy in nl80211.c */
28383000
32173379 * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
32183380 * @NL80211_STA_INFO_ASSOC_AT_BOOTTIME: Timestamp (CLOCK_BOOTTIME, nanoseconds)
32193381 * of STA's association
3382 * @NL80211_STA_INFO_CONNECTED_TO_AS: set to true if STA has a path to a
3383 * authentication server (u8, 0 or 1)
32203384 * @__NL80211_STA_INFO_AFTER_LAST: internal
32213385 * @NL80211_STA_INFO_MAX: highest possible station info attribute
32223386 */
32643428 NL80211_STA_INFO_AIRTIME_WEIGHT,
32653429 NL80211_STA_INFO_AIRTIME_LINK_METRIC,
32663430 NL80211_STA_INFO_ASSOC_AT_BOOTTIME,
3431 NL80211_STA_INFO_CONNECTED_TO_AS,
32673432
32683433 /* keep last */
32693434 __NL80211_STA_INFO_AFTER_LAST,
34123577 * defined in HE capabilities IE
34133578 * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently
34143579 * defined
3580 * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16),
3581 * given for all 6 GHz band channels
34153582 * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
34163583 */
34173584 enum nl80211_band_iftype_attr {
34223589 NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
34233590 NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
34243591 NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
3592 NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
34253593
34263594 /* keep last */
34273595 __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
35533721 * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
35543722 * This is a nested attribute that contains the wmm limitation per AC.
35553723 * (see &enum nl80211_wmm_rule)
3724 * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel
3725 * in current regulatory domain.
3726 * @NL80211_FREQUENCY_ATTR_OFFSET: frequency offset in KHz
35563727 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
35573728 * currently defined
35583729 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
35823753 NL80211_FREQUENCY_ATTR_NO_20MHZ,
35833754 NL80211_FREQUENCY_ATTR_NO_10MHZ,
35843755 NL80211_FREQUENCY_ATTR_WMM,
3756 NL80211_FREQUENCY_ATTR_NO_HE,
3757 NL80211_FREQUENCY_ATTR_OFFSET,
35853758
35863759 /* keep last */
35873760 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
37793952 * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
37803953 * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
37813954 * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
3955 * @NL80211_RRF_NO_HE: HE operation not allowed
37823956 */
37833957 enum nl80211_reg_rule_flags {
37843958 NL80211_RRF_NO_OFDM = 1<<0,
37963970 NL80211_RRF_NO_HT40PLUS = 1<<14,
37973971 NL80211_RRF_NO_80MHZ = 1<<15,
37983972 NL80211_RRF_NO_160MHZ = 1<<16,
3973 NL80211_RRF_NO_HE = 1<<17,
37993974 };
38003975
38013976 #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
40724247 * will advertise that it is connected to a gate in the mesh formation
40734248 * field. If left unset then the mesh formation field will only
40744249 * advertise such if there is an active root mesh path.
4250 *
4251 * @NL80211_MESHCONF_NOLEARN: Try to avoid multi-hop path discovery (e.g.
4252 * PREQ/PREP for HWMP) if the destination is a direct neighbor. Note that
4253 * this might not be the optimal decision as a multi-hop route might be
4254 * better. So if using this setting you will likely also want to disable
4255 * dot11MeshForwarding and use another mesh routing protocol on top.
4256 *
4257 * @NL80211_MESHCONF_CONNECTED_TO_AS: If set to true then this mesh STA
4258 * will advertise that it is connected to a authentication server
4259 * in the mesh formation field.
40754260 *
40764261 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
40774262 */
41064291 NL80211_MESHCONF_AWAKE_WINDOW,
41074292 NL80211_MESHCONF_PLINK_TIMEOUT,
41084293 NL80211_MESHCONF_CONNECTED_TO_GATE,
4294 NL80211_MESHCONF_NOLEARN,
4295 NL80211_MESHCONF_CONNECTED_TO_AS,
41094296
41104297 /* keep last */
41114298 __NL80211_MESHCONF_ATTR_AFTER_LAST,
42744461 * attribute must be provided as well
42754462 * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel
42764463 * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel
4464 * @NL80211_CHAN_WIDTH_1: 1 MHz OFDM channel
4465 * @NL80211_CHAN_WIDTH_2: 2 MHz OFDM channel
4466 * @NL80211_CHAN_WIDTH_4: 4 MHz OFDM channel
4467 * @NL80211_CHAN_WIDTH_8: 8 MHz OFDM channel
4468 * @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel
42774469 */
42784470 enum nl80211_chan_width {
42794471 NL80211_CHAN_WIDTH_20_NOHT,
42844476 NL80211_CHAN_WIDTH_160,
42854477 NL80211_CHAN_WIDTH_5,
42864478 NL80211_CHAN_WIDTH_10,
4479 NL80211_CHAN_WIDTH_1,
4480 NL80211_CHAN_WIDTH_2,
4481 NL80211_CHAN_WIDTH_4,
4482 NL80211_CHAN_WIDTH_8,
4483 NL80211_CHAN_WIDTH_16,
42874484 };
42884485
42894486 /**
42944491 * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible
42954492 * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide
42964493 * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide
4494 * @NL80211_BSS_CHAN_WIDTH_1: control channel is 1 MHz wide
4495 * @NL80211_BSS_CHAN_WIDTH_2: control channel is 2 MHz wide
42974496 */
42984497 enum nl80211_bss_scan_width {
42994498 NL80211_BSS_CHAN_WIDTH_20,
43004499 NL80211_BSS_CHAN_WIDTH_10,
43014500 NL80211_BSS_CHAN_WIDTH_5,
4501 NL80211_BSS_CHAN_WIDTH_1,
4502 NL80211_BSS_CHAN_WIDTH_2,
43024503 };
43034504
43044505 /**
43504551 * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update.
43514552 * Contains a nested array of signal strength attributes (u8, dBm),
43524553 * using the nesting index as the antenna number.
4554 * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz
43534555 * @__NL80211_BSS_AFTER_LAST: internal
43544556 * @NL80211_BSS_MAX: highest BSS attribute
43554557 */
43744576 NL80211_BSS_PARENT_TSF,
43754577 NL80211_BSS_PARENT_BSSID,
43764578 NL80211_BSS_CHAIN_SIGNAL,
4579 NL80211_BSS_FREQUENCY_OFFSET,
43774580
43784581 /* keep last */
43794582 __NL80211_BSS_AFTER_LAST,
45024705 * See &enum nl80211_key_default_types.
45034706 * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
45044707 * Defaults to @NL80211_KEY_RX_TX.
4708 * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key
45054709 *
45064710 * @__NL80211_KEY_AFTER_LAST: internal
45074711 * @NL80211_KEY_MAX: highest key attribute
45174721 NL80211_KEY_TYPE,
45184722 NL80211_KEY_DEFAULT_TYPES,
45194723 NL80211_KEY_MODE,
4724 NL80211_KEY_DEFAULT_BEACON,
45204725
45214726 /* keep last */
45224727 __NL80211_KEY_AFTER_LAST,
45734778 * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
45744779 * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz)
45754780 * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz)
4781 * @NL80211_BAND_S1GHZ: around 900MHz, supported by S1G PHYs
45764782 * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
45774783 * since newer kernel versions may support more bands
45784784 */
45814787 NL80211_BAND_5GHZ,
45824788 NL80211_BAND_60GHZ,
45834789 NL80211_BAND_6GHZ,
4790 NL80211_BAND_S1GHZ,
45844791
45854792 NUM_NL80211_BANDS,
45864793 };
46704877 NL80211_TX_POWER_AUTOMATIC,
46714878 NL80211_TX_POWER_LIMITED,
46724879 NL80211_TX_POWER_FIXED,
4880 };
4881
4882 /**
4883 * enum nl80211_tid_config - TID config state
4884 * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID
4885 * @NL80211_TID_CONFIG_DISABLE: Disable config for the TID
4886 */
4887 enum nl80211_tid_config {
4888 NL80211_TID_CONFIG_ENABLE,
4889 NL80211_TID_CONFIG_DISABLE,
4890 };
4891
4892 /* enum nl80211_tx_rate_setting - TX rate configuration type
4893 * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate
4894 * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter
4895 * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter
4896 */
4897 enum nl80211_tx_rate_setting {
4898 NL80211_TX_RATE_AUTOMATIC,
4899 NL80211_TX_RATE_LIMITED,
4900 NL80211_TX_RATE_FIXED,
4901 };
4902
4903 /* enum nl80211_tid_config_attr - TID specific configuration.
4904 * @NL80211_TID_CONFIG_ATTR_PAD: pad attribute for 64-bit values
4905 * @NL80211_TID_CONFIG_ATTR_VIF_SUPP: a bitmap (u64) of attributes supported
4906 * for per-vif configuration; doesn't list the ones that are generic
4907 * (%NL80211_TID_CONFIG_ATTR_TIDS, %NL80211_TID_CONFIG_ATTR_OVERRIDE).
4908 * @NL80211_TID_CONFIG_ATTR_PEER_SUPP: same as the previous per-vif one, but
4909 * per peer instead.
4910 * @NL80211_TID_CONFIG_ATTR_OVERRIDE: flag attribue, if set indicates
4911 * that the new configuration overrides all previous peer
4912 * configurations, otherwise previous peer specific configurations
4913 * should be left untouched.
4914 * @NL80211_TID_CONFIG_ATTR_TIDS: a bitmask value of TIDs (bit 0 to 7)
4915 * Its type is u16.
4916 * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID.
4917 * specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config.
4918 * Its type is u8.
4919 * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame
4920 * transmission, user-space sets this configuration in
4921 * &NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and
4922 * the max value is advertised by the driver in this attribute on
4923 * output in wiphy capabilities.
4924 * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame
4925 * transmission, user-space sets this configuration in
4926 * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
4927 * the max value is advertised by the driver in this attribute on
4928 * output in wiphy capabilities.
4929 * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable MPDU aggregation
4930 * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS.
4931 * Its type is u8, using the values from &nl80211_tid_config.
4932 * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TIDs
4933 * specified in %NL80211_TID_CONFIG_ATTR_TIDS. It is u8 type, using
4934 * the values from &nl80211_tid_config.
4935 * @NL80211_TID_CONFIG_ATTR_AMSDU_CTRL: Enable/Disable MSDU aggregation
4936 * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS.
4937 * Its type is u8, using the values from &nl80211_tid_config.
4938 * @NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE: This attribute will be useful
4939 * to notfiy the driver that what type of txrate should be used
4940 * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS. using
4941 * the values form &nl80211_tx_rate_setting.
4942 * @NL80211_TID_CONFIG_ATTR_TX_RATE: Data frame TX rate mask should be applied
4943 * with the parameters passed through %NL80211_ATTR_TX_RATES.
4944 * configuration is applied to the data frame for the tid to that connected
4945 * station.
4946 */
4947 enum nl80211_tid_config_attr {
4948 __NL80211_TID_CONFIG_ATTR_INVALID,
4949 NL80211_TID_CONFIG_ATTR_PAD,
4950 NL80211_TID_CONFIG_ATTR_VIF_SUPP,
4951 NL80211_TID_CONFIG_ATTR_PEER_SUPP,
4952 NL80211_TID_CONFIG_ATTR_OVERRIDE,
4953 NL80211_TID_CONFIG_ATTR_TIDS,
4954 NL80211_TID_CONFIG_ATTR_NOACK,
4955 NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
4956 NL80211_TID_CONFIG_ATTR_RETRY_LONG,
4957 NL80211_TID_CONFIG_ATTR_AMPDU_CTRL,
4958 NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL,
4959 NL80211_TID_CONFIG_ATTR_AMSDU_CTRL,
4960 NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE,
4961 NL80211_TID_CONFIG_ATTR_TX_RATE,
4962
4963 /* keep last */
4964 __NL80211_TID_CONFIG_ATTR_AFTER_LAST,
4965 NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1
46734966 };
46744967
46754968 /**
51435436
51445437 #define NL80211_KCK_LEN 16
51455438 #define NL80211_KEK_LEN 16
5439 #define NL80211_KCK_EXT_LEN 24
5440 #define NL80211_KEK_EXT_LEN 32
51465441 #define NL80211_REPLAY_CTR_LEN 8
51475442
51485443 /**
51515446 * @NL80211_REKEY_DATA_KEK: key encryption key (binary)
51525447 * @NL80211_REKEY_DATA_KCK: key confirmation key (binary)
51535448 * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary)
5449 * @NL80211_REKEY_DATA_AKM: AKM data (OUI, suite type)
51545450 * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal)
51555451 * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal)
51565452 */
51595455 NL80211_REKEY_DATA_KEK,
51605456 NL80211_REKEY_DATA_KCK,
51615457 NL80211_REKEY_DATA_REPLAY_CTR,
5458 NL80211_REKEY_DATA_AKM,
51625459
51635460 /* keep last */
51645461 NUM_NL80211_REKEY_DATA,
53795676 * enum nl80211_ext_feature_index - bit index of extended features.
53805677 * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
53815678 * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
5382 * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
5679 * request to use RRM (see %NL80211_ATTR_USE_RRM) with
53835680 * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
53845681 * the ASSOC_REQ_USE_RRM flag in the association request even if
53855682 * NL80211_FEATURE_QUIET is not advertized.
54835780 * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in
54845781 * station mode (SAE password is passed as part of the connect command).
54855782 *
5783 * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev
5784 * with VLAN tagged frames and separate VLAN-specific netdevs added using
5785 * vconfig similarly to the Ethernet case.
5786 *
5787 * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL)
5788 * feature, which prevents bufferbloat by using the expected transmission
5789 * time to limit the amount of data buffered in the hardware.
5790 *
5791 * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection
5792 * and can receive key configuration for BIGTK using key indexes 6 and 7.
5793 * @NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT: The driver supports Beacon
5794 * protection as a client only and cannot transmit protected beacons.
5795 *
5796 * @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the
5797 * forwarding of preauth frames over the control port. They are then
5798 * handled as ordinary data frames.
5799 *
5800 * @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames
5801 *
5802 * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations
5803 * in IBSS mode, essentially by dropping their state.
5804 *
5805 * @NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS: management frame registrations
5806 * are possible for multicast frames and those will be reported properly.
5807 *
5808 * @NL80211_EXT_FEATURE_SCAN_FREQ_KHZ: This driver supports receiving and
5809 * reporting scan request with %NL80211_ATTR_SCAN_FREQ_KHZ. In order to
5810 * report %NL80211_ATTR_SCAN_FREQ_KHZ, %NL80211_SCAN_FLAG_FREQ_KHZ must be
5811 * included in the scan request.
5812 *
5813 * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS: The driver
5814 * can report tx status for control port over nl80211 tx operations.
5815 *
5816 * @NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION: Driver supports Operating
5817 * Channel Validation (OCV) when using driver's SME for RSNA handshakes.
5818 *
5819 * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK: Device wants to do 4-way
5820 * handshake with PSK in AP mode (PSK is passed as part of the start AP
5821 * command).
5822 *
54865823 * @NUM_NL80211_EXT_FEATURES: number of extended features.
54875824 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
54885825 */
55285865 NL80211_EXT_FEATURE_EXT_KEY_ID,
55295866 NL80211_EXT_FEATURE_STA_TX_PWR,
55305867 NL80211_EXT_FEATURE_SAE_OFFLOAD,
5868 NL80211_EXT_FEATURE_VLAN_OFFLOAD,
5869 NL80211_EXT_FEATURE_AQL,
5870 NL80211_EXT_FEATURE_BEACON_PROTECTION,
5871 NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH,
5872 NL80211_EXT_FEATURE_PROTECTED_TWT,
5873 NL80211_EXT_FEATURE_DEL_IBSS_STA,
5874 NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
5875 NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
5876 NL80211_EXT_FEATURE_SCAN_FREQ_KHZ,
5877 NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS,
5878 NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION,
5879 NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK,
55315880
55325881 /* add new features before the definition below */
55335882 NUM_NL80211_EXT_FEATURES,
56395988 * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
56405989 * only have supported rates and no additional capabilities (unless
56415990 * added by userspace explicitly.)
5991 * @NL80211_SCAN_FLAG_FREQ_KHZ: report scan results with
5992 * %NL80211_ATTR_SCAN_FREQ_KHZ. This also means
5993 * %NL80211_ATTR_SCAN_FREQUENCIES will not be included.
56425994 */
56435995 enum nl80211_scan_flags {
56445996 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
56546006 NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10,
56556007 NL80211_SCAN_FLAG_RANDOM_SN = 1<<11,
56566008 NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12,
6009 NL80211_SCAN_FLAG_FREQ_KHZ = 1<<13,
56576010 };
56586011
56596012 /**
57416094 };
57426095
57436096 /**
5744 * enum enum nl80211_protocol_features - nl80211 protocol features
6097 * enum nl80211_protocol_features - nl80211 protocol features
57456098 * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting
57466099 * wiphy dumps (if requested by the application with the attribute
57476100 * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
61506503 * @NL80211_PREAMBLE_HT: HT preamble
61516504 * @NL80211_PREAMBLE_VHT: VHT preamble
61526505 * @NL80211_PREAMBLE_DMG: DMG preamble
6506 * @NL80211_PREAMBLE_HE: HE preamble
61536507 */
61546508 enum nl80211_preamble {
61556509 NL80211_PREAMBLE_LEGACY,
61566510 NL80211_PREAMBLE_HT,
61576511 NL80211_PREAMBLE_VHT,
61586512 NL80211_PREAMBLE_DMG,
6513 NL80211_PREAMBLE_HE,
61596514 };
61606515
61616516 /**
63486703 * is valid)
63496704 * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating
63506705 * the maximum FTMs per burst (if not present anything is valid)
6706 * @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if
6707 * trigger based ranging measurement is supported
6708 * @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating
6709 * if non trigger based ranging measurement is supported
63516710 *
63526711 * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
63536712 * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
63636722 NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
63646723 NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
63656724 NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
6725 NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED,
6726 NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED,
63666727
63676728 /* keep last */
63686729 NUM_NL80211_PMSR_FTM_CAPA_ATTR,
63926753 * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag)
63936754 * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data
63946755 * (flag)
6756 * @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging
6757 * measurement (flag).
6758 * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are
6759 * mutually exclusive.
6760 * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
6761 * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
6762 * ranging will be used.
6763 * @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based
6764 * ranging measurement (flag)
6765 * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are
6766 * mutually exclusive.
6767 * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
6768 * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
6769 * ranging will be used.
63956770 *
63966771 * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
63976772 * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
64086783 NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
64096784 NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
64106785 NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
6786 NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED,
6787 NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,
64116788
64126789 /* keep last */
64136790 NUM_NL80211_PMSR_FTM_REQ_ATTR,
65476924 NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
65486925 };
65496926
6927 /**
6928 * enum nl80211_bss_color_attributes - BSS Color attributes
6929 * @__NL80211_HE_BSS_COLOR_ATTR_INVALID: Invalid
6930 *
6931 * @NL80211_HE_BSS_COLOR_ATTR_COLOR: the current BSS Color.
6932 * @NL80211_HE_BSS_COLOR_ATTR_DISABLED: is BSS coloring disabled.
6933 * @NL80211_HE_BSS_COLOR_ATTR_PARTIAL: the AID equation to be used..
6934 *
6935 * @__NL80211_HE_BSS_COLOR_ATTR_LAST: Internal
6936 * @NL80211_HE_BSS_COLOR_ATTR_MAX: highest BSS Color attribute.
6937 */
6938 enum nl80211_bss_color_attributes {
6939 __NL80211_HE_BSS_COLOR_ATTR_INVALID,
6940
6941 NL80211_HE_BSS_COLOR_ATTR_COLOR,
6942 NL80211_HE_BSS_COLOR_ATTR_DISABLED,
6943 NL80211_HE_BSS_COLOR_ATTR_PARTIAL,
6944
6945 /* keep last */
6946 __NL80211_HE_BSS_COLOR_ATTR_LAST,
6947 NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1,
6948 };
6949
6950 /**
6951 * enum nl80211_iftype_akm_attributes - interface type AKM attributes
6952 * @__NL80211_IFTYPE_AKM_ATTR_INVALID: Invalid
6953 *
6954 * @NL80211_IFTYPE_AKM_ATTR_IFTYPES: nested attribute containing a flag
6955 * attribute for each interface type that supports AKM suites specified in
6956 * %NL80211_IFTYPE_AKM_ATTR_SUITES
6957 * @NL80211_IFTYPE_AKM_ATTR_SUITES: an array of u32. Used to indicate supported
6958 * AKM suites for the specified interface types.
6959 *
6960 * @__NL80211_IFTYPE_AKM_ATTR_LAST: Internal
6961 * @NL80211_IFTYPE_AKM_ATTR_MAX: highest interface type AKM attribute.
6962 */
6963 enum nl80211_iftype_akm_attributes {
6964 __NL80211_IFTYPE_AKM_ATTR_INVALID,
6965
6966 NL80211_IFTYPE_AKM_ATTR_IFTYPES,
6967 NL80211_IFTYPE_AKM_ATTR_SUITES,
6968
6969 /* keep last */
6970 __NL80211_IFTYPE_AKM_ATTR_LAST,
6971 NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
6972 };
65506973
65516974 #endif /* __LINUX_NL80211_H */
208208 PARSE_FLAG(NL80211_RRF_NO_HT40PLUS, "NO-HT40PLUS");
209209 PARSE_FLAG(NL80211_RRF_NO_80MHZ, "NO-80MHZ");
210210 PARSE_FLAG(NL80211_RRF_NO_160MHZ, "NO-160MHZ");
211 PARSE_FLAG(NL80211_RRF_NO_HE, "NO-HE");
211212
212213 /* Kernels that support NO_IR always turn on both flags */
213214 if ((flags & NL80211_RRF_NO_IR) && (flags & __NL80211_RRF_NO_IBSS)) {
242243 char *dump_args[] = { "reg", "dump" };
243244 int err;
244245
246 /*
247 * If PHY was specifically given, get the PHY specific regulatory
248 * information. Otherwise, dump the entire regulatory information.
249 */
250 if (id == II_PHY_IDX || id == II_PHY_NAME) {
251 register_handler(print_reg_handler, NULL);
252 return 0;
253 }
254
245255 err = handle_cmd(state, II_NONE, 2, dump_args);
256
246257 /*
247258 * dump might fail since it's not supported on older kernels,
248259 * in that case the handler is still registered already
254265 }
255266 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get,
256267 "Print out the kernel's current regulatory domain information.");
257 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_get,
268 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_dump,
258269 "Print out the devices' current regulatory domain information.");
259270 HIDDEN(reg, dump, NULL, NL80211_CMD_GET_REG, NLM_F_DUMP, CIB_NONE,
260271 handle_reg_dump);
+277
-22
scan.c less more
581581 printf("\n");
582582 }
583583
584 static void print_rm_enabled_capabilities(const uint8_t type, uint8_t len,
585 const uint8_t *data,
586 const struct print_ies_data *ie_buffer)
587 {
588 __u64 capa = ((__u64) data[0]) |
589 ((__u64) data[1]) << 8 |
590 ((__u64) data[2]) << 16 |
591 ((__u64) data[3]) << 24 |
592 ((__u64) data[4]) << 32;
593
594 printf("\n");
595 printf("\t\tCapabilities: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
596 data[0], data[1],
597 data[2], data[3],
598 data[4]);
599
600 #define PRINT_RM_CAPA(_bit, _str) \
601 do { \
602 if (capa & BIT(_bit)) \
603 printf("\t\t\t" _str "\n"); \
604 } while (0)
605
606 PRINT_RM_CAPA(0, "Link Measurement");
607 PRINT_RM_CAPA(1, "Neighbor Report");
608 PRINT_RM_CAPA(2, "Parallel Measurements");
609 PRINT_RM_CAPA(3, "Repeated Measurements");
610 PRINT_RM_CAPA(4, "Beacon Passive Measurement");
611 PRINT_RM_CAPA(5, "Beacon Active Measurement");
612 PRINT_RM_CAPA(6, "Beacon Table Measurement");
613 PRINT_RM_CAPA(7, "Beacon Measurement Reporting Conditions");
614 PRINT_RM_CAPA(8, "Frame Measurement");
615 PRINT_RM_CAPA(9, "Channel Load");
616 PRINT_RM_CAPA(10, "Noise Histogram Measurement");
617 PRINT_RM_CAPA(11, "Statistics Measurement");
618 PRINT_RM_CAPA(12, "LCI Measurement");
619 PRINT_RM_CAPA(13, "LCI Azimuth");
620 PRINT_RM_CAPA(14, "Transmit Stream/Category Measurement");
621 PRINT_RM_CAPA(15, "Triggered Transmit Stream/Category");
622 PRINT_RM_CAPA(16, "AP Channel Report");
623 PRINT_RM_CAPA(17, "RM MIB Capability");
624
625 PRINT_RM_CAPA(27, "Measurement Pilot Transmission Information");
626 PRINT_RM_CAPA(28, "Neighbor Report TSF Offset");
627 PRINT_RM_CAPA(29, "RCPI Measurement");
628 PRINT_RM_CAPA(30, "RSNI Measurement");
629 PRINT_RM_CAPA(31, "BSS Average Access Delay");
630 PRINT_RM_CAPA(32, "BSS Available Admission");
631 PRINT_RM_CAPA(33, "Antenna");
632 PRINT_RM_CAPA(34, "FTM Range Report");
633 PRINT_RM_CAPA(35, "Civic Location Measurement");
634
635 printf("\t\tNonoperating Channel Max Measurement Duration: %i\n", data[3] >> 5);
636 printf("\t\tMeasurement Pilot Capability: %i\n", data[4] & 7);
637 }
638
584639 static void print_ds(const uint8_t type, uint8_t len, const uint8_t *data,
585640 const struct print_ies_data *ie_buffer)
586641 {
673728 printf(" Use_Protection");
674729 if (data[0] & 0x04)
675730 printf(" Barker_Preamble_Mode");
731 printf("\n");
732 }
733
734 static void print_ap_channel_report(const uint8_t type, uint8_t len, const uint8_t *data,
735 const struct print_ies_data *ie_buffer)
736 {
737 uint8_t oper_class = data[0];
738 int i;
739
740 printf("\n");
741 printf("\t\t * operating class: %d\n", oper_class);
742 printf("\t\t * channel(s):");
743 for (i = 1; i < len; ++i) {
744 printf(" %d", data[i]);
745 }
676746 printf("\n");
677747 }
678748
9471017 printf(" SPP-AMSDU-capable");
9481018 if (capa & 0x0800)
9491019 printf(" SPP-AMSDU-required");
1020 if (capa & 0x2000)
1021 printf(" Extended-Key-ID");
9501022 printf(" (0x%.4x)\n", capa);
9511023 data += 2;
9521024 len -= 2;
10751147 printf("\t\tVenue Type: %i\n", (int)(data[2]));
10761148 }
10771149 if (len == 9)
1078 printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
1150 printf("\t\tHESSID: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
10791151 data[3], data[4], data[5], data[6], data[7], data[8]);
10801152 else if (len == 7)
1081 printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
1153 printf("\t\tHESSID: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
10821154 data[1], data[2], data[3], data[4], data[5], data[6]);
10831155 }
10841156
11371209 printf("Invalid IE length.\n");
11381210 } else {
11391211 for (idx = 0; idx < ln0; idx++) {
1140 printf("%02hx", data[2 + idx]);
1212 printf("%02hhx", data[2 + idx]);
11411213 }
11421214 printf("\n");
11431215 }
11491221 printf("Invalid IE length.\n");
11501222 } else {
11511223 for (idx = 0; idx < ln1; idx++) {
1152 printf("%02hx", data[2 + ln0 + idx]);
1224 printf("%02hhx", data[2 + ln0 + idx]);
11531225 }
11541226 printf("\n");
11551227 }
11611233 printf("Invalid IE length.\n");
11621234 } else {
11631235 for (idx = 0; idx < ln2; idx++) {
1164 printf("%02hx", data[2 + ln0 + ln1 + idx]);
1236 printf("%02hhx", data[2 + ln0 + ln1 + idx]);
11651237 }
11661238 printf("\n");
11671239 }
1240 }
1241 }
1242
1243 static void print_tx_power_envelope(const uint8_t type, uint8_t len,
1244 const uint8_t *data,
1245 const struct print_ies_data *ie_buffer)
1246 {
1247 const uint8_t local_max_tx_power_count = data[0] & 7;
1248 const uint8_t local_max_tx_power_unit_interp = (data[0] >> 3) & 7;
1249 int i;
1250 static const char *power_names[] = {
1251 "Local Maximum Transmit Power For 20 MHz",
1252 "Local Maximum Transmit Power For 40 MHz",
1253 "Local Maximum Transmit Power For 80 MHz",
1254 "Local Maximum Transmit Power For 160/80+80 MHz",
1255 };
1256
1257 printf("\n");
1258
1259 if (local_max_tx_power_count + 2 != len)
1260 return;
1261 if (local_max_tx_power_unit_interp != 0)
1262 return;
1263 for (i = 0; i < local_max_tx_power_count + 1; ++i) {
1264 int8_t power_val = ((int8_t)data[1 + i]) >> 1;
1265 int8_t point5 = data[1 + i] & 1;
1266 if (point5)
1267 printf("\t\t * %s: %i.5 dBm\n", power_names[i], power_val);
1268 else
1269 printf("\t\t * %s: %i dBm\n", power_names[i], power_val);
11681270 }
11691271 }
11701272
13881490 const struct print_ies_data *ie_buffer)
13891491 {
13901492 printf("\n");
1391 print_vht_info(data[0] | (data[1] << 8) |
1392 (data[2] << 16) | (data[3] << 24),
1493 print_vht_info((__u32) data[0] | ((__u32)data[1] << 8) |
1494 ((__u32)data[2] << 16) | ((__u32)data[3] << 24),
13931495 data + 4);
13941496 }
13951497
14091511 printf("\t\t * center freq segment 1: %d\n", data[1]);
14101512 printf("\t\t * center freq segment 2: %d\n", data[2]);
14111513 printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]);
1514 }
1515
1516 static void print_supp_op_classes(const uint8_t type, uint8_t len,
1517 const uint8_t *data,
1518 const struct print_ies_data *ie_buffer)
1519 {
1520 uint8_t *p = (uint8_t*) data;
1521 const uint8_t *next_data = p + len;
1522 int zero_delimiter = 0;
1523 int one_hundred_thirty_delimiter = 0;
1524
1525 printf("\n");
1526 printf("\t\t * current operating class: %d\n", *p);
1527 while (++p < next_data) {
1528 if (*p == 130) {
1529 one_hundred_thirty_delimiter = 1;
1530 break;
1531 }
1532 if (*p == 0) {
1533 zero_delimiter = 0;
1534 break;
1535 }
1536 printf("\t\t * operating class: %d\n", *p);
1537 }
1538 if (one_hundred_thirty_delimiter)
1539 while (++p < next_data) {
1540 printf("\t\t * current operating class extension: %d\n", *p);
1541 }
1542 if (zero_delimiter)
1543 while (++p < next_data - 1) {
1544 printf("\t\t * operating class tuple: %d %d\n", p[0], p[1]);
1545 if (*p == 0)
1546 break;
1547 }
1548 }
1549
1550 static void print_measurement_pilot_tx(const uint8_t type, uint8_t len,
1551 const uint8_t *data,
1552 const struct print_ies_data *ie_buffer)
1553 {
1554 uint8_t *p, len_remaining;
1555
1556 printf("\n");
1557 printf("\t\t * interval: %d TUs\n", data[0]);
1558
1559 if (len <= 1)
1560 return;
1561
1562 p = (uint8_t *) data + 1;
1563 len_remaining = len - 1;
1564
1565 while (len_remaining >=5) {
1566 uint8_t subelement_id = *p, len, *end;
1567
1568 p++;
1569 len = *p;
1570 p++;
1571 end = p + len;
1572
1573 len_remaining -= 2;
1574
1575 /* 802.11-2016 only allows vendor specific elements */
1576 if (subelement_id != 221) {
1577 printf("\t\t * <Invalid subelement ID %d>\n", subelement_id);
1578 return;
1579 }
1580
1581 if (len < 3 || len > len_remaining) {
1582 printf(" <Parse error, element too short>\n");
1583 return;
1584 }
1585
1586 printf("\t\t * vendor specific: OUI %.2x:%.2x:%.2x, data:",
1587 p[0], p[1], p[2]);
1588 /* add only two here and use ++p in while loop */
1589 p += 2;
1590
1591 while (++p < end)
1592 printf(" %.2x", *p);
1593 printf("\n");
1594
1595 len_remaining -= len;
1596 }
14121597 }
14131598
14141599 static void print_obss_scan_params(const uint8_t type, uint8_t len,
15321717 [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
15331718 [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
15341719 [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
1720 [51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), },
1721 [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
1722 [66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
15351723 [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
15361724 [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
15371725 [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
15391727 [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
15401728 [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
15411729 [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
1730 [70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
15421731 [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
15431732 [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
15441733 [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
15451734 [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
15461735 [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
1547 [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
1736 [111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), },
1737 [195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), },
15481738 };
15491739
15501740 static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
16541844 while (len >= 4) {
16551845 subtype = (data[0] << 8) + data[1];
16561846 sublen = (data[2] << 8) + data[3];
1657 if (sublen > len)
1847 if (sublen > len - 4)
16581848 break;
16591849
16601850 switch (subtype) {
16611851 case 0x104a:
16621852 tab_on_first(&first);
1853 if (sublen < 1) {
1854 printf("\t * Version: (invalid "
1855 "length %d)\n", sublen);
1856 break;
1857 }
16631858 printf("\t * Version: %d.%d\n", data[4] >> 4, data[4] & 0xF);
16641859 break;
16651860 case 0x1011:
16701865 uint16_t id;
16711866 tab_on_first(&first);
16721867 if (sublen != 2) {
1673 printf("\t * Device Password ID: (invalid "
1674 "length %d)\n", sublen);
1868 printf("\t * Device Password ID: (invalid length %d)\n",
1869 sublen);
16751870 break;
16761871 }
16771872 id = data[4] << 8 | data[5];
16921887 printf("\t * Model Number: %.*s\n", sublen, data + 4);
16931888 break;
16941889 case 0x103b: {
1695 __u8 val = data[4];
1890 __u8 val;
1891
1892 if (sublen < 1) {
1893 printf("\t * Response Type: (invalid length %d)\n",
1894 sublen);
1895 break;
1896 }
1897 val = data[4];
16961898 tab_on_first(&first);
16971899 printf("\t * Response Type: %d%s\n",
16981900 val, val == 3 ? " (AP)" : "");
16991901 break;
17001902 }
17011903 case 0x103c: {
1702 __u8 val = data[4];
1904 __u8 val;
1905
1906 if (sublen < 1) {
1907 printf("\t * RF Bands: (invalid length %d)\n",
1908 sublen);
1909 break;
1910 }
1911 val = data[4];
17031912 tab_on_first(&first);
17041913 printf("\t * RF Bands: 0x%x\n", val);
17051914 break;
17061915 }
17071916 case 0x1041: {
1708 __u8 val = data[4];
1917 __u8 val;
1918
1919 if (sublen < 1) {
1920 printf("\t * Selected Registrar: (invalid length %d)\n",
1921 sublen);
1922 break;
1923 }
1924 val = data[4];
17091925 tab_on_first(&first);
17101926 printf("\t * Selected Registrar: 0x%x\n", val);
17111927 break;
17151931 printf("\t * Serial Number: %.*s\n", sublen, data + 4);
17161932 break;
17171933 case 0x1044: {
1718 __u8 val = data[4];
1934 __u8 val;
1935
1936 if (sublen < 1) {
1937 printf("\t * Wi-Fi Protected Setup State: (invalid length %d)\n",
1938 sublen);
1939 break;
1940 }
1941 val = data[4];
17191942 tab_on_first(&first);
17201943 printf("\t * Wi-Fi Protected Setup State: %d%s%s\n",
17211944 val,
17371960 data[12], data[13], data[14], data[15],
17381961 data[16], data[17], data[18], data[19]);
17391962 break;
1963 case 0x1049:
1964 tab_on_first(&first);
1965 if (sublen == 6 &&
1966 data[4] == 0x00 &&
1967 data[5] == 0x37 &&
1968 data[6] == 0x2a &&
1969 data[7] == 0x00 &&
1970 data[8] == 0x01) {
1971 uint8_t v2 = data[9];
1972 printf("\t * Version2: %d.%d\n", v2 >> 4, v2 & 0xf);
1973 } else {
1974 printf("\t * Unknown vendor extension. len=%u\n",
1975 sublen);
1976 }
1977 break;
17401978 case 0x1054: {
17411979 tab_on_first(&first);
17421980 if (sublen != 8) {
1743 printf("\t * Primary Device Type: (invalid "
1744 "length %d)\n", sublen);
1981 printf("\t * Primary Device Type: (invalid length %d)\n",
1982 sublen);
17451983 break;
17461984 }
17471985 printf("\t * Primary Device Type: "
17521990 break;
17531991 }
17541992 case 0x1057: {
1755 __u8 val = data[4];
1993 __u8 val;
17561994 tab_on_first(&first);
1995 if (sublen < 1) {
1996 printf("\t * AP setup locked: (invalid length %d)\n",
1997 sublen);
1998 break;
1999 }
2000 val = data[4];
17572001 printf("\t * AP setup locked: 0x%.2x\n", val);
17582002 break;
17592003 }
17602004 case 0x1008:
17612005 case 0x1053: {
1762 __u16 meth = (data[4] << 8) + data[5];
1763 bool comma = false;
2006 __u16 meth;
2007 bool comma;
2008
2009 if (sublen < 2) {
2010 printf("\t * Config methods: (invalid length %d)\n",
2011 sublen);
2012 break;
2013 }
2014 meth = (data[4] << 8) + data[5];
2015 comma = false;
17642016 tab_on_first(&first);
17652017 printf("\t * %sConfig methods:",
17662018 subtype == 0x1053 ? "Selected Registrar ": "");
18722124 case 0x12: /* invitation flags */
18732125 case 0xdd: /* vendor specific */
18742126 default: {
1875 const __u8 *subdata = data + 4;
2127 const __u8 *subdata = data + 3;
18762128 __u16 tmplen = sublen;
18772129
18782130 tab_on_first(&first);
20172269 .ie = ie,
20182270 .ielen = ielen };
20192271
2020 while (ielen >= 2 && ielen >= ie[1]) {
2272 if (ie == NULL || ielen < 0)
2273 return;
2274
2275 while (ielen >= 2 && ielen - 2 >= ie[1]) {
20212276 if (ie[0] < ARRAY_SIZE(ieprinters) &&
20222277 ieprinters[ie[0]].name &&
20232278 ieprinters[ie[0]].flags & BIT(ptype)) {
255255 if (rinfo[NL80211_RATE_INFO_HE_DCM])
256256 pos += snprintf(pos, buflen - (pos - buf),
257257 " HE-DCM %d", nla_get_u8(rinfo[NL80211_RATE_INFO_HE_DCM]));
258 if (rinfo[NL80211_RATE_INFO_HE_RU_ALLOC])
259 pos += snprintf(pos, buflen - (pos - buf),
260 " HE-RU-ALLOC %d", nla_get_u8(rinfo[NL80211_RATE_INFO_HE_RU_ALLOC]));
258261 }
259262
260263 static char *get_chain_signal(struct nlattr *attr_list)
324327 [NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 },
325328 [NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 },
326329 [NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
330 [NL80211_STA_INFO_AIRTIME_LINK_METRIC] = { .type = NLA_U32 },
331 [NL80211_STA_INFO_CONNECTED_TO_AS] = { .type = NLA_FLAG },
332 [NL80211_STA_INFO_CONNECTED_TO_GATE] = { .type = NLA_FLAG },
327333 };
328334 char *chain;
329335 struct timeval now;
493499 }
494500 printf("\n\tmesh plink:\t%s", state_name);
495501 }
502 if (sinfo[NL80211_STA_INFO_AIRTIME_LINK_METRIC])
503 printf("\n\tmesh airtime link metric: %d",
504 nla_get_u32(sinfo[NL80211_STA_INFO_AIRTIME_LINK_METRIC]));
505 if (sinfo[NL80211_STA_INFO_CONNECTED_TO_GATE])
506 printf("\n\tmesh connected to gate:\t%s",
507 nla_get_u8(sinfo[NL80211_STA_INFO_CONNECTED_TO_GATE]) ?
508 "yes" : "no");
509 if (sinfo[NL80211_STA_INFO_CONNECTED_TO_AS])
510 printf("\n\tmesh connected to auth server:\t%s",
511 nla_get_u8(sinfo[NL80211_STA_INFO_CONNECTED_TO_AS]) ?
512 "yes" : "no");
513
496514 if (sinfo[NL80211_STA_INFO_LOCAL_PM]) {
497515 printf("\n\tmesh local PS mode:\t");
498516 print_power_mode(sinfo[NL80211_STA_INFO_LOCAL_PM]);
179179 else
180180 return 5000 + chan * 5;
181181 break;
182 case NL80211_BAND_6GHZ:
183 /* see 802.11ax D6.1 27.3.23.2 */
184 if (chan == 2)
185 return 5935;
186 if (chan <= 253)
187 return 5950 + chan * 5;
188 break;
182189 case NL80211_BAND_60GHZ:
183 if (chan < 5)
190 if (chan < 7)
184191 return 56160 + chan * 2160;
185192 break;
186193 default:
194201 /* see 802.11-2007 17.3.8.3.2 and Annex J */
195202 if (freq == 2484)
196203 return 14;
204 /* see 802.11ax D6.1 27.3.23.2 and Annex E */
205 else if (freq == 5935)
206 return 2;
197207 else if (freq < 2484)
198208 return (freq - 2407) / 5;
199209 else if (freq >= 4910 && freq <= 4980)
200210 return (freq - 4000) / 5;
211 else if (freq < 5950)
212 return (freq - 5000) / 5;
201213 else if (freq <= 45000) /* DMG band lower limit */
202 return (freq - 5000) / 5;
203 else if (freq >= 58320 && freq <= 64800)
214 /* see 802.11ax D6.1 27.3.23.2 */
215 return (freq - 5950) / 5;
216 else if (freq >= 58320 && freq <= 70200)
204217 return (freq - 56160) / 2160;
205218 else
206219 return 0;
493506 case NL80211_CHAN_WIDTH_80:
494507 case NL80211_CHAN_WIDTH_160:
495508 need_cf1 = true;
509 break;
510 case NL80211_CHAN_WIDTH_1:
511 case NL80211_CHAN_WIDTH_2:
512 case NL80211_CHAN_WIDTH_4:
513 case NL80211_CHAN_WIDTH_8:
514 case NL80211_CHAN_WIDTH_16:
515 /* can't happen yet */
496516 break;
497517 }
498518
00 #!/bin/sh
11
2 VERSION="5.4"
2 VERSION="5.8"
33 OUT="$1"
44
55 # get the absolute path for the OUT file