Changelog: a52bda0 (HEAD, tag: v6.17) bump version to 6.17 c5bfa2a iw: add support to print link level information in station dump efaf786 iw: Add support to set per-radio RTS threshold in multi-radio wiphy 009ad3b update nl80211.h aef3798 iw: don't set stupid socket buffer size 8d52fb4 iw: scan: Add partial Multi-Link element printing cfc0695 iw: print HE mcs correctly when mcs_len 8e4808f iw: Add command to enable/disable EPCS 85b79b3 update nl80211.h 612f9f5 iw: Prevent segfault in ftm get stats 1558e60 iw: print NO-EHT flags for reg get command 59660a3 iw: fix EHT capabilities on Big Endian platforms 8ea80d3 iw: scan: Add printing of EHT Operation Element 7c0511b util: rename hz to Hz vol 2 c2a12a5 util: rename hz to Hz 0cc98ae iw: scan: Decode additional WPA3 group ciphers f04e5c5 iw: scan: Decode additional WPA3 AKM suite types 41a07a8 iw: fix HE operation on Big Endian platforms c41971e iw: fix HE capabilities on Big Endian platforms a6ad3f1 iw: scan: add eht capability parsing 4c85991 iw: util: update and clean up eht capa printing a0a7dde iw: scan: replace passed ie buffer with ie context 7bc2a84 iw: print tx power per link for MLD 478ddd4 iw: add output for wiphy interface combinations 93e2309 update nl80211.h 966c590 iw: scan: add enum for element IDs 422419e scan: Add printing of HE Operation Element d088c8a update nl80211.h 73231dd iw: fix formats under MIPS64/PPC 8609336 iw: remove sizer section and related code c8b9e77 util: clarify comment about 'parsed' pointer b29da20 iw: add puncturing support cce9897 iw: refactor frequency help Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Link: https://github.com/openwrt/openwrt/pull/20321 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
100 lines
2.4 KiB
Diff
100 lines
2.4 KiB
Diff
--- 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,
|
|
@@ -498,6 +544,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;
|
|
}
|