]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wext: fix maxrate calculation
authorDan Williams <dcbw@redhat.com>
Tue, 15 Jul 2008 17:07:50 +0000 (20:07 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 15 Jul 2008 17:07:50 +0000 (20:07 +0300)
When scan results got moved from wpa_scan_result -> wpa_scan_res, the
'maxrate' member was dropped from wpa_scan_res.  The D-Bus interface
used 'maxrate', which was replaced with wpa_scan_get_max_rate().
Unfortunately, wpa_scan_get_max_rate() returns 802.11 rate values
directly from the IE, where 'maxrate' was the rate in bits/second.  The
supplicant internally fakes an IE for wpa_scan_res from the value of
wpa_scan_result->maxrate, but interprets ->maxrate as an 802.11 rate
index.

As a side-effect, this fixes a soft-break of the D-Bus control API since
the wpa_scan_res change was introduced.

src/drivers/driver_nl80211.c
src/drivers/driver_wext.c
wpa_supplicant/ctrl_iface_dbus_handlers.c

index af38cb15987c30ba2201f00d3155ccbdf8743010..777b09745e04195022270010b8c9adfa4fd2f0ae 100644 (file)
@@ -1237,7 +1237,11 @@ static void wext_get_scan_rate(struct iw_event *iwe,
                clen -= sizeof(struct iw_param);
                custom += sizeof(struct iw_param);
        }
-       res->maxrate = maxrate;
+
+       /* Convert the maxrate from WE-style (b/s units) to
+        * 802.11 rates (500000 b/s units).
+        */
+       res->maxrate = maxrate / 500000;
 }
 
 
index 4c5ff7b6b2d25c3db1db81bcd9d584272f82056b..a7f4ead5dc427284f5aa7438f70adaf9e0a06658 100644 (file)
@@ -1364,7 +1364,11 @@ static void wext_get_scan_rate(struct iw_event *iwe,
                clen -= sizeof(struct iw_param);
                custom += sizeof(struct iw_param);
        }
-       res->maxrate = maxrate;
+
+       /* Convert the maxrate from WE-style (b/s units) to
+        * 802.11 rates (500000 b/s units).
+        */
+       res->maxrate = maxrate / 500000;
 }
 
 
index 6bf399311e2b276099b1d80f9ed7cc334563b456..62751adfce944c43ac595b78403c467025a41522 100644 (file)
@@ -435,7 +435,7 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
        if (!wpa_dbus_dict_append_int32(&iter_dict, "level", res->level))
                goto error;
        if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate",
-                                       wpa_scan_get_max_rate(res)))
+                                       wpa_scan_get_max_rate(res) * 500000))
                goto error;
 
        if (!wpa_dbus_dict_close_write(&iter, &iter_dict))