wlan-ap-Telecominfraproject/feeds/wifi-ax/iw/patches/200-reduce_size.patch
John Crispin 8cd26b4b50 ipq807x: update to 11.4-CS
Signed-off-by: John Crispin <john@phrozen.org>
2021-09-14 09:16:23 +02:00

458 lines
15 KiB
Diff

--- a/event.c
+++ b/event.c
@@ -42,6 +42,7 @@ static int parse_beacon_hint_chan(struct
return 0;
}
+#ifdef IW_FULL
static void print_frame(struct print_event_args *args, struct nlattr *attr)
{
uint8_t *frame;
@@ -340,7 +341,7 @@ static void parse_vendor_event(struct nl
out:
printf("\n");
}
-
+#endif
static void parse_nan_term(struct nlattr **attrs)
{
struct nlattr *func[NL80211_NAN_FUNC_ATTR_MAX + 1];
@@ -895,15 +896,18 @@ static void parse_ch_switch_notify(struc
static int print_event(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
- struct nlattr *tb[NL80211_ATTR_MAX + 1], *nst;
+ struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct print_event_args *args = arg;
char ifname[100];
char macbuf[6*3];
__u8 reg_type;
struct ieee80211_beacon_channel chan_before_beacon, chan_after_beacon;
__u32 wiphy_idx = 0;
+#ifdef IW_FULL
+ struct nlattr *nst;
int rem_nst;
__u16 status;
+#endif
if (args->time || args->reltime) {
unsigned long long usecs, previous;
@@ -944,6 +948,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;
@@ -979,6 +984,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)
@@ -1061,6 +1067,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);
@@ -1224,6 +1231,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_DEL_WIPHY:
printf("delete wiphy\n");
break;
+#endif
case NL80211_CMD_PEER_MEASUREMENT_RESULT:
parse_pmsr_result(tb, args);
break;
@@ -1255,8 +1263,7 @@ static int print_event(struct nl_msg *ms
parse_ch_switch_notify(tb, gnlh->cmd);
break;
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
@@ -19,6 +19,7 @@ static void print_flag(const char *name,
*open = 1;
}
+#ifdef IW_FULL
static char *cipher_name(__u32 c)
{
static char buf[20];
@@ -56,6 +57,7 @@ static char *cipher_name(__u32 c)
return buf;
}
}
+#endif
static int ext_feature_isset(const unsigned char *ext_features, int ext_features_len,
enum nl80211_ext_feature_index ftidx)
@@ -95,20 +97,21 @@ static int print_phy_handler(struct nl_m
[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
};
-
+#ifdef IW_FULL
struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1];
static struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = {
[NL80211_BITRATE_ATTR_RATE] = { .type = NLA_U32 },
[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG },
};
-
- struct nlattr *nl_band;
- struct nlattr *nl_freq;
struct nlattr *nl_rate;
- struct nlattr *nl_mode;
struct nlattr *nl_cmd;
struct nlattr *nl_if, *nl_ftype;
- int rem_band, rem_freq, rem_rate, rem_mode, rem_cmd, rem_ftype, rem_if;
+ int rem_rate, rem_cmd, rem_ftype, rem_if;
+#endif
+ struct nlattr *nl_band;
+ struct nlattr *nl_freq;
+ struct nlattr *nl_mode;
+ int rem_band, rem_freq, rem_mode;
int open;
/*
* static variables only work here, other applications need to use the
@@ -216,6 +219,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) {
@@ -232,6 +236,7 @@ next:
printf("\n");
}
}
+#endif
}
}
@@ -297,6 +302,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;
@@ -308,6 +314,7 @@ next:
cipher_name(ciphers[i]));
}
}
+#endif
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
@@ -327,11 +334,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;
@@ -428,6 +437,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)
@@ -525,6 +535,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");
@@ -563,6 +574,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]);
@@ -630,6 +642,10 @@ broken_combination:
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
printf("\tDevice supports T-DLS.\n");
+ if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)
+ printf("\tDevice supports TDLS channel switching\n");
+ }
+#endif
if (tb_msg[NL80211_ATTR_EXT_FEATURES]) {
struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES];
@@ -762,6 +778,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)
{
@@ -773,6 +790,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
@@ -559,6 +559,7 @@ static void print_ssid(const uint8_t typ
#define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
+#ifdef IW_FULL
static void print_supprates(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -746,6 +747,7 @@ static void print_ap_channel_report(cons
}
printf("\n");
}
+#endif
static void print_cipher(const uint8_t *data)
{
@@ -1065,12 +1067,14 @@ static void print_rsn_ie(const char *def
_print_rsn_ie(defcipher, defauth, len, data, 0);
}
+#ifdef IW_FULL
static void print_osen_ie(const char *defcipher, const char *defauth,
uint8_t len, const uint8_t *data)
{
printf("\n\t");
_print_rsn_ie(defcipher, defauth, len, data, 1);
}
+#endif
static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1088,6 +1092,7 @@ static void print_ht_capa(const uint8_t
print_ht_mcs(data + 3);
}
+#ifdef IW_FULL
static const char* ntype_11u(uint8_t t)
{
switch (t) {
@@ -1270,6 +1275,7 @@ static void print_tx_power_envelope(cons
printf("\t\t * %s: %i dBm\n", power_names[i], power_val);
}
}
+#endif
static const char *ht_secondary_offset[4] = {
"no secondary",
@@ -1297,6 +1303,7 @@ 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]);
+ return;
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);
@@ -1309,6 +1316,7 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * PCO phase: %d\n", (data[5] & 0x8) >> 3);
}
+#ifdef IW_FULL
static void print_capabilities(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1486,6 +1494,7 @@ static void print_ibssatim(const uint8_t
{
printf(" %d TUs\n", (data[1] << 8) + data[0]);
}
+#endif
static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1514,6 +1523,7 @@ static void print_vht_oper(const uint8_t
printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]);
}
+#ifdef IW_FULL
static void print_supp_op_classes(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -1611,6 +1621,7 @@ static void print_obss_scan_params(const
printf("\t\t * OBSS Scan Activity Threshold: %d.%02d %%\n",
((data[13] << 8) | data[12]) / 100, ((data[13] << 8) | data[12]) % 100);
}
+#endif
static void print_secchan_offs(const uint8_t type, uint8_t len,
const uint8_t *data,
@@ -1622,6 +1633,7 @@ static void print_secchan_offs(const uin
printf(" %d\n", data[0]);
}
+#ifdef IW_FULL
static void print_bss_load(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
{
@@ -1663,6 +1675,7 @@ static void print_mesh_conf(const uint8_
if (data[6] & 0x40)
printf("\t\t\t Mesh Power Save Level\n");
}
+#endif
struct ie_print {
const char *name;
@@ -1707,6 +1720,13 @@ 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), },
+ [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), },
@@ -1716,17 +1736,11 @@ 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), },
[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), },
@@ -1736,8 +1750,10 @@ static const struct ie_print ieprinters[
[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
[111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), },
[195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), },
+#endif
};
+#ifdef IW_FULL
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
const struct print_ies_data *ie_buffer)
{
@@ -2074,6 +2090,7 @@ static const struct ie_print wifiprinter
[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,
const uint8_t *data,
@@ -2169,6 +2186,7 @@ static inline void print_hs20_ind(const
printf("\t\tUnexpected length: %i\n", len);
}
+#ifdef IW_FULL
static void print_wifi_owe_tarns(const uint8_t type, uint8_t len,
const uint8_t *data,
const struct print_ies_data *ie_buffer)
@@ -2262,6 +2280,7 @@ static void print_vendor(unsigned char l
printf(" %.2x", data[i]);
printf("\n");
}
+#endif
void print_ies(unsigned char *ie, int ielen, bool unknown,
enum print_ie_type ptype)
@@ -2279,6 +2298,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) {
@@ -2288,6 +2308,7 @@ void print_ies(unsigned char *ie, int ie
for (i=0; i<ie[1]; i++)
printf(" %.2x", ie[2+i]);
printf("\n");
+#endif
}
ielen -= ie[1] + 2;
ie += ie[1] + 2;
@@ -2328,6 +2349,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)
@@ -2356,6 +2378,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)
@@ -2440,8 +2463,10 @@ static int print_bss_handler(struct nl_m
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
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",
--- a/util.c
+++ b/util.c
@@ -147,6 +147,7 @@ const char *iftype_name(enum nl80211_ift
return modebuf;
}
+#ifdef IW_FULL
static const char *commands[NL80211_CMD_MAX + 1] = {
#include "nl80211-commands.inc"
};
@@ -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)
{