]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - interface.c
ibss: use correct "MHz" instead of "MHZ"
[thirdparty/iw.git] / interface.c
index f8e39b37147042826acb6f07824605725ce1c547..4f0821d3942f544aaddbb17024a7178441321204 100644 (file)
@@ -104,6 +104,9 @@ static int get_if_type(int *argc, char ***argv, enum nl80211_iftype *type,
            strcmp(tpstr, "ibss") == 0) {
                *type = NL80211_IFTYPE_ADHOC;
                return 0;
+       } else if (strcmp(tpstr, "ocb") == 0) {
+               *type = NL80211_IFTYPE_OCB;
+               return 0;
        } else if (strcmp(tpstr, "monitor") == 0) {
                *type = NL80211_IFTYPE_MONITOR;
                return 0;
@@ -162,7 +165,6 @@ nla_put_failure:
 }
 
 static int handle_interface_add(struct nl80211_state *state,
-                               struct nl_cb *cb,
                                struct nl_msg *msg,
                                int argc, char **argv,
                                enum id_input id)
@@ -253,7 +255,6 @@ COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [f
        NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
 
 static int handle_interface_del(struct nl80211_state *state,
-                               struct nl_cb *cb,
                                struct nl_msg *msg,
                                int argc, char **argv,
                                enum id_input id)
@@ -367,23 +368,28 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
                printf("\n");
        }
 
+       if (tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]) {
+               uint32_t txp = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]);
+
+               printf("%s\ttxpower %d.%.2d dBm\n",
+                      indent, txp / 100, txp % 100);
+       }
+
        return NL_SKIP;
 }
 
 static int handle_interface_info(struct nl80211_state *state,
-                                struct nl_cb *cb,
                                 struct nl_msg *msg,
                                 int argc, char **argv,
                                 enum id_input id)
 {
-       nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_iface_handler, NULL);
+       register_handler(print_iface_handler, NULL);
        return 0;
 }
 TOPLEVEL(info, NULL, NL80211_CMD_GET_INTERFACE, 0, CIB_NETDEV, handle_interface_info,
         "Show information for this interface.");
 
 static int handle_interface_set(struct nl80211_state *state,
-                               struct nl_cb *cb,
                                struct nl_msg *msg,
                                int argc, char **argv,
                                enum id_input id)
@@ -414,7 +420,6 @@ COMMAND(set, monitor, "<flag>*",
        VALID_FLAGS);
 
 static int handle_interface_meshid(struct nl80211_state *state,
-                                  struct nl_cb *cb,
                                   struct nl_msg *msg,
                                   int argc, char **argv,
                                   enum id_input id)
@@ -438,20 +443,18 @@ COMMAND(set, meshid, "<meshid>",
 static unsigned int dev_dump_wiphy;
 
 static int handle_dev_dump(struct nl80211_state *state,
-                          struct nl_cb *cb,
                           struct nl_msg *msg,
                           int argc, char **argv,
                           enum id_input id)
 {
        dev_dump_wiphy = -1;
-       nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_iface_handler, &dev_dump_wiphy);
+       register_handler(print_iface_handler, &dev_dump_wiphy);
        return 0;
 }
 TOPLEVEL(dev, NULL, NL80211_CMD_GET_INTERFACE, NLM_F_DUMP, CIB_NONE, handle_dev_dump,
         "List all network interfaces for wireless hardware.");
 
 static int handle_interface_type(struct nl80211_state *state,
-                                struct nl_cb *cb,
                                 struct nl_msg *msg,
                                 int argc, char **argv,
                                 enum id_input id)
@@ -478,7 +481,6 @@ COMMAND(set, type, "<type>",
        IFACE_TYPES);
 
 static int handle_interface_4addr(struct nl80211_state *state,
-                                 struct nl_cb *cb,
                                  struct nl_msg *msg,
                                  int argc, char **argv,
                                  enum id_input id)
@@ -492,7 +494,6 @@ COMMAND(set, 4addr, "<on|off>",
        "Set interface 4addr (WDS) mode.");
 
 static int handle_interface_noack_map(struct nl80211_state *state,
-                                     struct nl_cb *cb,
                                      struct nl_msg *msg,
                                      int argc, char **argv,
                                      enum id_input id)
@@ -520,7 +521,6 @@ COMMAND(set, noack_map, "<map>",
 
 
 static int handle_interface_wds_peer(struct nl80211_state *state,
-                                    struct nl_cb *cb,
                                     struct nl_msg *msg,
                                     int argc, char **argv,
                                     enum id_input id)
@@ -552,7 +552,6 @@ COMMAND(set, peer, "<MAC address>",
        "Set interface WDS peer.");
 
 static int set_mcast_rate(struct nl80211_state *state,
-                         struct nl_cb *cb,
                          struct nl_msg *msg,
                          int argc, char **argv,
                          enum id_input id)