From 3197cb683ece298c6056c868953f2af93f4aee7f Mon Sep 17 00:00:00 2001 From: Patrick Walther Date: Thu, 23 Jul 2020 17:35:48 +0200 Subject: [PATCH] ADD: [iw] iw added to meta layer BugzId: 65179 --- .../iw/iw/0001-Remove-obsolete-library.patch | 22 ++ .../iw/iw/001-nl80211_h_sync.patch | 41 ++ .../iw/iw/120-antenna_gain.patch | 33 ++ .../iw/iw/130-survey-bss-rx-time.patch | 12 + .../iw/iw/200-reduce_size.patch | 373 ++++++++++++++++++ .../iw/iw/400-wlan-srd-channel.patch | 32 ++ .../iw/iw/401-wlan-indoor-channel.patch | 14 + .../iw/iw/402-show-ant-gain.patch | 16 + .../iw/iw/403-clockbootime.patch | 13 + .../iw/iw/oe-nl80211-compile.patch | 13 + .../iw/iw/separate-objdir.patch | 40 ++ recipes-connectivity/iw/iw_5.4.bb | 51 +++ 12 files changed, 660 insertions(+) create mode 100644 recipes-connectivity/iw/iw/0001-Remove-obsolete-library.patch create mode 100644 recipes-connectivity/iw/iw/001-nl80211_h_sync.patch create mode 100644 recipes-connectivity/iw/iw/120-antenna_gain.patch create mode 100644 recipes-connectivity/iw/iw/130-survey-bss-rx-time.patch create mode 100644 recipes-connectivity/iw/iw/200-reduce_size.patch create mode 100644 recipes-connectivity/iw/iw/400-wlan-srd-channel.patch create mode 100644 recipes-connectivity/iw/iw/401-wlan-indoor-channel.patch create mode 100644 recipes-connectivity/iw/iw/402-show-ant-gain.patch create mode 100644 recipes-connectivity/iw/iw/403-clockbootime.patch create mode 100644 recipes-connectivity/iw/iw/oe-nl80211-compile.patch create mode 100644 recipes-connectivity/iw/iw/separate-objdir.patch create mode 100644 recipes-connectivity/iw/iw_5.4.bb diff --git a/recipes-connectivity/iw/iw/0001-Remove-obsolete-library.patch b/recipes-connectivity/iw/iw/0001-Remove-obsolete-library.patch new file mode 100644 index 0000000..998cbc3 --- /dev/null +++ b/recipes-connectivity/iw/iw/0001-Remove-obsolete-library.patch @@ -0,0 +1,22 @@ +From 13b43a00f498abca2832701e8e343cb0ffa15c70 Mon Sep 17 00:00:00 2001 +From: Moritz Rosenthal +Date: Sat, 29 Feb 2020 18:26:04 +0100 +Subject: [PATCH] Remove obsolete library + +Not needed if we use libnl-tiny +--- + Makefile | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Makefile b/Makefile +index c0560d8..25a40cf 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,7 +63,6 @@ endif + + ifeq ($(NL2FOUND),Y) + CFLAGS += -DCONFIG_LIBNL20 +-LIBS += -lnl-genl + NLLIBNAME = libnl-2.0 + endif + diff --git a/recipes-connectivity/iw/iw/001-nl80211_h_sync.patch b/recipes-connectivity/iw/iw/001-nl80211_h_sync.patch new file mode 100644 index 0000000..6b65f61 --- /dev/null +++ b/recipes-connectivity/iw/iw/001-nl80211_h_sync.patch @@ -0,0 +1,41 @@ +--- a/nl80211.h ++++ b/nl80211.h +@@ -2373,6 +2373,9 @@ enum nl80211_commands { + * the allowed channel bandwidth configurations. (u8 attribute) + * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. + * ++ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce ++ * transmit power to stay within regulatory limits. u32, dBi. ++ * + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -2835,6 +2838,8 @@ enum nl80211_attrs { + NL80211_ATTR_WIPHY_EDMG_CHANNELS, + NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, + ++ NL80211_ATTR_WIPHY_ANTENNA_GAIN, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -5484,6 +5489,10 @@ enum nl80211_feature_flags { + * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in + * station mode (SAE password is passed as part of the connect command). + * ++ * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) ++ * feature, which prevents bufferbloat by using the expected transmission ++ * time to limit the amount of data buffered in the hardware. ++ * + * @NUM_NL80211_EXT_FEATURES: number of extended features. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. + */ +@@ -5529,6 +5538,8 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_EXT_KEY_ID, + NL80211_EXT_FEATURE_STA_TX_PWR, + NL80211_EXT_FEATURE_SAE_OFFLOAD, ++ NL80211_EXT_FEATURE_VLAN_OFFLOAD, ++ NL80211_EXT_FEATURE_AQL, + + /* add new features before the definition below */ + NUM_NL80211_EXT_FEATURES, diff --git a/recipes-connectivity/iw/iw/120-antenna_gain.patch b/recipes-connectivity/iw/iw/120-antenna_gain.patch new file mode 100644 index 0000000..f8d537f --- /dev/null +++ b/recipes-connectivity/iw/iw/120-antenna_gain.patch @@ -0,0 +1,33 @@ +--- a/phy.c ++++ b/phy.c +@@ -855,3 +855,30 @@ static int handle_get_txq(struct nl80211 + COMMAND(get, txq, "", + NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq, + "Get TXQ parameters."); ++ ++static int handle_antenna_gain(struct nl80211_state *state, ++ struct nl_msg *msg, ++ int argc, char **argv, ++ enum id_input id) ++{ ++ char *endptr; ++ int dbm; ++ ++ /* get the required args */ ++ if (argc != 1) ++ return 1; ++ ++ dbm = strtol(argv[0], &endptr, 10); ++ if (*endptr) ++ return 2; ++ ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm); ++ ++ return 0; ++ ++ nla_put_failure: ++ return -ENOBUFS; ++} ++COMMAND(set, antenna_gain, "", ++ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain, ++ "Specify antenna gain."); diff --git a/recipes-connectivity/iw/iw/130-survey-bss-rx-time.patch b/recipes-connectivity/iw/iw/130-survey-bss-rx-time.patch new file mode 100644 index 0000000..d488c14 --- /dev/null +++ b/recipes-connectivity/iw/iw/130-survey-bss-rx-time.patch @@ -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])); diff --git a/recipes-connectivity/iw/iw/200-reduce_size.patch b/recipes-connectivity/iw/iw/200-reduce_size.patch new file mode 100644 index 0000000..58613d5 --- /dev/null +++ b/recipes-connectivity/iw/iw/200-reduce_size.patch @@ -0,0 +1,373 @@ +--- a/event.c ++++ b/event.c +@@ -699,6 +699,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; +@@ -734,6 +735,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_REG_CHANGE: + printf("regulatory domain change: "); + +@@ -812,6 +814,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); +@@ -989,9 +992,9 @@ static int print_event(struct nl_msg *ms + parse_nan_match(tb); + 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 +@@ -164,6 +164,7 @@ static int print_phy_handler(struct nl_m + tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]) + print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]), + nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])); ++#ifdef IW_FULL + if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) { + struct nlattr *nl_iftype; + int rem_band; +@@ -171,6 +172,7 @@ static int print_phy_handler(struct nl_m + nla_for_each_nested(nl_iftype, tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band) + print_he_info(nl_iftype); + } ++#endif + if (tb_band[NL80211_BAND_ATTR_FREQS]) { + if (!band_had_freq) { + printf("\t\tFrequencies:\n"); +@@ -213,6 +215,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) { +@@ -229,6 +232,7 @@ next: + printf("\n"); + } + } ++#endif + } + } + +@@ -294,6 +298,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; +@@ -305,6 +310,7 @@ next: + cipher_name(ciphers[i])); + } + } ++#endif + + if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && + tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) +@@ -324,11 +330,13 @@ next: + printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); + } + ++#ifdef IW_FULL + if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) { + printf("\tsoftware interface modes (can always be added):\n"); + nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode) + printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); + } ++#endif + + if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { + struct nlattr *nl_combi; +@@ -425,6 +433,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) +@@ -522,6 +531,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"); +@@ -560,6 +570,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]); + +@@ -624,6 +635,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"); +@@ -732,6 +744,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) + { +@@ -743,6 +756,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 +@@ -1195,6 +1195,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); +@@ -1522,6 +1525,14 @@ 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), }, ++ [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), }, +@@ -1531,21 +1542,15 @@ static const struct ie_print ieprinters[ + [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), }, + [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), }, + [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), }, + [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), }, ++#endif + }; + + static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, +@@ -2024,6 +2029,7 @@ void print_ies(unsigned char *ie, int ie + ieprinters[ie[0]].flags & BIT(ptype)) { + print_ie(&ieprinters[ie[0]], + ie[0], ie[1], ie + 2, &ie_buffer); ++#ifdef IW_FULL + } else if (ie[0] == 221 /* vendor */) { + print_vendor(ie[1], ie + 2, unknown, ptype); + } else if (unknown) { +@@ -2033,6 +2039,7 @@ void print_ies(unsigned char *ie, int ie + for (i=0; i 45000) + is_dmg = true; ++#endif + } + if (bss[NL80211_BSS_BEACON_INTERVAL]) + printf("\tbeacon interval: %d TUs\n", +@@ -2380,6 +2391,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, +@@ -2390,3 +2402,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) + { +@@ -298,6 +300,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 +@@ -22,6 +22,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 +@@ -759,10 +759,12 @@ static int handle_station_set_plink(stru + nla_put_failure: + return -ENOBUFS; + } ++#ifdef IW_FULL + COMMAND_ALIAS(station, set, " plink_action ", + 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, +@@ -857,11 +859,13 @@ static int handle_station_set_mesh_power + nla_put_failure: + return -ENOBUFS; + } ++#ifdef IW_FULL + COMMAND_ALIAS(station, set, " mesh_power_mode " + "", 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 +@@ -627,9 +627,11 @@ static int handle_interface_wds_peer(str + nla_put_failure: + return -ENOBUFS; + } ++#ifdef IW_FULL + COMMAND(set, peer, "", + 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, +@@ -719,6 +721,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, + " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]\n" +@@ -727,3 +730,4 @@ COMMAND(switch, freq, + "Switch the operating channel by sending a channel switch announcement (CSA)."); + COMMAND(switch, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]", + NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL); ++#endif +--- a/phy.c ++++ b/phy.c +@@ -369,6 +369,7 @@ err_out: + free(cac_trigger_argv); + return err; + } ++#ifdef IW_FULL + TOPLEVEL(cac, "channel [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" + "freq [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" + "freq [5|10|20|40|80|80+80|160] [ []]", +@@ -380,6 +381,7 @@ COMMAND(cac, trigger, + NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_trigger, + "Start or trigger a 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, diff --git a/recipes-connectivity/iw/iw/400-wlan-srd-channel.patch b/recipes-connectivity/iw/iw/400-wlan-srd-channel.patch new file mode 100644 index 0000000..528b7f0 --- /dev/null +++ b/recipes-connectivity/iw/iw/400-wlan-srd-channel.patch @@ -0,0 +1,32 @@ +--- a/info.c 2018-04-24 15:21:57.715128889 +0200 ++++ b/info.c 2018-04-24 15:18:56.415126745 +0200 +@@ -190,6 +190,10 @@ static int print_phy_handler(struct nl_m + + if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR]) + print_flag("radar detection", &open); ++ ++ /* do not use short range device channels */ ++ if (tb_freq[NL80211_FREQUENCY_ATTR_SRD_CHANNEL]) ++ print_flag("SRD", &open); + next: + if (open) + printf(")"); +--- a/nl80211.h 2018-04-24 15:21:57.695128889 +0200 ++++ b/nl80211.h 2018-04-24 15:18:56.415126745 +0200 +@@ -3369,6 +3369,8 @@ enum nl80211_wmm_rule { + * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations. + * This is a nested attribute that contains the wmm limitation per AC. + * (see &enum nl80211_wmm_rule) ++* @NL80211_FREQUENCY_ATTR_SRD_CHANNEL: short range devices mode ++* on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number + * currently defined + * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use +@@ -3398,6 +3400,7 @@ enum nl80211_frequency_attr { + NL80211_FREQUENCY_ATTR_NO_20MHZ, + NL80211_FREQUENCY_ATTR_NO_10MHZ, + NL80211_FREQUENCY_ATTR_WMM, ++ NL80211_FREQUENCY_ATTR_SRD_CHANNEL, + + /* keep last */ + __NL80211_FREQUENCY_ATTR_AFTER_LAST, diff --git a/recipes-connectivity/iw/iw/401-wlan-indoor-channel.patch b/recipes-connectivity/iw/iw/401-wlan-indoor-channel.patch new file mode 100644 index 0000000..48e15ba --- /dev/null +++ b/recipes-connectivity/iw/iw/401-wlan-indoor-channel.patch @@ -0,0 +1,14 @@ +--- a/info.c 2019-10-14 19:59:03.178904032 +0200 ++++ b/info.c 2019-10-14 19:58:11.990848600 +0200 +@@ -202,6 +202,11 @@ static int print_phy_handler(struct nl_m + /* do not use short range device channels */ + if (tb_freq[NL80211_FREQUENCY_ATTR_SRD_CHANNEL]) + print_flag("SRD", &open); ++ ++ ++ if (tb_freq[NL80211_FREQUENCY_ATTR_INDOOR_ONLY]) ++ print_flag("indoor", &open); ++ + next: + if (open) + printf(")"); diff --git a/recipes-connectivity/iw/iw/402-show-ant-gain.patch b/recipes-connectivity/iw/iw/402-show-ant-gain.patch new file mode 100644 index 0000000..bb0d79e --- /dev/null +++ b/recipes-connectivity/iw/iw/402-show-ant-gain.patch @@ -0,0 +1,16 @@ +--- a/interface.c 2020-03-11 13:26:27.445769058 +0100 ++++ b/interface.c 2020-03-11 13:26:43.397782620 +0100 +@@ -441,6 +441,13 @@ static int print_iface_handler(struct nl + indent, txp / 100, txp % 100); + } + ++ if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) { ++ int32_t gain = (int32_t) nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_GAIN]); ++ ++ printf("%s\tantenna gain %d dBi\n", ++ indent, gain / 100); ++ } ++ + if (tb_msg[NL80211_ATTR_TXQ_STATS]) { + char buf[150]; + parse_txq_stats(buf, sizeof(buf), tb_msg[NL80211_ATTR_TXQ_STATS], 1, -1, indent); diff --git a/recipes-connectivity/iw/iw/403-clockbootime.patch b/recipes-connectivity/iw/iw/403-clockbootime.patch new file mode 100644 index 0000000..210af30 --- /dev/null +++ b/recipes-connectivity/iw/iw/403-clockbootime.patch @@ -0,0 +1,13 @@ +--- a/station.c 2020-05-12 12:41:48.804763531 +0200 ++++ b/station.c 2020-05-12 12:42:20.208799163 +0200 +@@ -12,6 +12,10 @@ + #include "nl80211.h" + #include "iw.h" + ++#ifndef CLOCK_BOOTTIME ++#define CLOCK_BOOTTIME 7 ++#endif ++ + SECTION(station); + + enum plink_state { diff --git a/recipes-connectivity/iw/iw/oe-nl80211-compile.patch b/recipes-connectivity/iw/iw/oe-nl80211-compile.patch new file mode 100644 index 0000000..704bdd6 --- /dev/null +++ b/recipes-connectivity/iw/iw/oe-nl80211-compile.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 47d56d3..f3d5e02 100644 +--- a/Makefile ++++ b/Makefile +@@ -105,7 +105,7 @@ version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefil + + nl80211-commands.inc: nl80211.h + @$(NQ) ' GEN ' $@ +- $(Q)sed 's%^\tNL80211_CMD_%%;t n;d;:n s%^\([^=]*\),.*%\t[NL80211_CMD_\1] = \"\L\1\",%;t;d' nl80211.h | grep -v "reserved" > $@ ++ $(Q)sed 's%^\tNL80211_CMD_%%;t n;d;:n s%^\([^=]*\),.*%\t[NL80211_CMD_\1] = \"\L\1\",%;t;d' $(SRCDIR)/nl80211.h | grep -v "reserved" > $@ + + %.o: %.c iw.h nl80211.h nl80211-commands.inc + @$(NQ) ' CC ' $@ diff --git a/recipes-connectivity/iw/iw/separate-objdir.patch b/recipes-connectivity/iw/iw/separate-objdir.patch new file mode 100644 index 0000000..eab5b43 --- /dev/null +++ b/recipes-connectivity/iw/iw/separate-objdir.patch @@ -0,0 +1,40 @@ +Subject: [PATCH] Support separation of SRCDIR and OBJDIR + +Typical use of VPATH to locate the sources. + +Upstream-Status: Pending + +Signed-off-by: Christopher Larson +Signed-off-by: Maxin B. John +--- +diff -Naur iw-4.3-origin/Makefile iw-4.3/Makefile +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,9 @@ + MAKEFLAGS += --no-print-directory + ++SRCDIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ++OBJDIR ?= $(PWD) ++VPATH = $(SRCDIR) ++ + PREFIX ?= /usr + SBINDIR ?= $(PREFIX)/sbin + MANDIR ?= $(PREFIX)/share/man +@@ -92,7 +96,7 @@ all: $(ALL) + version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefile \ + $(wildcard .git/index .git/refs/tags) + @$(NQ) ' GEN ' $@ +- $(Q)./version.sh $@ ++ $(Q)cd $(SRCDIR) && ./version.sh $(OBJDIR)/$@ + + nl80211-commands.inc: nl80211.h + @$(NQ) ' GEN ' $@ +@@ -100,7 +104,7 @@ nl80211-commands.inc: nl80211.h + + %.o: %.c iw.h nl80211.h nl80211-commands.inc + @$(NQ) ' CC ' $@ +- $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< ++ $(Q)$(CC) -I$(SRCDIR) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + + ifeq ($(IW_ANDROID_BUILD),) + iw: $(OBJS) diff --git a/recipes-connectivity/iw/iw_5.4.bb b/recipes-connectivity/iw/iw_5.4.bb new file mode 100644 index 0000000..0cab368 --- /dev/null +++ b/recipes-connectivity/iw/iw_5.4.bb @@ -0,0 +1,51 @@ +SUMMARY = "nl80211 based CLI configuration utility for wireless devices" +DESCRIPTION = "iw is a new nl80211 based CLI configuration utility for \ +wireless devices. It supports almost all new drivers that have been added \ +to the kernel recently. " +HOMEPAGE = "http://wireless.kernel.org/en/users/Documentation/iw" +SECTION = "base" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://COPYING;md5=878618a5c4af25e9b93ef0be1a93f774" + +DEPENDS = "libnl-tiny" + +SRC_URI = "http://www.kernel.org/pub/software/network/iw/${BP}.tar.xz \ + file://0001-Remove-obsolete-library.patch \ + file://001-nl80211_h_sync.patch \ + file://120-antenna_gain.patch \ + file://130-survey-bss-rx-time.patch \ + file://200-reduce_size.patch \ + file://400-wlan-srd-channel.patch \ + file://401-wlan-indoor-channel.patch \ + file://402-show-ant-gain.patch \ + file://403-clockbootime.patch \ + file://separate-objdir.patch \ + " + +SRC_URI[sha256sum] = "a2469f677088d7b1070a7fbb28f3c747041697e8f6ec70783339cb1bc27a395f" + +inherit pkgconfig + +CFLAGS += "-I${STAGING_DIR_TARGET}/usr/include/libnl-tiny -lnl-tiny -DCONFIG_LIBNL20 -D_GNU_SOURCE" +LDFLAGS += " -Wl,--gc-sections" + +CFLAGS_remove += "-lnl-genl" + +EXTRA_OEMAKE = "\ + -f '${S}/Makefile' \ + \ + 'PREFIX=${prefix}' \ + 'SBINDIR=${sbindir}' \ + 'MANDIR=${mandir}' \ + 'NLLIBNAME=libnl-tiny' \ + 'NL1FOUND=""' \ + 'NL2FOUND=Y' \ +" + +do_compile() { + oe_runmake all +} + +do_install() { + oe_runmake 'DESTDIR=${D}' install +}