summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-03-20 12:24:16 +0100
committerThomas Haller <thaller@redhat.com>2020-04-03 11:26:49 +0200
commitc1f473d3428acbdc524aa4bc3741e4107e78e8b5 (patch)
tree412f1a198fa118f2e5bff6dadb5c856e2a59048f
parent2011392fb77cc9108dfb25366f3744241672f4b9 (diff)
downloadNetworkManager-c1f473d3428acbdc524aa4bc3741e4107e78e8b5.tar.gz
wifi: drop workaround for bad values in nm_platform_wifi_get_quality()
This was first introduced by commit 4ed4b491fa75 ('2005-12-31 Dan Williams <dcbw@redhat.com>'), a very long time ago. It got reworked several times, but I don't think this code makes sense anymore. So, if nm_platform_wifi_get_quality() returns an error, we would ignore it for three times, until we would set the strength to the error code (presumably -1). Why? If we cannot read the strength via nl80211/WEXT, then we should just keep whatever we got from supplicant. Drop this. Also, only accept the percentage if it is in a valid range from 0 to 100%. If the driver (or platform code) gives us numbers out of that range, we have no idea what their meaning is. In that case, the value must be fixed in the lower layers, that knows how to convert the value from the actual meaning to the requested percentage.
-rw-r--r--src/devices/wifi/nm-device-wifi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 6355c2153f..54352f297f 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -72,8 +72,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
typedef struct {
- gint8 invalid_strength_counter;
-
CList aps_lst_head;
GHashTable *aps_idx_by_supplicant_path;
@@ -500,16 +498,14 @@ periodic_update (NMDeviceWifi *self)
if (priv->current_ap) {
int percent;
- /* Smooth out the strength to work around crappy drivers */
percent = nm_platform_wifi_get_quality (nm_device_get_platform (NM_DEVICE (self)), ifindex);
- if ( percent >= 0
- || ++priv->invalid_strength_counter > 3) {
+ if ( percent >= 0
+ && percent <= 100) {
if (nm_wifi_ap_set_strength (priv->current_ap, (gint8) percent)) {
#if NM_MORE_LOGGING
_ap_dump (self, LOGL_TRACE, priv->current_ap, "updated", 0);
#endif
}
- priv->invalid_strength_counter = 0;
}
}