Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status page channel display broken with outdoor mode enabled #2336

Closed
mweinelt opened this issue Dec 13, 2021 · 1 comment · Fixed by #2339
Closed

Status page channel display broken with outdoor mode enabled #2336

mweinelt opened this issue Dec 13, 2021 · 1 comment · Fixed by #2339

Comments

@mweinelt
Copy link
Contributor

mweinelt commented Dec 13, 2021

Bug report

What is the problem?

Status page radio channel display fails with outdoor mode.

				<h3>Radios</h3>
					<table>
						<tr>
								<th>radio0</th>
								<td><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, user-scalable=no" />

		<title>Error</title>

		<link rel="stylesheet" href="/static/status-page.css" type="text/css" />
	</head>
	<body>
		<header>
			<h1>Error</h1>
		</header>
		<div class="container">
			<div class="frame">
				<h2 name="content">500 Internal Server Error</h2>
<p>Sorry, the server encountered an unexpected error.</p>
<pre class="error500">Failed to execute dispatcher target for entry &#39;/&#39;.
The called action terminated with an exception:
/usr/lib/lua/gluon/web/template.lua:43: Failed to execute template &#39;status-page&#39;.
A runtime error occurred: /usr/lib/lua/gluon/web/i18n.lua:29: bad argument #1 to &#39;format&#39; (integer expected, got string)</pre>

			</div>

This is the result of querying ubus call networking.wireless status, which only holds the configuration, but no live channel data. In this special case the config dictionary does not contain channel, but channels, so channel is nil in L46:

local function get_radios(uconn)
local radios = uconn:call("network.wireless", "status", {})
local ret = {}
for radio, info in pairs(radios) do
if info.up then
table.insert(ret, {
name = radio,
channel = info.config.channel,
})
end
end

This is how the status response looks like with outdoor mode enabled:

{
	"radio0": {
		"up": true,
		"pending": false,
		"autostart": true,
		"disabled": false,
		"retry_setup_failed": false,
		"config": {
			"hwmode": "11a",
			"path": "pci0000:00/0000:00:00.0",
			"channel": "auto",
			"htmode": "VHT20",
			"country": "DE",
			"channels": [
				"96-116",
				"132-140"
			],
			"hostapd_options": [
				"country3=0x4f"
			]
		},

What is the expected behaviour?

To get the actual channel we would need to query ubus call hostapd.client0 get_status and make sure index for the client or owe interfacecs , which are managed by hostapd, match the relevant phy index.

# ubus call hostapd.client0 get_status
{
	"status": "ENABLED",
	"freq": 5520,
	"phy": "client0",
	"airtime": {
		"time": 1340796,
		"time_busy": 8998,
		"utilization": 1
	},
	"dfs": {
		"cac_seconds": 60,
		"cac_active": false,
		"cac_seconds_left": 0
	}
}

Gluon Version:

v2021.1-169-ge153ba6b

Site Configuration:

n/a

Custom patches:

n/a

@neocturne
Copy link
Member

neocturne commented Dec 13, 2021

iwinfo-lua might be the better choice here - get_status isn't available on OpenWrt 19.07 (where the status page still uses respondd-module-airtime for channel display, which is currently non-functional after the backport of freifunk-gluon/packages@1412236, so it would be nice to be able to backport #2289 after fixing this issue).

@neocturne neocturne self-assigned this Dec 15, 2021
neocturne added a commit that referenced this issue Dec 15, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes #2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Dec 17, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Dec 21, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Dec 22, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Dec 26, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
herbetom pushed a commit to herbetom/gluon that referenced this issue Dec 30, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Dec 31, 2021
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
mkg20001 pushed a commit to ffgraz/gluon that referenced this issue Jan 12, 2022
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes freifunk-gluon#2336
neocturne added a commit that referenced this issue Feb 3, 2022
The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b ("gluon-status-page: use ubus to get radio channels")
Closes #2336

(cherry picked from commit 201e159)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants