27b1d45 cmd_upgrade: create /ucentral.upgrade
7109e62 add captive portal devices to the bridger block list
Signed-off-by: John Crispin <john@phrozen.org>
/openwrt/build_dir/target-arm_cortex-a7_musl_eabi/uspot/radius.c:264:4: error: label at end of compound statement
default:
^
Signed-off-by: John Crispin <john@phrozen.org>
This is required per documentation and may result in segfault if not
used.
Also remove the "servers" settings which is unnecessary in the context
of a single server.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Streamline the code to make it easier to extend supported attributes,
and to clarify code flow. Improve error checking.
Add licensing information (with permission from John Crispin, original
author).
NB: a few things are still hardcoded toward the end of radius(), to be
revisited.
Cc: John Crispin <john@phrozen.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This carries over two Chilli options used during mac authentication:
- macpasswd, which sets a static password when performing mac-auth
- macsuffix, which allows suffixing the mac address provided as username
These options are implemented in config uspot section as:
- option mac_passwd 'password'
- option mac_suffix 'suffix'
If unset, this commit is a NOP.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
If debug is disabled, this commit deletes the temporary json files
passed to radius-client.
Furthermore, to reduce the risk of collision, use a different prefix in
accounting.uc ('uacct') vs common.uc ('acct').
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
For basic uspot setups, this commit implements a 'generate' verb to
uspot /usr/bin/captive that takes a config uspot section name, and
parses the following extra options to generate the relevant spotfilter
config:
option generate_spotfilter (bool) # if unset/false, generate is a NOP
option interface 'name' # config/network interface name to redirect to
option client_autoremove (bool) # if set/true, sets client_autoremove
list wl_hosts '*.example.com' # optional list of whitelist hostnames
list wl_addrs '1.2.3.4' # optional list of whitelist IPs
"captive generate" is called in spotfilter.init to optionally (depending
on 'generate_spotfilter') create the required spotfilter-XXX.json before
starting spotfilter.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
The current uspot config uses a single named section to assign ifnames
to uspot interfaces like so:
config devices 'devices'
option wlanc0 'hotspot1'
option wlanc1 'hotspot1'
Where 'wlanc0' and 'wlanc1' are physical ifnames.
Code in common.uc also hardcodes a check to match ifnames with 'wlanc*'.
This comit gets rid of the "config device" sections and accepts in the
"config uspot" sections e.g.:
option ifname 'wlanc0'
or
list ifname 'wlanc0'
list ifname 'wlanc1'
The listed devices are then associated with the current uspot config
exactly as they were with the previous configuration system.
The hardcoded check in common.uc is also removed, allowing arbitrary
ifnames to be used.
Malformed sections are ignored with a warning. Subsequent duplicate
entries for a given ifname are be ignored with a warning.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit moves session id creation outside of radius_init() and
stores the identifier in ctx and client data, making it available to
various handlers.
The id is added to the list of uam_url parameters to be sent to the
backend.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Because _md[32] is defined as "char" instead of "unsigned char" in
uc_md5() and sprintf() is used instead of snprintf(), the resulting
string can be malformed (padded with FF for negative values) and
can overflow the target buffer, producing strings like:
21FFFF0D12FFFF6A48651050FFFF4CFFFFFFBA
FFFFFF16FF3EFF7C6560FFFF6BFFFFFFFFFFE7
The same issue affects the hex_to_str() helper function which uc_md5()
does not use.
This commit addresses these issues by:
- refactoring hex_to_str():
- accept a const void * input buffer internally cast to uchar
- use snprintf() and the correct format length modifier 'hh'
- use hex_to_str() in uc_md5()
- adjust uses in other callers to pass sizeof(inbuf)/2 instead of a
hardcoded number
str_to_hex() is also refactored with the same guidelines to simplify the
code and minimally address sscanf() failures by ending conversion.
While there, document these two helpers.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This adds support for dual-image ('rootfs' partitions rotation), for
the YunCore AX840 board. Implementation details are included in the
'base-files' patch this commit adds:
0060-base-files-minimal-support-for-QCA-runtime-failsafe.patch
Fixes: WIFI-12537
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This is required for dual-image support ('rootfs' partitions rotation)
used for example on the YunCore AX840.
Fixes: WIFI-12537
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
a94e2df added the support to remove old public IP file once it is connected successfully to controller
Fixes: WIFI-12474
Signed-off-by: John Crispin <john@phrozen.org>
0af4f34 Added support of retrieval of public IP if not existed and reporting in state msg
Fixes: WIFI-12474
Signed-off-by: John Crispin <john@phrozen.org>
In case of MCU with multiple firmware slots support, change of active
slot requires reset. This obviously results in MCU entering the serial
recovery mode in bootloader, with 5 sec timeout, which in case of UART
based MCUs isn't automatically detected and handled in the same way as
USB based devices (hotplug).
Starting host side support script when the MCU is waiting for MCUmgr
commands during recovery is wrong. This fixes the problem by requesting
UART based MCU to boot the firmware after active slot change followed by
reset. While at it, change also how single slot type MCUs are handled
during upgrade (always request reset after the upgrade).
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This includes shell script for host side support of the 'hci_uart' MCU
firmware type. The script calls 'btattach' with matching tty interface
and baud rate as arguments, resulting in new Bluetooth HCI controller
registration in the system. Both UART and USB interfaces are supported.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This adds support for executing a host side support script per firmware
type (in our case, full MCU firmware name is a combination of two terms:
'version__type', e.g. 'zephyr-v3.3.x__hci_uart') which currently runs on
the MCU. Additionally, support for calling the init script with 'stop'
argument is included.
The host side support scripts will be placed in '/etc/mcu.d/' and should
have executable flag set and be named after the firmware type, with 'sh'
extension (e.g. 'hci_uart.sh'). This solution assumes also that PID of a
running, related service will be stored in '/var/run/mcu.SN.pid' where
'SN' is the associated MCU serial number.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
In case of some of the MCU firmware types, additional setup on the host
side is required before the target application can be used. Example of
such a requirement is a BLE HCI controller on UART bus (firmware type:
'hci_uart') which, before can be registered in system, needs to be
attached to Bluetooth stack (with e.g. 'btattach').
This includes code for generating hidden packages under 'mcu-firmware'
with all the files required for host side support (stored in directory
with the same name as firmware type, under local 'files' directory),
for a selected MCU firmware. For example, below tree:
./feeds/mcu/mcu-firmware/files/hci_uart/etc/...
would result in creation of new package 'zephyr-hci_uart-host-support',
included in dependencies lists for all MCU firmware versions of the
'hci_uart' type, with everything from '.../files/hci_uart/'.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This reduces amount of helper functions and fixes also global variables
handle inside 'mcu.sh' and 'mcu.hotplug' shell scripts. While at it,
provide additional debug information when fetching images list and
system information.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This includes simple upgrade (downgrade) capability in the MCU support
package. If hash of firmware installed on the MCU doesn't match the one
available on host's local file system, it will get upgraded.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Copy 'bluez' package from OpenWrt's packages master branch to 'ucentral'
feed so that we can use latest version and add custom, local changes.
Keep this within 'ucentral' feeds directory to override version provided
by community based 'packages' feed from OpenWrt 21.02.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
54453a6 cmd_script: custom scripts with no uri failed to send the stdout to the server
Fixes: WIFI-12358
Signed-off-by: John Crispin <john@phrozen.org>
In case of some types of MCU firmware, additional tools, daemons, kernel
drivers, etc. are required on the host side. For example, for Bluetooth
HCI controller, at least kernel module and BlueZ should be included.
This adds a simple recipe which generates dependencies list per firmware
type/name and for existing 'hci_usb' and 'hci_uart', selects 3 packages:
'bluez-daemon', 'kmod-bluetooth' and 'kmod-crypto-user'.
Kernel crypto interface in user space has to be also included because
the BlueZ isn't able to create static address for LE-only controller
without it, which results in no registration of new BT interface:
bluetoothd[668]: src/adapter.c:get_static_addr() Failed to open crypto
bluetoothd[668]: No Bluetooth address for index 0
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This includes default configuration for the on-board Nordic nRF52833 MCU
in CIG WF-196. A Zephyr based sample 'hci_uart' firmware is selected.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Include Zephyr v3.3.x based Bluetooth LE HCI UART firmware package in
default packages list for the CIG WF-196. This brings initial support
for the on-board nRF52833 MCU.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This includes default configuration for the on-board Nordic nRF52840 MCU
in EdgeCore EAP102. A Zephyr based sample 'hci_usb' firmware is selected.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Include Zephyr v3.3.x based Bluetooth LE HCI USB firmware package in
default packages list for the EdgeCore EAP102. This brings initial
support for the on-board nRF52840 MCU.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This adds Zephyr firmware builds from custom git branch based on the
latest's upstream branch name 'main': 'main__mcu-on-wifi-boards'.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
The new 'mcu-firmware' package will provide binary firmware dedicated
for MCU embedded on Wi-Fi boards (and also standalone, e.g. USB based),
supported by the OpenWrt/OpenWiFi projects. Currently, only Zephyr RTOS
based sample firmware ('BLE HCI controller' and 'hello world') files are
provided, for Wi-Fi boards and one standalone development module, listed
below:
- CIG WF-196 (Nordic nRF52833, UART bus)
- EdgeCore EAP102 (Nordic nRF52840, USB bus)
- Nordic nRF52840 Dongle (Nordic nRF52840, USB bus)
Different firmware types planned in future include Nordic's nRF Connect
SDK, OpenThread and others.
The Zephyr based firmware comes from a custom fork available in GitLab:
'https://gitlab.com/pepe2k/zephyr' (firmware in this package were built
from a v3.3.0 release based branch 'zephyr-v3.3.x__mcu-on-wifi-boards').
MCU firmware from this package is compatible only with OpenWrt/OpenWiFi
generic MCU support stack which, among others, assumes availability of
compatible bootloader (MCUboot is currently the only one supported) and
e.g. multiple firmware slots. MCUboot fork development takes part in git
repository hosted in GitLab: 'https://gitlab.com/pepe2k/mcuboot/'.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This adds support for creating initial MCU configuration with use of
'uci-defaults' in a same was as for example 'uboot-envtools' package.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
On device running OpenWiFi with uCentral, additional copy of the initial
UCI configuration will be generated in '/etc/config-shadow/'. As part of
the MCU configuration is done during runtime, after the 'config-shadow'
is created, we should update it as well to keep everything in sync.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This introduces new package 'mcu' which is a collection of shell based
scripts used as glue code for generic MCU configuration and management.
The scripts are responsible for communicating with embedded MCU running
compatible MCUboot bootloader version over MCUmgr/SMP protocol.
The communication is realized based on usage of the introduced earlier
dedicated CLI tool called 'umcumgr.
The most important function of this package is a simple MCU's firmware
management (checking firmware available in the MCU's internal flash,
uploading new and selecting active on multi-firmware slot capable MCU).
This solution requires MCU running modified version of MCUboot,
available in GitLab: https://gitlab.com/pepe2k/mcuboot
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
The 'umcumgr' is a simple command line tool for MCU firmware management
over MCUmgr/SMP protocol. It will be used together with MCUboot running
on the on-board (or external, e.g. in form of a dongle) MCU.
While at it, add also dedicated 'mcu.yml' profile file.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This backports more fixes for the Bluetooth subsystem from 4.9.
They were found missing during some initial Bluetooth LE testing.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This backports an essential fix for Bluetooth LE-only HCI devices from
kernel 4.9: 39385cb5f327 ("Bluetooth: Fix using the correct source
address type").
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
86dc187 the developer mode indication should be in the top level of the capa dictionary
f4aca9b indicate secure-rtty by default
Signed-off-by: John Crispin <john@phrozen.org>
2ee157f fix health.uc: the events patch left a stray sprintf( breaking compile
ac9e8cf capabilities: add developer mode info to restrictions
Signed-off-by: John Crispin <john@phrozen.org>
This exports USB related pins in sysfs using 'gpio-export' as:
- usb-rear-power
- usb-side-power
- usb-hub-enable (renamed from 'usb-enable')
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This adds few more pin configs for USB (rear and side ports power) and
MCU (reserved pin, apparently used by device vendor for DTM enable).
While at it, align labels and nodes names with staging branch.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This change focuses on the I/O related cleanups for the CIG WF-196 DTS
file. Most of the removed definitions come from QCA reference files and
should have been adjusted for a custom board. List of changes:
1. Drop 'btcoex' pinctrl mux define
WF-196 includes nRF52833 MCU which doesn't have dedicated PTA coex
hardware interface (see [1] for software based solution in Nordic's
nRF Connect SDK). Based on the real hardware research, defined pins
from 'btcoex' mux aren't routed to nRF52833 MCU.
2. Drop 'spi_3' pinctrl mux define
Defined label isn't used as reference in any other node and defined
GPIOs most likely aren't used as well.
3. Drop GPIO 46 and 47 from hsuart pinctrl mux define
It turned out that only UART TX and RX lines are routed between the
main SOC (IPQ8072A) and the MCU (nRF52833).
While at it, fix also some broken indentation and redundant new lines.
[1] https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/mpsl/doc/bluetooth_coex.html
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
8c71638 fix listing mesh interfaces inside state
c3f6981 sysupgrade: GW sends FWsignature and not signature
94543ee state: cleanup and document the data model
6056d32 state: add [ avg, max ] cpu thermal sensor
900ce67 add phy temperature to state messages
Signed-off-by: John Crispin <john@phrozen.org>
config_get is issued with a default (120) parameter, which makes a check for 0
a redundant.
It can be safely removed, as the check for "[ "$interval" -eq 0 ]" is
always non-zero.
Fixes 396e2bd06c ("ucentral-client: cleanup health parameter")
Tested on virtual Wlan-AP img: no syntax error occured.
Signed-off-by: Oleksandr Mazur <cahbua@gmail.com>
9dc66d7 fix listing mesh interfaces inside state
ad84690 only set port counter if they are available
Fixes: WIFI-11994
Signed-off-by: John Crispin <john@phrozen.org>
c6ba7ce add diagnostic script support
5d70069 cmd_script: add an additional return json when upload was triggered
Signed-off-by: John Crispin <john@phrozen.org>
This adds configuration for reset pins connected with nRF52840 MCU and
the GL850G USB HUB on the EdgeCore EAP102.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This change focuses on the I/O related cleanups for the EdgeCore EAP102
DTS file. Most of the removed definitions come from QCA reference files
and should have been adjusted for a custom board. List of changes:
1. Drop 'btcoex' pinctrl mux define
EAP102 includes nRF52840 MCU which doesn't have dedicated PTA coex
hardware interface (see [1] for software based solution in Nordic's
nRF Connect SDK). Based on the real hardware research, defined pins
from 'btcoex' mux aren't routed to nRF52840 MCU.
2. Drop 'hsuart' pinctrl mux define and 'serial_blsp2' node
Only one UART interface is used on the EAP102.
3. Drop 'usb_mux_sel' pinctrl mux
Defined label isn't use as reference in any other node and defined
GPIO most likely isn't used as well.
4. Disable 'pcie0' and remove 'pcie0' pinctrl mux
EAP102 doesn't use of any of the IPQ8071A PCIe buses.
[1] https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/mpsl/doc/bluetooth_coex.html
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This fixes size of the caldata for ipq60xx based boards and moves the
YunCore AX840 to correct case block (the board is IPQ60xx based, so
the driver looks for ath11k/IPQ6018/hw1.0/caldata.bin,
not ath11k/IPQ8074/hw2.0/caldata.bin). Without this fix, the driver
isn't able to fetch caldata:
[ 16.792551] ath11k c000000.wifi: qmi failed to load CAL data file:caldata.bin
Signed-off-by: Isaev Ruslan <legale.legale@gmail.com>
f941f47 healthcheck: set 60s as the minimum interval
85495ab wifi.iface was not converting 6G channels correctly
Signed-off-by: John Crispin <john@phrozen.org>
8d4384b add session-timeout to captive support
516829a add client kick threshold support
5a5085b add uci_section to wifi uci
Signed-off-by: John Crispin <john@phrozen.org>
Rekeying PTK for STA 2e:54:0a:55:25:c6 but driver can't safely do that.
Rekeying PTK for STA 48:26:2c:3e:b0:f4 but driver can't safely do that.
ath11k c000000.wifi: failed to flush transmit queue 0
Fixes: WIFI-11004
Signed-off-by: John Crispin <john@phrozen.org>