Search Linux Wireless

Re: NL80211_CMD_GET_WIPHY reply doesn't fit into nl message buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 29, 2008 at 12:01:20PM +0200, Johannes Berg wrote:

> > I've found out, that NL80211_CMD_GET_WIPHY reply doesn't fit into a message
> > socket buffer now. Used driver is ath5k.
> 
> Ok, humm, I have no idea what to do. I guess we'll somehow have to make
> it possible to split it up on band or channel boundaries. But since
> those are nested it seems somewhat weird to me. Any ideas?

Isn't ath5k reporting quite a large set of channels that would never
really be used? 26 channels on 2.4 GHz and 194(huh!) on 5 GHz.. First
workaround could be to just limit those to somewhat more common set of
channels.

Sure, it would be nice to be able to handle long enough replies, but in
this particular case, I'm not sure whether the reply is that realistic.
Split on band boundary would not be enough here since the 5 GHz band
alone would probably have went beyond the size limit.

> > There is also a bug in hostapd which waits for ACK forever when this error occur
> > in i802_get_hw_feature_data().
> 
> I should replace all the code there with the current code from iw, it's
> much better and actually handles all the corner cases.

I have following (completely untested) patch.. Does it look correct or
do you have something more complete that should be used here?



diff --git a/hostapd/driver_nl80211.c b/hostapd/driver_nl80211.c
index f8c83e1..9b1a0a2 100644
--- a/hostapd/driver_nl80211.c
+++ b/hostapd/driver_nl80211.c
@@ -1531,12 +1531,17 @@ static struct hostapd_hw_modes *i802_get_hw_feature_data(void *priv,
 	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, phy_info_handler, &result);
 	nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_wait_handler, &finished);
 
-	err = nl_recvmsgs(drv->nl_handle, cb);
-
-	if (!finished)
+	if (result.error)
+		err = -1;
+	else if (!finished)
 		err = nl_wait_for_ack(drv->nl_handle);
+	else
+		err = 0;
+
+	if (err >= 0)
+		err = nl_recvmsgs(drv->nl_handle, cb);
 
-	if (err < 0 || result.error) {
+	if (err < 0) {
 		hostapd_free_hw_features(result.modes, *num_modes);
 		result.modes = NULL;
 	}

-- 
Jouni Malinen                                            PGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux