]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - ocb.c
iw: display 5/10 MHz channel widths
[thirdparty/iw.git] / ocb.c
diff --git a/ocb.c b/ocb.c
index fc48ecfcf29b7713fa79b2b0dedc8393830470a2..bcf04742c33ea6ddf4b136070e93bdd969d7884d 100644 (file)
--- a/ocb.c
+++ b/ocb.c
@@ -1,4 +1,3 @@
-#include <net/if.h>
 #include <errno.h>
 #include <string.h>
 
@@ -13,15 +12,17 @@ static int join_ocb(struct nl80211_state *state,
 {
        unsigned long freq;
        char *end;
-       int i;
-       static const struct {
-               const char *name;
-               unsigned int width;
-       } *chanmode_selected, chanmode[] = {
-               { .name = "5MHZ",
-                 .width = NL80211_CHAN_WIDTH_5 },
-               { .name = "10MHZ",
-                 .width = NL80211_CHAN_WIDTH_10 },
+       unsigned int i;
+       const struct chanmode *chanmode_selected = NULL;
+       static const struct chanmode chanmode[] = {
+               { .name = "5MHz",
+                 .width = NL80211_CHAN_WIDTH_5,
+                 .freq1_diff = 0,
+                 .chantype = -1 },
+               { .name = "10MHz",
+                 .width = NL80211_CHAN_WIDTH_10,
+                 .freq1_diff = 0,
+                 .chantype = -1 },
        };
 
        if (argc < 2)
@@ -46,7 +47,8 @@ static int join_ocb(struct nl80211_state *state,
        if (chanmode_selected) {
                NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
                            chanmode_selected->width);
-               NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, freq);
+               NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
+                           get_cf1(chanmode_selected, freq));
 
                argv++;
                argc--;
@@ -59,7 +61,7 @@ static int join_ocb(struct nl80211_state *state,
 nla_put_failure:
        return -ENOBUFS;
 }
-COMMAND(ocb, join, "<freq in MHz> <5MHZ|10MHZ>",
+COMMAND(ocb, join, "<freq in MHz> <5MHz|10MHz>",
        NL80211_CMD_JOIN_OCB, 0, CIB_NETDEV, join_ocb,
        "Join the OCB mode network.");