]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - station.c
add P2P Device handling primitives
[thirdparty/iw.git] / station.c
index ac73e48d448dd08ef928768195084e15c17b5560..247f44588aeb0c9af5f00cc301c5f50ca6a7d6a6 100644 (file)
--- a/station.c
+++ b/station.c
@@ -58,6 +58,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 
        static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
                [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 },
+               [NL80211_RATE_INFO_BITRATE32] = { .type = NLA_U32 },
                [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 },
                [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG },
                [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
@@ -123,11 +124,14 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
                                     sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) {
                        fprintf(stderr, "failed to parse nested rate attributes!\n");
                } else {
+                       int rate = 0;
                        printf("\n\ttx bitrate:\t");
-                       if (rinfo[NL80211_RATE_INFO_BITRATE]) {
-                               int rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
+                       if (rinfo[NL80211_RATE_INFO_BITRATE32])
+                               rate = nla_get_u32(rinfo[NL80211_RATE_INFO_BITRATE32]);
+                       else if (rinfo[NL80211_RATE_INFO_BITRATE])
+                               rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
+                       if (rate > 0)
                                printf("%d.%d MBit/s", rate / 10, rate % 10);
-                       }
 
                        if (rinfo[NL80211_RATE_INFO_MCS])
                                printf(" MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS]));
@@ -234,7 +238,8 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 static int handle_station_get(struct nl80211_state *state,
                              struct nl_cb *cb,
                              struct nl_msg *msg,
-                             int argc, char **argv)
+                             int argc, char **argv,
+                             enum id_input id)
 {
        unsigned char mac_addr[ETH_ALEN];
 
@@ -284,7 +289,8 @@ static const struct cmd *select_station_cmd(int argc, char **argv)
 static int handle_station_set_plink(struct nl80211_state *state,
                              struct nl_cb *cb,
                              struct nl_msg *msg,
-                             int argc, char **argv)
+                             int argc, char **argv,
+                             enum id_input id)
 {
        unsigned char plink_action;
        unsigned char mac_addr[ETH_ALEN];
@@ -331,9 +337,10 @@ COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
        select_station_cmd, station_set_plink);
 
 static int handle_station_set_vlan(struct nl80211_state *state,
-                             struct nl_cb *cb,
-                             struct nl_msg *msg,
-                             int argc, char **argv)
+                                  struct nl_cb *cb,
+                                  struct nl_msg *msg,
+                                  int argc, char **argv,
+                                  enum id_input id)
 {
        unsigned char mac_addr[ETH_ALEN];
        unsigned long sta_vlan = 0;
@@ -381,7 +388,8 @@ COMMAND_ALIAS(station, set, "<MAC address> vlan <ifindex>",
 static int handle_station_dump(struct nl80211_state *state,
                               struct nl_cb *cb,
                               struct nl_msg *msg,
-                              int argc, char **argv)
+                              int argc, char **argv,
+                              enum id_input id)
 {
        nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_sta_handler, NULL);
        return 0;