]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Use max_remain_on_chan data from nl80211
authorJohannes Berg <johannes.berg@intel.com>
Tue, 1 Feb 2011 16:18:32 +0000 (18:18 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 1 Feb 2011 16:18:32 +0000 (18:18 +0200)
If the driver advertises max_remain_on_chan data, use it instead of
the hardcoded value of 5000. Keep the default at 5000 since that is the
value used by earlier versions of cfg80211/mac80211 and not advertised
in nl80211 for those.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
src/drivers/driver_nl80211.c

index e6df6f0fc3fb24afe5ff7aeebae5fbfb498a41b6..d3b0b650c455e869e91c1f79c4886b4e8cb1daee 100644 (file)
@@ -1476,6 +1476,7 @@ struct wiphy_info_data {
        int auth_supported;
        int connect_supported;
        int offchan_tx_supported;
+       int max_remain_on_chan;
 };
 
 
@@ -1531,6 +1532,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
        if (tb[NL80211_ATTR_OFFCHANNEL_TX_OK])
                info->offchan_tx_supported = 1;
 
+       if (tb[NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION])
+               info->max_remain_on_chan =
+                       nla_get_u32(tb[NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION]);
+
        return NL_SKIP;
 }
 
@@ -1541,6 +1546,10 @@ static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv,
        struct nl_msg *msg;
 
        os_memset(info, 0, sizeof(*info));
+
+       /* default to 5000 since early versions of mac80211 don't set it */
+       info->max_remain_on_chan = 5000;
+
        msg = nlmsg_alloc();
        if (!msg)
                return -1;
@@ -1600,7 +1609,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
        drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
        if (info.p2p_supported)
                drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
-       drv->capa.max_remain_on_chan = 5000;
+       drv->capa.max_remain_on_chan = info.max_remain_on_chan;
 
        return 0;
 }