modules/admin-full: make wireless survey work on actual hardware, add a warning if wpa-supplicant is required but not installed, fix some typos
This commit is contained in:
parent
93215e86d8
commit
64b6f98653
3 changed files with 24 additions and 8 deletions
|
@ -52,12 +52,12 @@ $Id$
|
|||
function format_wifi_encryption(info)
|
||||
if info.wep == true and not info.wpa_version then
|
||||
return "WEP"
|
||||
elseif info.wpa_version then
|
||||
elseif info.wpa then
|
||||
return "<abbr title='Pairwise: %s / Group: %s'>%s - %s</abbr>" % {
|
||||
table.concat(info.pair_ciphers, ", "),
|
||||
table.concat(info.group_ciphers, ", "),
|
||||
(info.wpa_version == 3) and "mixed WPA/WPA2"
|
||||
or (info.wpa_version == 2 and "WPA2" or "WPA"),
|
||||
(info.wpa == 3) and "mixed WPA/WPA2"
|
||||
or (info.wpa == 2 and "WPA2" or "WPA"),
|
||||
table.concat(info.auth_suites, ", ")
|
||||
}
|
||||
else
|
||||
|
@ -100,8 +100,8 @@ $Id$
|
|||
<input type="hidden" name="bssid" value="<%=net.bssid%>" />
|
||||
<input type="hidden" name="channel" value="<%=net.channel%>" />
|
||||
<input type="hidden" name="wep" value="<%=net.wep and 1 or 0%>" />
|
||||
<% if net.wpa_version then %>
|
||||
<input type="hidden" name="wpa_version" value="<%=net.wpa_version%>" />
|
||||
<% if net.wpa then %>
|
||||
<input type="hidden" name="wpa_version" value="<%=net.wpa%>" />
|
||||
<% for _, v in ipairs(net.auth_suites) do %><input type="hidden" name="wpa_suites" value="<%=v%>" />
|
||||
<% end; for _, v in ipairs(net.group_ciphers) do %><input type="hidden" name="wpa_group" value="<%=v%>" />
|
||||
<% end; for _, v in ipairs(net.pair_ciphers) do %><input type="hidden" name="wpa_pairwise" value="<%=v%>" />
|
||||
|
|
|
@ -28,6 +28,18 @@ $Id$
|
|||
local dev = luci.http.formvalue("device")
|
||||
local iw = luci.sys.wifi.getiwinfo(dev)
|
||||
|
||||
local requirement
|
||||
|
||||
if iwinfo.type(dev) == "broadcom" and not nixio.fs.access("/usr/sbin/nas") then
|
||||
requirement = luci.i18n.translatef("a_s_iw_require_nas",
|
||||
"You need to install the <a href='%s'>Broadcom <em>nas</em> supplicant</a> to use WPA!"
|
||||
% luci.dispatcher.build_url("admin/system/packages?url=nas&submit=1"))
|
||||
elseif not nixio.fs.access("/usr/sbin/wpa_supplicant") then
|
||||
requirement = luci.i18n.translatef("a_s_iw_require_wpasupplicant",
|
||||
"You need to install <a href='%s'><em>wpa-supplicant</em></a> to use WPA!"
|
||||
% luci.dispatcher.build_url("admin/system/packages?url=wpa-supplicant&submit=1"))
|
||||
end
|
||||
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
@ -71,6 +83,10 @@ $Id$
|
|||
<input type="hidden" name="wpa_suite" value="psk<%=tonumber(luci.http.formvalue("wpa_version") or 0) == 2 and 2%>" />
|
||||
<% end %>
|
||||
|
||||
<% if requirement then %>
|
||||
<strong class="error"> <%=requirement%></strong>
|
||||
<% end %>
|
||||
|
||||
<br /><br />
|
||||
<% end %>
|
||||
|
||||
|
@ -87,7 +103,7 @@ $Id$
|
|||
|
||||
<% if luci.http.formvalue("mode") == "Ad-Hoc" then %>
|
||||
<input type="checkbox" name="fixed_bssid" value="1" id="cb_fixed_bssid" checked="checked" />
|
||||
<label for="cb_fixed_bssid">Lock to BSSID <%=luci.http.formvalue("bssid")%></label>
|
||||
<label for="cb_fixed_bssid">Lock BSSID to <%=luci.http.formvalue("bssid")%></label>
|
||||
<br />
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ $Id$
|
|||
end
|
||||
|
||||
function find_wifi_frequency(state)
|
||||
if state.active then
|
||||
if state and state.active and state.networks[1] and state.networks[1].info then
|
||||
return string.format("%d (%.03f GHz)",
|
||||
state.networks[1].info.channel,
|
||||
state.networks[1].info.frequency / 1000);
|
||||
|
@ -161,7 +161,7 @@ $Id$
|
|||
<td colspan="2" style="text-align:left">
|
||||
<big><strong><%=state.hwname%> (<%=dev%>)</strong></big><br />
|
||||
<strong>Channel:</strong> <%=find_wifi_frequency(state)%> |
|
||||
<strong>Bitrate:</strong> <%=state.active and (state.networks[1].info.bitrate / 1000) .. " Mb/s" or "n/a"%>
|
||||
<strong>Bitrate:</strong> <%=(state and state.networks[1]) and (state.networks[1].info.bitrate / 1000) .. " Mb/s" or "n/a"%>
|
||||
</td>
|
||||
<td style="width:40px">
|
||||
<a href="<%=luci.dispatcher.build_url("admin/network/wireless_join?device="..dev)%>"><img style="border:none" src="<%=resource%>/cbi/find.gif" alt="Find and join network" title="Find and join network" /></a>
|
||||
|
|
Loading…
Reference in a new issue