]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commit
network-functions.pl: Improve wifi_get_link_quality
authorLeo-Andres Hofmann <hofmann@leo-andres.de>
Fri, 23 Jul 2021 11:09:42 +0000 (13:09 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sun, 5 Sep 2021 08:50:05 +0000 (08:50 +0000)
commit6dd084c22d05271c205a3bacf86da7689e4e3dbb
treedd476b8124ab84f72cb0e4bd9cb1ae160bd8dac8
parentf4858c925c20fb9c930c7ccc0e0bbae03a06efd7
network-functions.pl: Improve wifi_get_link_quality

iwconfig doesn't return values for "Link Quality" if the interface
is disconnected, causing a division by zero error. If there are odd
values, the resulting percentage may contain many decimal places.

This patch makes wifi_get_link_quality return zero instead of failing
and rounds the percentage to a more meaningful integer.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/cfgroot/network-functions.pl