luci-app-dawn: return 0 in case of weird frequency
authorNick Hainke <[email protected]>
Tue, 27 Sep 2022 07:30:15 +0000 (09:30 +0200)
committerJo-Philipp Wich <[email protected]>
Mon, 3 Apr 2023 11:45:03 +0000 (13:45 +0200)
Sometimes 0 is passed to the frequency. Return 0 in that case.

Signed-off-by: Nick Hainke <[email protected]>
(cherry picked from commit 88bb5f31c44926170f2ff43adef91877f4af283b)

applications/luci-app-dawn/luasrc/tools/ieee80211.lua

index b35991ed7d08f0bdb5704b4d1d9c6b4dbb83696d..44b04644274381e345aa1448068a2813dad0d165 100644 (file)
@@ -1,7 +1,9 @@
 module("luci.tools.ieee80211", package.seeall)
 
 function frequency_to_channel(freq)
-       if (freq == 2484) then
+       if (freq <= 2400) then
+               return 0;
+       elseif (freq == 2484) then
                return 14;
        elseif (freq < 2484) then
                return (freq - 2407) / 5;