Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 14:35:53 +02:00
commit c06fb25d1f
9263 changed files with 1750214 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
--- a/nl80211.h
+++ b/nl80211.h
@@ -2061,6 +2061,10 @@ enum nl80211_commands {
* @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
* interface combinations. In each nested item, it contains attributes
* defined in &enum nl80211_if_combination_attrs.
+ * If the wiphy uses multiple radios (@NL80211_ATTR_WIPHY_RADIOS is set),
+ * this attribute contains the interface combinations of the first radio.
+ * See @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS for the global wiphy
+ * combinations for the sum of all radios.
* @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
* %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
* are managed in software: interfaces of these types aren't subject to
@@ -2856,6 +2860,17 @@ enum nl80211_commands {
* %NL80211_CMD_ASSOCIATE indicating the SPP A-MSDUs
* are used on this connection
*
+ * @NL80211_ATTR_WIPHY_RADIOS: Nested attribute describing physical radios
+ * belonging to this wiphy. See &enum nl80211_wiphy_radio_attrs.
+ *
+ * @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS: Nested attribute listing the
+ * supported interface combinations for all radios combined. In each
+ * nested item, it contains attributes defined in
+ * &enum nl80211_if_combination_attrs.
+ *
+ * @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32).
+ * A value of 0 means all radios.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3401,6 +3416,11 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_SPP_AMSDU,
+ NL80211_ATTR_WIPHY_RADIOS,
+ NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS,
+
+ NL80211_ATTR_VIF_RADIO_MASK,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -7987,4 +8007,54 @@ enum nl80211_ap_settings_flags {
NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1,
};
+/**
+ * enum nl80211_wiphy_radio_attrs - wiphy radio attributes
+ *
+ * @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid
+ *
+ * @NL80211_WIPHY_RADIO_ATTR_INDEX: Index of this radio (u32)
+ * @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE: Frequency range supported by this
+ * radio. Attribute may be present multiple times.
+ * @NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION: Supported interface
+ * combination for this radio. Attribute may be present multiple times
+ * and contains attributes defined in &enum nl80211_if_combination_attrs.
+ *
+ * @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal
+ * @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute
+ */
+enum nl80211_wiphy_radio_attrs {
+ __NL80211_WIPHY_RADIO_ATTR_INVALID,
+
+ NL80211_WIPHY_RADIO_ATTR_INDEX,
+ NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE,
+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION,
+
+ /* keep last */
+ __NL80211_WIPHY_RADIO_ATTR_LAST,
+ NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST - 1,
+};
+
+/**
+ * enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range
+ *
+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid
+ *
+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start (u32).
+ * The unit is kHz.
+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end (u32).
+ * The unit is kHz.
+ *
+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal
+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute
+ */
+enum nl80211_wiphy_radio_freq_range {
+ __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID,
+
+ NL80211_WIPHY_RADIO_FREQ_ATTR_START,
+ NL80211_WIPHY_RADIO_FREQ_ATTR_END,
+
+ __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST,
+ NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST - 1,
+};
+
#endif /* __LINUX_NL80211_H */

View File

@@ -0,0 +1,68 @@
From 1f3706d10812d70adefe32fe0d7d3a3ec25374f0 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 21 Nov 2021 00:02:57 +0100
Subject: Revert "iw: allow specifying CFLAGS/LIBS externally"
This reverts commit 1325244b77d56fd7a16d1e35fdae0efc151920b1.
The OpenWrt build system provides the CFLAGS and LIBS names from the
package Makefile to overwrite them for libnl-tiny. This is not possible
after this upstream change which we revert here any more
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
Makefile | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -46,30 +46,30 @@ NLLIBNAME = libnl-1
endif
ifeq ($(NL2FOUND),Y)
-override CFLAGS += -DCONFIG_LIBNL20
-override LIBS += -lnl-genl
+CFLAGS += -DCONFIG_LIBNL20
+LIBS += -lnl-genl
NLLIBNAME = libnl-2.0
endif
ifeq ($(NL3xFOUND),Y)
# libnl 3.2 might be found as 3.2 and 3.0
NL3FOUND = N
-override CFLAGS += -DCONFIG_LIBNL30
-override LIBS += -lnl-genl-3
+CFLAGS += -DCONFIG_LIBNL30
+LIBS += -lnl-genl-3
NLLIBNAME = libnl-3.0
endif
ifeq ($(NL3FOUND),Y)
-override CFLAGS += -DCONFIG_LIBNL30
-override LIBS += -lnl-genl
+CFLAGS += -DCONFIG_LIBNL30
+LIBS += -lnl-genl
NLLIBNAME = libnl-3.0
endif
# nl-3.1 has a broken libnl-gnl-3.1.pc file
# as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $?
ifeq ($(NL31FOUND),Y)
-override CFLAGS += -DCONFIG_LIBNL30
-override LIBS += -lnl-genl
+CFLAGS += -DCONFIG_LIBNL30
+LIBS += -lnl-genl
NLLIBNAME = libnl-3.1
endif
@@ -77,8 +77,8 @@ ifeq ($(NLLIBNAME),)
$(error Cannot find development files for any supported version of libnl)
endif
-override LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
-override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
+LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
+CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
endif # NO_PKG_CONFIG
ifeq ($(V),1)

View File

@@ -0,0 +1,12 @@
--- a/survey.c
+++ b/survey.c
@@ -60,6 +60,9 @@ static int print_survey_handler(struct n
if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX])
printf("\tchannel receive time:\t\t%llu ms\n",
(unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));
+ if (sinfo[NL80211_SURVEY_INFO_TIME_BSS_RX])
+ printf("\tchannel BSS receive time:\t%llu ms\n",
+ (unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_BSS_RX]));
if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX])
printf("\tchannel transmit time:\t\t%llu ms\n",
(unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX]));

View File

@@ -0,0 +1,371 @@
--- a/event.c
+++ b/event.c
@@ -973,6 +973,7 @@ static int print_event(struct nl_msg *ms
}
switch (gnlh->cmd) {
+#ifdef IW_FULL
case NL80211_CMD_NEW_WIPHY:
printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break;
@@ -1008,6 +1009,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_SCHED_SCAN_RESULTS:
printf("got scheduled scan results\n");
break;
+#endif
case NL80211_CMD_WIPHY_REG_CHANGE:
case NL80211_CMD_REG_CHANGE:
if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
@@ -1090,6 +1092,7 @@ static int print_event(struct nl_msg *ms
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("del station %s\n", macbuf);
break;
+#ifdef IW_FULL
case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf);
@@ -1297,9 +1300,9 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_ASSOC_COMEBACK: /* 147 */
parse_assoc_comeback(tb, gnlh->cmd);
break;
+#endif
default:
- printf("unknown event %d (%s)\n",
- gnlh->cmd, command_name(gnlh->cmd));
+ printf("unknown event %d\n", gnlh->cmd);
break;
}
--- a/info.c
+++ b/info.c
@@ -446,6 +446,7 @@ next:
}
}
+#ifdef IW_FULL
if (tb_band[NL80211_BAND_ATTR_RATES]) {
printf("\t\tBitrates (non-HT):\n");
nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
@@ -462,6 +463,7 @@ next:
printf("\n");
}
}
+#endif
}
}
@@ -527,6 +529,7 @@ next:
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
int i;
@@ -538,6 +541,7 @@ next:
cipher_name(ciphers[i]));
}
}
+#endif
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
@@ -555,9 +559,11 @@ next:
print_iftype_list("\tSupported interface modes", "\t\t",
tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]);
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES])
print_iftype_list("\tsoftware interface modes (can always be added)",
"\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]);
+#endif
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
struct nlattr *nl_combi;
@@ -647,6 +653,7 @@ broken_combination:
printf("\tinterface combinations are not supported\n");
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
printf("\tSupported commands:\n");
nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
@@ -744,6 +751,7 @@ broken_combination:
printf("\t\t * wake up on TCP connection\n");
}
}
+#endif
if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
printf("\tDevice supports roaming.\n");
@@ -782,6 +790,7 @@ broken_combination:
}
}
+#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
@@ -846,6 +855,7 @@ broken_combination:
if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
}
+#endif
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
printf("\tDevice supports T-DLS.\n");
@@ -914,6 +924,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
"List all wireless devices and their capabilities.");
TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
+#ifdef IW_FULL
static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
int argc, char **argv, enum id_input id)
{
@@ -925,6 +936,7 @@ static int handle_commands(struct nl8021
}
TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
"list all known commands and their decimal & hex value");
+#endif
static int print_feature_handler(struct nl_msg *msg, void *arg)
{
--- a/scan.c
+++ b/scan.c
@@ -1308,6 +1308,9 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * secondary channel offset: %s\n",
ht_secondary_offset[data[1] & 0x3]);
printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
+#ifndef IW_FULL
+ return;
+#endif
printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
@@ -1818,30 +1821,31 @@ static void print_ie(const struct ie_pri
static const struct ie_print ieprinters[] = {
[0] = { "SSID", print_ssid, 0, 32,
BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), },
+ [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
+ [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
+ [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
+ [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
+ [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
+ [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
+ [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
+ [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
+#ifdef IW_FULL
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
[6] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), },
[7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
- [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
[35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
- [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
[47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
[51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), },
[59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
[66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
- [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
- [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
- [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
- [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
- [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
[50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
- [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
@@ -1850,6 +1854,7 @@ static const struct ie_print ieprinters[
[214] = { "Short beacon interval", print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), },
[217] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), },
[232] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), },
+#endif
};
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
@@ -2185,8 +2190,10 @@ static void print_wifi_wps(const uint8_t
static const struct ie_print wifiprinters[] = {
[1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), },
+#ifdef IW_FULL
[2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
[4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
+#endif
};
static inline void print_p2p(const uint8_t type, uint8_t len,
@@ -2349,6 +2356,10 @@ static void print_vendor(unsigned char l
return;
}
+#ifdef IW_FULL
+ return;
+#endif
+
if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) {
if (data[3] < ARRAY_SIZE(wfa_printers) &&
wfa_printers[data[3]].name &&
@@ -2483,6 +2494,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" ESS");
if (capa & WLAN_CAPABILITY_IBSS)
printf(" IBSS");
+#ifdef IW_FULL
if (capa & WLAN_CAPABILITY_CF_POLLABLE)
printf(" CfPollable");
if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
@@ -2511,6 +2523,7 @@ static void print_capa_non_dmg(__u16 cap
printf(" DelayedBACK");
if (capa & WLAN_CAPABILITY_IMM_BACK)
printf(" ImmediateBACK");
+#endif
}
static int print_bss_handler(struct nl_msg *msg, void *arg)
@@ -2601,8 +2614,10 @@ static int print_bss_handler(struct nl_m
else
printf("\tfreq: %d\n", freq);
+#ifdef IW_FULL
if (freq > 45000)
is_dmg = true;
+#endif
}
if (bss[NL80211_BSS_BEACON_INTERVAL])
printf("\tbeacon interval: %d TUs\n",
@@ -2796,6 +2811,7 @@ static int handle_stop_sched_scan(struct
return 0;
}
+#ifdef IW_FULL
COMMAND(scan, sched_start,
SCHED_SCAN_OPTIONS,
NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
@@ -2806,3 +2822,4 @@ COMMAND(scan, sched_start,
COMMAND(scan, sched_stop, "",
NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
"Stop an ongoing scheduled scan.");
+#endif
--- a/util.c
+++ b/util.c
@@ -153,6 +153,7 @@ static const char *commands[NL80211_CMD_
static char cmdbuf[100];
+#ifdef IW_FULL
const char *command_name(enum nl80211_commands cmd)
{
if (cmd <= NL80211_CMD_MAX && commands[cmd])
@@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co
sprintf(cmdbuf, "Unknown command (%d)", cmd);
return cmdbuf;
}
+#endif
int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
{
@@ -313,6 +315,9 @@ int parse_keys(struct nl_msg *msg, char
char keybuf[13];
int pos = 0;
+#ifndef IW_FULL
+ return 1;
+#endif
if (!*argc)
return 1;
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
VERSION_OBJS := $(filter-out version.o, $(_OBJS))
OBJS := $(VERSION_OBJS) version.o
+OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm
+ifdef IW_FULL
+ CFLAGS += -DIW_FULL
+else
+ OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS))
+endif
ALL = iw
ifeq ($(NO_PKG_CONFIG),)
--- a/station.c
+++ b/station.c
@@ -801,10 +801,12 @@ static int handle_station_set_plink(stru
nla_put_failure:
return -ENOBUFS;
}
+#ifdef IW_FULL
COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
"Set mesh peer link action for this station (peer).",
select_station_cmd, station_set_plink);
+#endif
static int handle_station_set_vlan(struct nl80211_state *state,
struct nl_msg *msg,
@@ -899,11 +901,13 @@ static int handle_station_set_mesh_power
nla_put_failure:
return -ENOBUFS;
}
+#ifdef IW_FULL
COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
"<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
handle_station_set_mesh_power_mode,
"Set link-specific mesh power mode for this station",
select_station_cmd, station_set_mesh_power_mode);
+#endif
static int handle_station_set_airtime_weight(struct nl80211_state *state,
struct nl_msg *msg,
--- a/interface.c
+++ b/interface.c
@@ -668,9 +668,11 @@ static int handle_interface_wds_peer(str
nla_put_failure:
return -ENOBUFS;
}
+#ifdef IW_FULL
COMMAND(set, peer, "<MAC address>",
NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
"Set interface WDS peer.");
+#endif
static int set_mcast_rate(struct nl80211_state *state,
struct nl_msg *msg,
@@ -760,6 +762,7 @@ static int handle_chan(struct nl80211_st
return handle_chanfreq(state, msg, true, argc, argv, id);
}
+#ifdef IW_FULL
SECTION(switch);
COMMAND(switch, freq,
"<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
@@ -1031,3 +1034,4 @@ COMMAND(set, tidconf, "[peer <MAC addres
" $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates auto\n"
" $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates limit vht-mcs-5 4:9\n"
);
+#endif
--- a/phy.c
+++ b/phy.c
@@ -403,6 +403,7 @@ err_out:
free(cac_trigger_argv);
return err;
}
+#ifdef IW_FULL
TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
"freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
@@ -422,6 +423,7 @@ COMMAND(cac, background,
NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background,
"Start background channel availability check (CAC) looking to look for\n"
"radars on the given channel.");
+#endif
static int handle_fragmentation(struct nl80211_state *state,
struct nl_msg *msg,

View File

@@ -0,0 +1,252 @@
--- a/info.c
+++ b/info.c
@@ -295,6 +295,151 @@ static void print_pmsr_capabilities(stru
}
}
+static void print_interface_combinations(struct nlattr *ifcomb, bool radio)
+{
+ const char *indent = radio ? "\t" : "";
+ struct nlattr *nl_combi;
+ bool have_combinations = false;
+ int rem;
+
+ nla_for_each_nested(nl_combi, ifcomb, rem) {
+ static struct nla_policy iface_combination_policy[NUM_NL80211_IFACE_COMB] = {
+ [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED },
+ [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 },
+ [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG },
+ [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 },
+ [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
+ static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
+ [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED },
+ [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT];
+ struct nlattr *nl_limit;
+ int err, rem_limit;
+ bool comma = false;
+
+ if (radio && nla_type(nl_combi) !=
+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION)
+ continue;
+
+ if (!have_combinations) {
+ printf("\t%svalid interface combinations:\n", indent);
+ have_combinations = true;
+ }
+
+ printf("\t\t%s * ", indent);
+
+ err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB,
+ nl_combi, iface_combination_policy);
+ if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] ||
+ !tb_comb[NL80211_IFACE_COMB_MAXNUM] ||
+ !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) {
+ printf(" <failed to parse>\n");
+ goto broken_combination;
+ }
+
+ nla_for_each_nested(nl_limit, tb_comb[NL80211_IFACE_COMB_LIMITS], rem_limit) {
+ err = nla_parse_nested(tb_limit, MAX_NL80211_IFACE_LIMIT,
+ nl_limit, iface_limit_policy);
+ if (err || !tb_limit[NL80211_IFACE_LIMIT_TYPES]) {
+ printf("<failed to parse>\n");
+ goto broken_combination;
+ }
+
+ if (comma)
+ printf(", ");
+ comma = true;
+ printf("#{ ");
+ print_iftype_line(tb_limit[NL80211_IFACE_LIMIT_TYPES]);
+ printf(" } <= %u", nla_get_u32(tb_limit[NL80211_IFACE_LIMIT_MAX]));
+ }
+ printf(",\n\t\t%s ", indent);
+
+ printf("total <= %d, #channels <= %d%s",
+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]),
+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]),
+ tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ?
+ ", STA/AP BI must match" : "");
+ if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) {
+ unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]);
+
+ if (widths) {
+ int width;
+ bool first = true;
+
+ printf(", radar detect widths: {");
+ for (width = 0; width < 32; width++)
+ if (widths & (1 << width)) {
+ printf("%s %s",
+ first ? "":",",
+ channel_width_name(width));
+ first = false;
+ }
+ printf(" }\n");
+ }
+ }
+ printf("\n");
+broken_combination:
+ ;
+ }
+
+ if (!have_combinations)
+ printf("\t%sinterface combinations are not supported\n", indent);
+}
+
+static void print_radio_freq(struct nlattr *freqs)
+{
+ struct nlattr *freq;
+ int rem;
+
+ nla_for_each_nested(freq, freqs, rem) {
+ static struct nla_policy freq_policy[NL80211_WIPHY_RADIO_FREQ_ATTR_MAX + 1] = {
+ [NL80211_WIPHY_RADIO_FREQ_ATTR_START] = { .type = NLA_U32 },
+ [NL80211_WIPHY_RADIO_FREQ_ATTR_END] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb[NL80211_WIPHY_RADIO_FREQ_ATTR_MAX + 1];
+ uint32_t start, end;
+
+ if (nla_type(freq) != NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE)
+ continue;
+
+ if (nla_parse_nested(tb, NL80211_WIPHY_RADIO_ATTR_MAX + 1,
+ freq, freq_policy) ||
+ !tb[NL80211_WIPHY_RADIO_FREQ_ATTR_START] ||
+ !tb[NL80211_WIPHY_RADIO_FREQ_ATTR_END])
+ continue;
+
+ start = nla_get_u32(tb[NL80211_WIPHY_RADIO_FREQ_ATTR_START]);
+ end = nla_get_u32(tb[NL80211_WIPHY_RADIO_FREQ_ATTR_END]);
+
+ printf("\t\tfreq range: %.1f MHz - %.1f MHz\n", (float)start / 1000, (float)end / 1000);
+ }
+}
+
+static void print_radios(struct nlattr *radios)
+{
+ struct nlattr *radio;
+ int rem, idx = 0;
+
+ nla_for_each_nested(radio, radios, rem) {
+ static struct nla_policy radio_policy[NL80211_WIPHY_RADIO_ATTR_MAX + 1] = {
+ [NL80211_WIPHY_RADIO_ATTR_INDEX] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb[NL80211_WIPHY_RADIO_ATTR_MAX + 1];
+
+ if (nla_parse_nested(tb, NL80211_WIPHY_RADIO_ATTR_MAX + 1,
+ radio, radio_policy) ||
+ !tb[NL80211_WIPHY_RADIO_ATTR_INDEX])
+ continue;
+
+ printf("\twiphy radio %d:\n", nla_get_u32(tb[NL80211_WIPHY_RADIO_ATTR_INDEX]));
+ print_radio_freq(radio);
+ print_interface_combinations(radio, true);
+ }
+}
+
static int print_phy_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
@@ -565,93 +710,11 @@ next:
"\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]);
#endif
- if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
- struct nlattr *nl_combi;
- int rem_combi;
- bool have_combinations = false;
-
- nla_for_each_nested(nl_combi, tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS], rem_combi) {
- static struct nla_policy iface_combination_policy[NUM_NL80211_IFACE_COMB] = {
- [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED },
- [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 },
- [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG },
- [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 },
- [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 },
- };
- struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
- static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
- [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED },
- [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 },
- };
- struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT];
- struct nlattr *nl_limit;
- int err, rem_limit;
- bool comma = false;
-
- if (!have_combinations) {
- printf("\tvalid interface combinations:\n");
- have_combinations = true;
- }
-
- printf("\t\t * ");
+ if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS])
+ print_interface_combinations(tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS], false);
- err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB,
- nl_combi, iface_combination_policy);
- if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] ||
- !tb_comb[NL80211_IFACE_COMB_MAXNUM] ||
- !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) {
- printf(" <failed to parse>\n");
- goto broken_combination;
- }
-
- nla_for_each_nested(nl_limit, tb_comb[NL80211_IFACE_COMB_LIMITS], rem_limit) {
- err = nla_parse_nested(tb_limit, MAX_NL80211_IFACE_LIMIT,
- nl_limit, iface_limit_policy);
- if (err || !tb_limit[NL80211_IFACE_LIMIT_TYPES]) {
- printf("<failed to parse>\n");
- goto broken_combination;
- }
-
- if (comma)
- printf(", ");
- comma = true;
- printf("#{ ");
- print_iftype_line(tb_limit[NL80211_IFACE_LIMIT_TYPES]);
- printf(" } <= %u", nla_get_u32(tb_limit[NL80211_IFACE_LIMIT_MAX]));
- }
- printf(",\n\t\t ");
-
- printf("total <= %d, #channels <= %d%s",
- nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]),
- nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]),
- tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ?
- ", STA/AP BI must match" : "");
- if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) {
- unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]);
-
- if (widths) {
- int width;
- bool first = true;
-
- printf(", radar detect widths: {");
- for (width = 0; width < 32; width++)
- if (widths & (1 << width)) {
- printf("%s %s",
- first ? "":",",
- channel_width_name(width));
- first = false;
- }
- printf(" }\n");
- }
- }
- printf("\n");
-broken_combination:
- ;
- }
-
- if (!have_combinations)
- printf("\tinterface combinations are not supported\n");
- }
+ if (tb_msg[NL80211_ATTR_WIPHY_RADIOS])
+ print_radios(tb_msg[NL80211_ATTR_WIPHY_RADIOS]);
#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {

View File

@@ -0,0 +1,99 @@
--- a/interface.c
+++ b/interface.c
@@ -226,6 +226,43 @@ nla_put_failure:
return 1;
}
+static int parse_radio_list(char *str, struct nl_msg *msg)
+{
+ unsigned int mask = 0;
+ unsigned long id;
+ char *end;
+
+ if (!str)
+ return 1;
+
+ if (!strcmp(str, "all"))
+ goto out;
+
+ while (1) {
+ if (!*str)
+ return 1;
+
+ id = strtoul(str, &end, 0);
+ if (id > 31)
+ return 1;
+
+ mask |= 1 << id;
+ if (!*end)
+ break;
+
+ if (end == str || *end != ',')
+ return 1;
+
+ str = end + 1;
+ }
+
+out:
+ NLA_PUT_U32(msg, NL80211_ATTR_VIF_RADIO_MASK, mask);
+ return 0;
+nla_put_failure:
+ return 1;
+}
+
static int handle_interface_add(struct nl80211_state *state,
struct nl_msg *msg,
int argc, char **argv,
@@ -287,6 +324,15 @@ try_another:
fprintf(stderr, "flags error\n");
return 2;
}
+ } else if (strcmp(argv[0], "radios") == 0) {
+ argc--;
+ argv++;
+ if (parse_radio_list(argv[0], msg)) {
+ fprintf(stderr, "Invalid radio list\n");
+ return 2;
+ }
+ argc--;
+ argv++;
} else {
return 1;
}
@@ -306,14 +352,14 @@ try_another:
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>] [radios all|<id>[,<id>...]]",
NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
"Add a new virtual interface with the given configuration.\n"
IFACE_TYPES "\n\n"
"The flags are only used for monitor interfaces, valid flags are:\n"
VALID_FLAGS "\n\n"
"The mesh_id is used only for mesh mode.");
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>] [radios all|<id>[,<id>...]]",
NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
static int handle_interface_del(struct nl80211_state *state,
@@ -493,6 +539,19 @@ static int print_iface_handler(struct nl
printf("\n");
}
}
+
+ if (tb_msg[NL80211_ATTR_VIF_RADIO_MASK]) {
+ uint32_t mask = nla_get_u32(tb_msg[NL80211_ATTR_VIF_RADIO_MASK]);
+ int i;
+
+ if (mask) {
+ printf("%s\tRadios:", indent);
+ for (i = 0; mask; i++, mask >>= 1)
+ if (mask & 1)
+ printf(" %d", i);
+ printf("\n");
+ }
+ }
return NL_SKIP;
}