]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - iw.h
iw: scan: fix undefined behaviour in print_vht_capa()
[thirdparty/iw.git] / iw.h
diff --git a/iw.h b/iw.h
index 67e011e9e132952a842c8c2fcb75989ddf504e3e..bc0b3acbc408a649baa34bb8f8ba42f99624322a 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -30,6 +30,9 @@ enum nlmsgerr_attrs {
 #ifndef NLM_F_ACK_TLVS
 #define NLM_F_ACK_TLVS 0x200
 #endif
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
 
 #define ETH_ALEN 6
 #define VHT_MUMIMO_GROUP_LEN 24
@@ -103,8 +106,7 @@ struct chandef {
 
 #define __COMMAND(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help, _sel)\
        static struct cmd                                               \
-       __cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden\
-       __attribute__((used)) __attribute__((section("__cmd"))) = {     \
+       __cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden = {\
                .name = (_name),                                        \
                .args = (_args),                                        \
                .cmd = (_nlcmd),                                        \
@@ -115,7 +117,10 @@ struct chandef {
                .help = (_help),                                        \
                .parent = _section,                                     \
                .selector = (_sel),                                     \
-       }
+       };                                                              \
+       static struct cmd *__cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden ## _p \
+       __attribute__((used,section("__cmd"))) =                        \
+       &__cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden
 #define __ACMD(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help, _sel, _alias)\
        __COMMAND(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help, _sel);\
        static const struct cmd *_alias = &__cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden
@@ -127,9 +132,7 @@ struct chandef {
        __COMMAND(&(__section ## _ ## section), name, #name, args, cmd, flags, 1, idby, handler, NULL, NULL)
 
 #define TOPLEVEL(_name, _args, _nlcmd, _flags, _idby, _handler, _help) \
-       struct cmd                                                      \
-       __section ## _ ## _name                                         \
-       __attribute__((used)) __attribute__((section("__cmd"))) = {     \
+       struct cmd __section ## _ ## _name = {                          \
                .name = (#_name),                                       \
                .args = (_args),                                        \
                .cmd = (_nlcmd),                                        \
@@ -137,13 +140,17 @@ struct chandef {
                .idby = (_idby),                                        \
                .handler = (_handler),                                  \
                .help = (_help),                                        \
-        }
+        };                                                             \
+       static struct cmd *__section ## _ ## _name ## _p                \
+       __attribute__((used,section("__cmd"))) = &__section ## _ ## _name
+
 #define SECTION(_name)                                                 \
-       struct cmd __section ## _ ## _name                              \
-       __attribute__((used)) __attribute__((section("__cmd"))) = {     \
+       struct cmd __section ## _ ## _name = {                          \
                .name = (#_name),                                       \
                .hidden = 1,                                            \
-       }
+       };                                                              \
+       static struct cmd *__section ## _ ## _name ## _p                \
+       __attribute__((used,section("__cmd"))) = &__section ## _ ## _name
 
 #define DECLARE_SECTION(_name)                                         \
        extern struct cmd __section ## _ ## _name;
@@ -166,20 +173,23 @@ __u32 listen_events(struct nl80211_state *state,
 int __prepare_listen_events(struct nl80211_state *state);
 __u32 __do_listen_events(struct nl80211_state *state,
                         const int n_waits, const __u32 *waits,
+                        const int n_prints, const __u32 *prints,
                         struct print_event_args *args);
 
 int valid_handler(struct nl_msg *msg, void *arg);
 void register_handler(int (*handler)(struct nl_msg *, void *), void *data);
 
 int mac_addr_a2n(unsigned char *mac_addr, char *arg);
-void mac_addr_n2a(char *mac_addr, unsigned char *arg);
+void mac_addr_n2a(char *mac_addr, const unsigned char *arg);
 int parse_hex_mask(char *hexmask, unsigned char **result, size_t *result_len,
                   unsigned char **mask);
 unsigned char *parse_hex(char *hex, size_t *outlen);
 
-int parse_keys(struct nl_msg *msg, char **argv, int argc);
+int parse_keys(struct nl_msg *msg, char **argv[], int *argc);
 int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv, int *parsed);
 enum nl80211_chan_width str_to_bw(const char *str);
+int parse_txq_stats(char *buf, int buflen, struct nlattr *tid_stats_attr, int header,
+                   int tid, const char *indent);
 int put_chandef(struct nl_msg *msg, struct chandef *chandef);
 
 void print_ht_mcs(const __u8 *mcs);
@@ -187,6 +197,7 @@ void print_ampdu_length(__u8 exponent);
 void print_ampdu_spacing(__u8 spacing);
 void print_ht_capability(__u16 cap);
 void print_vht_info(__u32 capa, const __u8 *mcs);
+void print_he_info(struct nlattr *nl_iftype);
 
 char *channel_width_name(enum nl80211_chan_width width);
 const char *iftype_name(enum nl80211_iftype iftype);
@@ -218,6 +229,8 @@ void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
 
 int get_cf1(const struct chanmode *chanmode, unsigned long freq);
 
+int parse_random_mac_addr(struct nl_msg *msg, char *addrs);
+
 #define SCHED_SCAN_OPTIONS "[interval <in_msecs> | scan_plans [<interval_secs:iterations>*] <interval_secs>] " \
        "[delay <in_secs>] [freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] "  \
        "[randomise[=<addr>/<mask>]]"
@@ -227,4 +240,9 @@ DECLARE_SECTION(switch);
 DECLARE_SECTION(set);
 DECLARE_SECTION(get);
 
+void nan_bf(uint8_t idx, uint8_t *bf, uint16_t bf_len, const uint8_t *buf,
+           size_t len);
+
+char *hex2bin(const char *hex, char *buf);
+
 #endif /* __IW_H */