openwrt/openwrt.git
2 years agoramips: minew g1-c: add the old device name to the supported devices
Alexander Couzens [Wed, 7 Jul 2021 15:57:45 +0000 (17:57 +0200)]
ramips: minew g1-c: add the old device name to the supported devices

Allow to use the sysupgrade image as factory image without
additional force.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoath79: increase SPI frequency for OCEDO boards
David Bauer [Tue, 6 Jul 2021 01:07:58 +0000 (03:07 +0200)]
ath79: increase SPI frequency for OCEDO boards

The MX25L12805D used on all ath79 OCEDO boards supports clock
speeds up to 50 MHz.

Thus, we can increase the maximum SPI frequency the flash chip is
controlled at to 50 MHz, increasing transfer speed.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agoath79: increase WS-AP3610 SPI frequency
David Bauer [Tue, 6 Jul 2021 00:59:03 +0000 (02:59 +0200)]
ath79: increase WS-AP3610 SPI frequency

The M25P80 used on the Siemens WS-AP3610 supports clock speeds up to 54
MHz. Thus, we can safely increase the maximum SPI frequency the flash
chip is controlled at to 50 MHz, increasing transfer speed.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agohostapd: add HE flag to get_clients
David Bauer [Tue, 29 Jun 2021 22:12:00 +0000 (00:12 +0200)]
hostapd: add HE flag to get_clients

Expose the hostapd HE flag via ubus to indicate HE capable devices.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agohostapd: remove unused mac_buff allocation
Martin Weinelt [Fri, 25 Jun 2021 22:01:08 +0000 (00:01 +0200)]
hostapd: remove unused mac_buff allocation

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2 years agohostapd: report bssid, ssid and channel over ubus
Martin Weinelt [Fri, 25 Jun 2021 22:01:07 +0000 (00:01 +0200)]
hostapd: report bssid, ssid and channel over ubus

Imports a function from iw to convert frequencies to channel numbers.

Co-authored-by: David Bauer <mail@david-bauer.net>
Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
[fix potential out of bounds read]
Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agoscripts: check if dl directory exist in dl_cleanup script
Ansuel Smith [Mon, 5 Jul 2021 22:59:40 +0000 (00:59 +0200)]
scripts: check if dl directory exist in dl_cleanup script

Check if the provided dl directory exist and return on error.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2 years agodnsmasq: use local option for local domain parameter
Kevin Darbyshire-Bryant [Thu, 1 Jul 2021 18:50:22 +0000 (19:50 +0100)]
dnsmasq: use local option for local domain parameter

'--local' is a synonym for '--server' so let's use '--local' in the
resultant config file for uci's 'local' instead of uci's local
parameter being turned into '--server'.  Slightly less confusion all
round.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2 years agoramips: add support for minew g1-c
Alexander Couzens [Tue, 1 Jun 2021 21:09:26 +0000 (21:09 +0000)]
ramips: add support for minew g1-c

The minew g1-c is a smart home gateway / BLE gateway.
A Nordic nRF52832 is available via USB UART (cp210x) to support BLE.
The LED ring is a ring of 24x ws2812b connect to a generic GPIO (unsupported).
There is a small LED which is only visible when the device is open which
will be used as LED until the ws2812b is supported.
The board has also a micro sdcard/tfcard slot (untested).
The Nordic nRF52832 exposes SWD over a 5pin header (GND, VCC, SWD, SWC, RST).
The vendor uses an older OpenWrt version, sysupgrade can be used via
serial or ssh.

CPU: MT7628AN / 580MHz
RAM: DDR2 128 MiB RAM
Flash: SPI NOR 16 MiB W25Q128
Ethernet: 1x 100 mbit (Port 0) (PoE in)
USB: USB hub, 2x external, 1x internal to USB UART
Power: via micro usb or PoE 802.11af
UART: 3.3V, 115200 8n1

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoath79: base-files: fix broken network config
Petr Štetiar [Mon, 5 Jul 2021 06:45:18 +0000 (08:45 +0200)]
ath79: base-files: fix broken network config

Fix bash syntax error introduced in commit cce2e8db564b ("ath79: add
support for TP-Link TL-WR941HP v1") which resulted in broken default
network configuration.

 In target/linux/ath79/generic/base-files/etc/board.d/02_network line 402:
tplink,tl-wr842n-v2)\
        ^-- SC1073: Couldn't parse this case item. Fix to allow more checks.

References: https://gitlab.com/ynezz/openwrt-device-runtime-testing/-/jobs/1398837698/artifacts/file/cram-result-archer-c7-v5-initramfs.txt
Fixes: cce2e8db564b ("ath79: add support for TP-Link TL-WR941HP v1")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2 years agoath79: add support for Xiaomi AIoT Router AC2350
Evgeniy Isaev [Tue, 11 May 2021 08:45:51 +0000 (13:45 +0500)]
ath79: add support for Xiaomi AIoT Router AC2350

Device specifications
* SoC: QCA9563 @ 775MHz (MIPS 74Kc)
* RAM: 128MiB DDR2
* Flash: 16MiB SPI-NOR (EN25QH128)
* Wireless 2.4GHz (SoC): b/g/n, 3x3
* Wireless 5Ghz (QCA9988): a/n/ac, 4x4 MU-MIMO
* IoT Wireless 2.4GHz (QCA6006): currently unusable
* Ethernet (AR8327): 3 LAN × 1GbE, 1 WAN × 1GbE
* LEDs: Internet (blue/orange), System (blue/orange)
* Buttons: Reset
* UART: through-hole on PCB ([VCC 3.3v](RX)(GND)(TX) 115200, 8n1)
* Power: 12VDC, 1,5A

MAC addresses map (like in OEM firmware)
  art@0x0     88:C3:97:*:57  wan/label
  art@0x1002  88:C3:97:*:2D  lan/wlan2g
  art@0x5006  88:C3:97:*:2C  wlan5g

Obtain SSH Access
1. Download and flash the firmware version 1.3.8 (China).
2. Login to the router web interface and get the value of `stok=` from the
   URL
3. Open a new tab and go to the following URL (replace <STOK> with the stok
   value gained above; line breaks are only for easier handling, please put
   together all four lines into a single URL without any spaces):
     http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/misystem/set_config_iotdev
       ?bssid=any&user_id=any&ssid=-h%0Anvram%20set%20ssh_en%3D1%0Anvram%20commit
       %0Ased%20-i%20%27s%2Fchannel%3D.%2A%2Fchannel%3D%5C%5C%22debug%5C%5C%22%2F
       g%27%20%2Fetc%2Finit.d%2Fdropbear%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A
4. Wait 30-60 seconds (this is the time required to generate keys for the
   SSH server on the router).

Create Full Backup
1. Obtain SSH Access.
2. Create backup of all flash (on router):
    dd if=/dev/mtd0 of=/tmp/ALL.backup
3. Copy backup to PC (on PC):
    scp root@192.168.31.1:/tmp/ALL.backup ./
Tip: backup of the original firmware, taken three times, increases the
chances of recovery :)

Calculate The Password
* Locally using shell (replace "12345/E0QM98765" with your router's serial
  number):
  On Linux
    printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \
    md5sum - | head -c8 && echo
  On macOS
    printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \
    md5 | head -c8
* Locally using python script (replace "12345/E0QM98765" with your
  router's serial number):
    wget https://raw.githubusercontent.com/eisaev/ax3600-files/master/scripts/calc_passwd.py
    python3.7 -c 'from calc_passwd import calc_passwd; print(calc_passwd("12345/E0QM98765"))'
* Online
    https://www.oxygen7.cn/miwifi/

Debricking (lite)
If you have a healthy bootloader, you can use recovery via TFTP using
programs like TinyPXE on Windows or dnsmasq on Linux. To switch the router
to TFTP recovery mode, hold down the reset button, connect the power
supply, and release the button after about 10 seconds. The router must be
connected directly to the PC via the LAN port.

Debricking
You will need a full dump of your flash, a CH341 programmer, and a clip
for in-circuit programming.

Install OpenWRT
1. Obtain SSH Access.
2. Create script (on router):
    echo '#!/bin/sh' > /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    echo '. /bin/boardupgrade.sh' >> /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    echo 'board_prepare_upgrade' >> /tmp/flash_fw.sh
    echo 'mtd erase rootfs_data' >> /tmp/flash_fw.sh
    echo 'mtd write /tmp/openwrt.bin firmware' >> /tmp/flash_fw.sh
    echo 'sleep 3' >> /tmp/flash_fw.sh
    echo 'reboot' >> /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    chmod +x /tmp/flash_fw.sh
3. Copy `openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin`
   to the router (on PC):
    scp openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin \
    root@192.168.31.1:/tmp/openwrt.bin
4. Flash OpenWRT (on router):
    /bin/ash /tmp/flash_fw.sh &
5. SSH connection will be interrupted - this is normal.
6. Wait for the indicator to turn blue.

Signed-off-by: Evgeniy Isaev <isaev.evgeniy@gmail.com>
[improve commit message formatting slightly]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2 years agoath79: add support for TP-Link TL-WR941HP v1
Diogenes Rengo [Fri, 25 Jun 2021 14:44:40 +0000 (11:44 -0300)]
ath79: add support for TP-Link TL-WR941HP v1

Specifications:
    SOC:        Qualcomm Atheros TP9343 (750 MHz)
    Flash:      8 Mb (GigaDevice GD25Q64CSIG)
    RAM:        64 Mb (Zentel A3R12E40DBF-8E)
    Serial:     yes, 4-pin header
    Wlan:       Qualcomm Atheros TP9343, antenna: MIM0 3x3:3 RP-SMA
                3 x 2.4GHz power amp module Skyworks (SiGe) SE2576L
    Ethernet:   Qualcomm Atheros TP9343
    Lan speed:  100M ports: 4
    Lan speed:  100M ports: 1
    Other info: same case, ram and flash that TP-Link TL-WR841HP,
                different SOC

    https://forum.openwrt.org/t/adding-device-support-tp-link-wr941hp/

Label MAC addresses based on vendor firmware:
    LAN   *:ee  label
    WAN   *:ef  label +1
    WLAN  *:ee  label

    The label MAC address found in "config" partition at 0x8

Flash instruction:
    Upload the generated factory firmware on web interface.

Signed-off-by: Diogenes Rengo <rengocbx250@gmail.com>
[remove various whitespace issues, squash commits, use short 0x0]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2 years agoath79: add support for Ubiquiti PowerBeam M (XW)
Russell Senior [Sat, 5 Jun 2021 00:27:48 +0000 (17:27 -0700)]
ath79: add support for Ubiquiti PowerBeam M (XW)

This patch adds support for the Ubiquiti PowerBeam M (XW), e.g. PBE-M5-400,
a 802.11n wireless with a feed+dish form factor. This device was previously
supported by the ar71xx loco-m-xw firmware.

Specifications:
 - Atheros AR9342 SoC
 - 64 MB RAM
 - 8 MB SPI flash
 - 1x 10/100 Mbps Ethernet port, 24 Vdc PoE-in
 - Power and LAN green LEDs
 - 4x RSSI LEDs (red, orange, green, green)
 - UART (115200 8N1)

Flashing via stock GUI:
 - Downgrade to AirOS v5.5.x (latest available is 5.5.10-u2) first (see
   https://openwrt.org/toh/ubiquiti/powerbeam installation instructions)
 - Upload the factory image via AirOS web GUI.

Flashing via TFTP:
 - Use a pointy tool (e.g., unbent paperclip) to keep the
   reset button pressed.
 - Power on the device (keep reset button pressed).
 - Keep pressing until LEDs flash alternatively LED1+LED3 =>
   LED2+LED4 => LED1+LED3, etc.
 - Release reset button.
 - The device starts a TFTP server at 192.168.1.20.
 - Set a static IP on the computer (e.g., 192.168.1.21/24).
 - Upload via tftp the factory image:
    $ tftp 192.168.1.20
    tftp> bin
    tftp> trace
    tftp> put openwrt-ath79-generic-xxxxx-ubnt_powerbeam-m-xw-squashfs-factory.bin

WARNING: so far, no non-destructive method has been discovered for
opening the enclosure to reach the serial console. Internal photos
are available here: https://fcc.io/SWX-NBM5HP

Signed-off-by: Russell Senior <russell@personaltelco.net>
2 years ago.gitignore: ignore any .vscode* file
Nicholas Smith [Thu, 1 Jul 2021 05:07:56 +0000 (15:07 +1000)]
.gitignore: ignore any .vscode* file

.vscode-ctags are being tracked by git. Update .gitignore to
include any .vscode* file

Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2 years agoiwinfo: build with nl80211 backend only and make shared
Jo-Philipp Wich [Fri, 2 Jul 2021 16:04:17 +0000 (18:04 +0200)]
iwinfo: build with nl80211 backend only and make shared

Drop support for building the obsolete broadcom-wl backend and always
forcibly enable the nl82011 support. This allows us to make the package
shared again since no target specific compilation is happening anymore.

This will solve various repository coherency issues related to unavailable
libiwinfo versions in the long run.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agotreewide: unmark selected packages nonshared
Petr Štetiar [Fri, 2 Jul 2021 16:00:09 +0000 (18:00 +0200)]
treewide: unmark selected packages nonshared

This partially reverts changes done in commit 72cc44958ef4 ("treewide:
mark selected packages nonshared") as it removes the nonshared flag, but
keeps the PKG_RELEASE as the PKG_RELEASE bump while adding nonshared
flag was incorrect.

Unmark uci, ubus, libubox, lua, libnl-tiny and libjson-c as nonshared
packages as this fix attempt didn't worked out. Currently the
imagebuilder is broken again:

 openwrt-imagebuilder-21.02.0-rc3-ipq40xx-generic.Linux-x86_64$ make image PROFILE=avm_fritzbox-7530 PACKAGES=luci-ssl-openssl
 ...
 Collected errors:
  * pkg_hash_check_unresolved: cannot find dependency libiwinfo20210430 for luci-mod-status
  * pkg_hash_fetch_best_installation_candidate: Packages for luci-mod-status found, but incompatible with the architectures configured
  * pkg_hash_check_unresolved: cannot find dependency libiwinfo20210430 for rpcd-mod-iwinfo
  * pkg_hash_fetch_best_installation_candidate: Packages for rpcd-mod-iwinfo found, but incompatible with the architectures configured
  * satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-ssl-openssl:
  *  libiwinfo20210430
  * opkg_install_cmd: Cannot install package luci-ssl-openssl.

Everything because iwinfo's ABI was changed two times since rc3 release:

 +IWINFO_ABI_VERSION:=20210430
 +IWINFO_ABI_VERSION:=20210420

Since iwinfo is marked as nonshared, it wasn't built by phase2 builders, but
luci-mod-status was already updated 2 times since rc3 and was thus rebuilt by
phase2 builders:

 d1d452ed2fb3 luci-mod-status: don't set '-' hostname when creating static lease
 95b3633055c1 luci-mod-status: switch to html table for wlan channel analysis

So now luci-mod-status depends on libiwinfo20210430 but only
libiwinfo20210106 can be downloaded. This is first part of the fix, in
the upcoming commit Jo is going to remove nonshared flag from iwinfo
package as well.

References: https://lists.infradead.org/pipermail/openwrt-devel/2021-July/035736.html
References: https://lists.infradead.org/pipermail/openwrt-devel/2021-July/035741.html
Acked-by: Jo-Philipp Wich <jo@mein.io>
Reported-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2 years agopackage/comgt: Handle bind/unbind events
Arjun AK [Thu, 16 Jul 2020 15:52:24 +0000 (21:22 +0530)]
package/comgt: Handle bind/unbind events

This script was expecting only add/remove events which has not been the
case since Kernel 4.12 (which added bind/unbind). Bind events were getting
treated as remove events which would cause hotplugged 3g modems to not
work.

More info:
https://lkml.org/lkml/2018/12/23/128
https://github.com/systemd/systemd/issues/8221

Signed-off-by: Arjun AK <arjunak234@gmail.com>
2 years agoath79: resolve GPIO address conflicts
David Bauer [Wed, 30 Jun 2021 21:36:02 +0000 (23:36 +0200)]
ath79: resolve GPIO address conflicts

The ar71xx GPIO driver only uses 0x24 registers, all following GPIO
registers are using to control pinmux functions, which are not handles
by the GPIO driver but the generic Linux pinctrl driver.

For some SoC conflicting address ranges were defined for these (AR7240 &
AR9330).

Resolve these cases and align the address space of the GPIO controller
between all SoCs, as the used address space of the driver is identical
for all these.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agoath79: mikrotik: fix beeper phantom noise on RB912
Koen Vandeputte [Mon, 28 Jun 2021 08:57:21 +0000 (10:57 +0200)]
ath79: mikrotik: fix beeper phantom noise on RB912

Analysis done by Denis Kalashnikov:

It seems that some ROS versions on some routerboard models have this bug:
after silence boot (no output to uart, no beeps) beeper clicks when wireless traffic is.

https://forum.mikrotik.com/viewtopic.php?f=3&t=92269
https://forum.mikrotik.com/viewtopic.php?t=63399

From these links:

1)
Hello, I have RB951G-2HnD and I noticed strange thing
when I loaded the device with some wireless traffic it
produced strange sound - like hissing, fizzing etc.

2)
Same problem still on 6.33, with silent boot enabled
I hear buzzing noise on wireless load.

3)
The sound is fixed in v5.19, it was a bug that caused beeper to make clicks.

It also got fixed in RouterOS:

* What's new in 5.19 (2012-Jul-16 10:51):
fix ticking sound on RB411UAHL;

* What's new in 6.38.3 (2017-Feb-07 09:52):
rb3011 - fixed noise from buzzer after silent boot;

I've checked with an oscilloscope that:
* When on the ssr beeper pin is 0,
  on the beeper itself is 1 (~5V),
  and when on the ssr beeper pin is 1,
  on the beeper is 0
  The beeper doesn't consume power,
  so 1 should be a default/idle value for the ssr beeper pin).
* When there is wireless traffic (ping packets)
  in the background and the beeper clicks, I see
  pulses on the beeper itself,
  but no pulses on the ssr beeper pin (Q5 pin of 74hc595).
  When I manually toggle the ssr beeper pin I see pulses on both.
  So, it is likely that the phantom beeper clicks are caused by the EMI.

Suggested-by: Denis Kalashnikov <denis281089@gmail.com>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2 years agoltq-deu: Mark lantiq DEU broken
Hauke Mehrtens [Sat, 26 Jun 2021 22:52:50 +0000 (00:52 +0200)]
ltq-deu: Mark lantiq DEU broken

When the ltq_deu_vr9 kernel module is loaded, hostapd does not start any
more. It fails with this error message:
daemon.err hostapd: nl80211: kernel reports: key addition failed
daemon.err hostapd: Interface initialization failed

OpenWrt uses the standard Linux crypto API in the wifi drivers now
and this probably makes the system offload more crypto operations to
special hardware like the Lantiq DEU. There is probably a bug in the DEU
and these operations fail and then hostapd does not start the interface.

Do not include the Lantiq DEU by default any more.

Fixes: FS#3901
Fixes: 53b6783907f3 ("mac80211: remove patches stripping down crypto support")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Notupus <notpp46@gmail.com>
2 years agoipq806x: fix dedicated cpufreq driver
Ansuel Smith [Thu, 20 May 2021 21:41:57 +0000 (23:41 +0200)]
ipq806x: fix dedicated cpufreq driver

2 small fix for the dedicated cpufreq driver:
- Fix index wrongly used as the current cpu
- Exit early if a bad freq is detected. In the current state the freq
is applied anyway even with invalid state.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2 years agoipq806x: fix missing 1.4ghz cache freq for ipq8065 SoC
Ansuel Smith [Thu, 20 May 2021 21:39:36 +0000 (23:39 +0200)]
ipq806x: fix missing 1.4ghz cache freq for ipq8065 SoC

With the new implementation of the dedicated cpufreq driver,
the 1.4 Ghz was only dropped and not added to the ipq8065 SoC.
Fix this to improve performance.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2 years agoipq806x: fix missing changes in 5.4 for new cpufreq implementation
Ansuel Smith [Tue, 25 May 2021 00:58:27 +0000 (02:58 +0200)]
ipq806x: fix missing changes in 5.4 for new cpufreq implementation

The new cpufreq dedicated driver changed the node structure
on how the cache should be defined in the dts. The 5.4 dtsi addition
patch has not been updated to follow the new implementation.
Fix this to restore correct cache scaling and restore any performance
regression.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2 years agoubus: update to the latest version
Felix Fietkau [Wed, 30 Jun 2021 19:57:19 +0000 (21:57 +0200)]
ubus: update to the latest version

4fc532c8a55b ubusd: fix tx_queue linked list usage

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agoath79: add support for Teltonika RUT230 v1
David Bauer [Mon, 21 Jun 2021 21:27:56 +0000 (23:27 +0200)]
ath79: add support for Teltonika RUT230 v1

This commit adds support for the Teltonika RUT230 v1, a Atheros AR9331
based router with a Quectel UC20 UMTS modem.

Hardware
--------
Atheros AR9331
16 MB SPI-NOR XTX XT25F128B
64M DDR2 memory
Atheros AR9331 1T1R 802.11bgn Wireless
Boootloader: pepe2k U-Boot mod

Hardware-Revision
-----------------
There are two board revisions of the RUT230, a v0 and v1.

A HW version is silkscreened on the top of the PCBs front side as well
as shown in the Teltonika UI. However, this looks to be a different
identifier, as the GPl dump shows this silkscreened / UI shown version
are internally treated identically.

Th following mapping has been obtained from the latest GPl dump.

HW Ver   01 - 04 --> v0
HW Ver > 05      --> v1

My board was a HW Ver 09 and is treated as a v1.

Installation
------------
While attaching power, hold down the reset button and release it after
the signal LEDs flashed 3 times.

Attach your Computer with the devices LAN port and assign yourself the
IPv4 address 192.168.1.10/24. Open a web browser, navigate to
192.168.1.1. Upload the OpenWrt factory image.

The device will install OpenWrt and automatically reboots afterwards.

You can use the smae procedure with the stock firmware to return back to
the vendor firmware.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agomac80211: backport fix for nl80211 control port tx (fixes FS#3857)
Felix Fietkau [Wed, 30 Jun 2021 17:08:59 +0000 (19:08 +0200)]
mac80211: backport fix for nl80211 control port tx (fixes FS#3857)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomac80211: fix a regression in starting aggregation sessions on mesh interfaces
Felix Fietkau [Tue, 29 Jun 2021 11:32:31 +0000 (13:32 +0200)]
mac80211: fix a regression in starting aggregation sessions on mesh interfaces

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agodnsmasq: distinct Ubus names for multiple instances
Etan Kissling [Sun, 27 Jun 2021 22:02:46 +0000 (22:02 +0000)]
dnsmasq: distinct Ubus names for multiple instances

Currently, when using multiple dnsmasq instances they are all assigned
to the same Ubus instance name. This does not work, as only a single
instance can register with Ubus at a time. In the log, this leads to
`Cannot add object to UBus: Invalid argument` error messages.
Furthermore, upstream 3c93e8eb41952a9c91699386132d6fe83050e9be changes
behaviour so that instead of the log, dnsmasq exits at start instead.

With this patch, all dnsmasq instances are assigned unique names so that
they can register with Ubus concurrently. One of the enabled instances
is always assigned the previous default name "dnsmasq" to avoid breaking
backwards compatibility with other software relying on that default.
Previously, a random instance got assigned that name (while the others
produced error logs). Now, the first unnamed dnsmasq config section is
assigned the default name. If there are no unnamed dnsmasq sections the
first encountered named dnsmasq config section is assigned instead.

A similar issue exists for Dbus and was similarly addressed.

Signed-off-by: Etan Kissling <etan.kissling@gmail.com>
[tweaked commit message] dnsmasq was not crashing it is exiting
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2 years agobase-files: wifi: tidy up the reconf code
Bob Cantor [Thu, 24 Jun 2021 18:48:45 +0000 (04:48 +1000)]
base-files: wifi: tidy up the reconf code

commit 5edbd390d321532d9a697d6895a1a7c71c40bd5d rearranged the
"wifi up" code.

This commit tidies up the "wifi reconf" code so as to
keep it aligned with the "wifi up" code.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2 years agobase-files: wifi: swap the order of some ubus calls
Bob Cantor [Thu, 24 Jun 2021 18:37:17 +0000 (04:37 +1000)]
base-files: wifi:  swap the order of some ubus calls

"/sbin/wifi up" makes three ubus calls:
1. ubus call network reload
2. ubus call network.wireless down
3. ubus call network.wireless up

The first and third ubus calls call drv_mac80211_setup,
while the second ubus call triggers wireless_device_setup_cancel,
so the call sequence becomes,

1. drv_mac80211_setup
2. wireless_device_setup_cancel
3. drv_mac80211_setup

This commit swaps the order of the first two ubus calls,
1. ubus call network.wireless down
2. ubus call network reload
3. ubus call network.wireless up

Consequently drv_mac80211_setup is only called once,
and two related bugs (#FS3784 and #FS3902) are no longer triggered
by /sbin/wifi.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2 years agomac80211: print an error if wifi teardown fails
Bob Cantor [Thu, 24 Jun 2021 18:14:47 +0000 (04:14 +1000)]
mac80211: print an error if wifi teardown fails

drv_mac80211_teardown fails silently if the device to be torn down is
not defined.  This commit prints an error message.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2 years agomac80211: always call wireless_set_data (FS#3784)
Bob Cantor [Thu, 24 Jun 2021 18:07:34 +0000 (04:07 +1000)]
mac80211: always call wireless_set_data  (FS#3784)

When wifi is turned off, drv_mac80211_teardown sometimes fails (silently)
because the device to be torn down is not defined.

This situation arises if drv_mac80211_setup was called twice when
wifi was turned on.

This commit ensures that the device to be torn down is always defined
in drv_mac80211_teardown.

Steps to reproduce:

1) Use /sbin/wifi to turn on wifi.
   uci set wireless.@wifi-iface[0].disabled=0
   uci set wireless.@wifi-device[0].disabled=0
   uci commit
   wifi

2) Use /sbin/wifi to turn off wifi.
   uci set wireless.@wifi-device[0].disabled=1
   uci commit
   wifi

3) Observe that wifi is still up.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2 years agomac80211: fix no_reload logic (FS#3902)
Bob Cantor [Thu, 24 Jun 2021 17:18:33 +0000 (03:18 +1000)]
mac80211: fix no_reload logic (FS#3902)

If drv_mac80211_setup is called twice with the same wifi configuration,
then the second call returns early with error HOSTAPD_START_FAILED.
(wifi works nevertheless, despite the fact that setup is incomplete.  But
"ubus call network.wireless status" erroneously reports that radio0 is down.)

The relevant part of drv_mac80211_setup is,

if [ "$no_reload" != "0" ]; then
        add_ap=1
        ubus wait_for hostapd
        local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
        ret="$?"
        [ "$ret" != 0 -o -z "$hostapd_res" ] && {
                wireless_setup_failed HOSTAPD_START_FAILED
                return
        }
        wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1
fi

This commit sets no_reload = 0 during the second call of drv_mac80211_setup.

It is perhaps worth providing a way to reproduce the situation
where drv_mac80211_setup is called twice.

When /sbin/wifi is used to turn on wifi,
   uci set wireless.@wifi-iface[0].disabled=0
   uci set wireless.@wifi-device[0].disabled=0
   uci commit
   wifi

/sbin/wifi makes the following ubus calls,
   ubus call network reload
   ubus call network.wireless down
   ubus call network.wireless up

The first and third ubus calls both call drv_mac80211_setup,
while the second ubus call triggers wireless_device_setup_cancel.
So the call sequence becomes,

   drv_mac80211_setup
   wireless_device_setup_cancel
   drv_mac80211_setup

In contrast, when LuCI is used to turn on wifi only a single call
is made to drv_mac80211_setup.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2 years agoiwinfo: update to the latest version
Felix Fietkau [Mon, 28 Jun 2021 13:44:51 +0000 (15:44 +0200)]
iwinfo: update to the latest version

c9b1672f5a83 nl80211: fix path compatibility issue

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agoath79: mikrotik: remove rb912 gpio-beeper module dependency
Koen Vandeputte [Wed, 23 Jun 2021 14:57:37 +0000 (16:57 +0200)]
ath79: mikrotik: remove rb912 gpio-beeper module dependency

The beeper is currently not fully functional and has also
been removed from DTS.

Also remove the dependency for the gpio-beeper module.

Fixes: 695a1cd53c ("ath79: add support for MikroTik RouterBOARD 912UAG-2HPnD")
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2 years agozram-swap: clean up the log messages
Rui Salvaterra [Thu, 24 Jun 2021 19:05:23 +0000 (20:05 +0100)]
zram-swap: clean up the log messages

Remove redundant tags and name things more consistently.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
[removed superflous dash]
Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agozram-swap: set the zram swap priority to 100 by default
Rui Salvaterra [Thu, 24 Jun 2021 19:05:22 +0000 (20:05 +0100)]
zram-swap: set the zram swap priority to 100 by default

New swap devices are added in decreasing priority order, starting at -1. Make
sure the zram swap device has the highest priority, by default.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agoipq806x: refresh config for kernel 5.4
John Audia [Thu, 24 Jun 2021 11:51:55 +0000 (07:51 -0400)]
ipq806x: refresh config for kernel 5.4

* With kernel 5.4.128, ran: make kernel_menuconfig CONFIG_TARGET=generic
* Manually added back CONFIG_LEDS_TRIGGER_DISK=y so as not to revert
  f93fcf8923aa ("ipq806x: enable disk-activity LED trigger")

Signed-off-by: John Audia <graysky@archlinux.us>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2 years agoipq40xx: add missing case closing symbol
Adrian Schmutzler [Sun, 27 Jun 2021 18:40:53 +0000 (20:40 +0200)]
ipq40xx: add missing case closing symbol

Though not strictly necessary, add the closing symbol to make the
job easier for future developers editing this file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2 years agobusybox: sysntpd: add trigger to reload server
Alexey Dobrovolsky [Sat, 5 Jun 2021 23:25:02 +0000 (02:25 +0300)]
busybox: sysntpd: add trigger to reload server

sysntpd server becomes unavailable if the index of the bound
interface changes. So let's add an interface trigger to reload sysntpd.

This patch also adds the ability for the sysntpd script to handle
uci interface name from configuration.

Fixes: 4da60500ebd2 ("busybox: sysntpd: option to bind server to iface")
Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
2 years agoramips: add support for Tenbay T-MB5EU-V01
David Bauer [Thu, 6 May 2021 16:07:18 +0000 (18:07 +0200)]
ramips: add support for Tenbay T-MB5EU-V01

Hardware
--------
MediaTek MT7621 SoC
256M DDR3
16MB BoHong SPI-NOR
MediaTek MT7905+7975 2x2T2R DBDC bgnax / acax
RGB LED
WPS + RESET Button
UART on compute module (silkscreened / 115200n8)

The router itself is just a board with Power / USB / RJ-45 connectors
and DC/DC converters. The SoC and WiFi components are on a
daughterboard which connect using two M.2 connectors.

The compute module has the model number "T-CB1800K-DM2 V02" printed on
it. The main baord has "T-MB5EU V01" printed on it. This information
might be useful, as it's highly likely either of these two will be
reused in similar designs.

The router itself is sold as Tenbay T-MB5EU directly from the OEM as
well as "KuWFI AX1800 Smart WiFi 6 Eouter" on Amazon.de for ~50€ in a
slightly different case.

Installation
------------

A Tool for creating a factory image for the Vendor Web Interface can be
found here: https://github.com/blocktrron/t-mb5eu-v01-factory-creator/

As the OEM Firmware is just a modified LEDE 17.01, you can also access
failsafe mode via UART while the OS boots, by connecting to UART
and pressing "f" when prompted. The Router is reachable at
192.168.1.1 via root without password.

Transfer the OpenWrt sysupgrade image via scp and apply with sysupgrade
using the -n and -F flags.

Alternatively, the board can be flashed by attaching to the UART
console, interrupting the boot process by keeping "0" pressed while
attaching power.

Serve the OpenWrt initramfs using a TFTP server with address
192.168.1.66. Rename the initramfs to ax1800.bin.

Attach your TFTP server to one of the LAN ports. Execute the following
commands.

 $ setenv ipaddr 192.168.1.67
 $ setenv serverip 192.168.1.66
 $ tftpboot 0x84000000 ax1800.bin
 $ bootm

Wait for the device to boot. Then transfer the OpenWrt sysupgrade image
to the device using SCP and apply sysupgrade.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agoramips: add AW9523 I2C GPIO expander driver
David Bauer [Thu, 6 May 2021 22:35:16 +0000 (00:35 +0200)]
ramips: add AW9523 I2C GPIO expander driver

This adds a driver for the AW9523 I2C GPIO expander.

This driver is required to make LEDs as well as buttons on the Tenbay
T-MB5EU-V01 work.

This driver already had several upstream iterations. I'm working to
push this driver to mainline.

Ref: https://patchwork.ozlabs.org/project/linux-gpio/list/?series=226287

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agoglibc: update to latest 2.33 HEAD (BZ #27646, bug 27896, BZ #15271)
Hans Dedecker [Sun, 27 Jun 2021 13:29:25 +0000 (15:29 +0200)]
glibc: update to latest 2.33 HEAD (BZ #27646, bug 27896, BZ #15271)

58b90461ae elf: Use _dl_catch_error from base namespace in dl-libc.c [BZ #27646]
8c06748c51 Fix use of __pthread_attr_copy in mq_notify (bug 27896)
4b6be914bd Use __pthread_attr_copy in mq_notify (bug 27896)
f4cba6ca1e dlfcn: Failures after dlmopen should not terminate process [BZ #15271]

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2 years agoramips: fix AR8033 fiber operation
David Bauer [Mon, 14 Jun 2021 22:15:17 +0000 (00:15 +0200)]
ramips: fix AR8033 fiber operation

It was reported AR8033 did not work in fiber operation mode on the ER-X.

While the earlier attempt of fixing this mitigated the issue of 1000
Base-X link mode not being supported, it also switched to the copper
page, breaking fiber operation altogether.

Extend the hack adding fiber operation so it does not switch to the
copper page. Also remove the part where the supported link mode bit for
1000 Base-X is removed, as this is required for fiber operation.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agogeneric: at803x: mask 1000 Base-X link mode
David Bauer [Mon, 14 Jun 2021 21:53:38 +0000 (23:53 +0200)]
generic: at803x: mask 1000 Base-X link mode

AR8031/AR8033 have different status registers for copper
and fiber operation. However, the extended status register
is the same for both operation modes.

As a result of that, ESTATUS_1000_XFULL is set to 1 even when
operating in copper TP mode.

Remove this mode from the supported link modes, as this driver
currently only supports copper operation.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agodante: move to packages.git
Paul Spooren [Wed, 23 Jun 2021 21:58:51 +0000 (11:58 -1000)]
dante: move to packages.git

Rather than maintaining it in core, move it to packages.git where it's
maintained by a community.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agoRevert "dnsmasq: Update to version 2.86test3"
Kevin Darbyshire-Bryant [Sat, 26 Jun 2021 19:31:29 +0000 (20:31 +0100)]
Revert "dnsmasq: Update to version 2.86test3"

This reverts commit 3628870015ef46eacf2c936f36e3c1ed3b4c9855.

dnsmasq v2.86test3 has some issues with ubus, so is being reverted.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2 years agoRevert "dnsmasq: add config option for connmark DNS filtering"
Kevin Darbyshire-Bryant [Sat, 26 Jun 2021 19:30:58 +0000 (20:30 +0100)]
Revert "dnsmasq: add config option for connmark DNS filtering"

This reverts commit dea4bae7c2b963af02e1e3e3bdb5cd656a5ea3d3.

dnsmasq v2.86test3 has some issues with ubus and needs reverting, hence
this needs reverting.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2 years agolantiq: xrx200: switch the subtarget to the mainline DSA driver
Martin Blumenstingl [Sun, 7 Jun 2020 13:07:28 +0000 (15:07 +0200)]
lantiq: xrx200: switch the subtarget to the mainline DSA driver

Enable the XRX200 PMAC, GSWIP DSA tag and GSIP DSA drivers in the 5.4
kernel config. Update the existing vr9_*.dts{,i} to use the new
Ethernet and switch drivers. Drop the swconfig package from the xrx200
target because swconfig doesn't manage DSA based switches.

The new /etc/config/network format for the DSA driver is not compatible
with the old (swconfig) based one. Show a message during sysupgrade
notifying users about this change and asking them to start with a fresh
config (or forcefully update and then migrate the config manually).

Failsafe mode can now automatically bring up the first lan interface
based on board.json including DSA based setups. Drop
05_set_preinit_iface_lantiq from the xRX200 sub-target as this is not
needed anymore. For now we are keeping it for the ase, xway and
xway_legacy until there's some confirmation that it can be dropped from
there as well.

While here, some boards also receive minor fixups:
- Use LAN1 as LAN1 (according to a photo this port can also be
  configured as WAN) on the Buffalo WBMR-300HPD. This makes it easier to
  read the port mapping because otherwise we would have LAN{2,3,4} and
  WAN (which was the case for the non-DSA version previously).
- vr9_avm_fritz3390.dts: move the "gpio" comment from port 0 and 1 to
  their corresponding PHYs
- vr9_tplink_vr200.dtsi: move the "gpio" comment from port 0 to PHY 0
- vr9_tplink_tdw89x0.dtsi: move the "gpio" comment from port 0 to PHY 0

Acked-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
Tested-by: Notupus <notpp46@googlemail.com> # TD-W9980/DM200/FRITZ 7430
Tested-by: Martin Schiller <ms@dev.tdt.de> # tested on TDT VR2020
Tested-by: Martin Schiller <ms@dev.tdt.de> # tested on TP-Link TD-W8980B
Tested-by: Martin Schiller <ms@dev.tdt.de> # tested on ZyXEL P-2812HNU-F1
Tested-by: Daniel Kestrel <kestrel1974@t-online.de> # tested on Fritzbox 7490
Tested-by: Daniel Kestrel <kestrel1974@t-online.de> # tested on Fritzbox 3490
Tested-by: @jospezial <jospezial@gmx.de> # tested on VGV7510KW22 (o2 Box 6431)
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
2 years agodnsmasq: add config option for connmark DNS filtering
Etan Kissling [Sat, 26 Jun 2021 12:11:49 +0000 (12:11 +0000)]
dnsmasq: add config option for connmark DNS filtering

This adds uci support to configure connmark based DNS filtering.

Signed-off-by: Etan Kissling <etan_kissling@apple.com>
(See https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q2/015151.html)
Signed-off-by: Etan Kissling <etan.kissling@gmail.com>
2 years agodnsmasq: Update to version 2.86test3
Etan Kissling [Sat, 26 Jun 2021 12:11:45 +0000 (12:11 +0000)]
dnsmasq: Update to version 2.86test3

Need this version to add config option for connmark DNS filtering.

Summary of upstream CHANGELOG:
* Handle DHCPREBIND requests in the DHCPv6 server code.
* Fix bug which caused dnsmasq to lose track of processes forked.
* Major rewrite of the DNS server and domain handling code.
* Revise resource handling for number of concurrent DNS queries.
* Improve efficiency of DNSSEC.
* Connection track mark based DNS query filtering.

Signed-off-by: Etan Kissling <etan.kissling@gmail.com>
2 years agokernel: bump 5.4 to 5.4.128
John Audia [Wed, 23 Jun 2021 14:08:52 +0000 (10:08 -0400)]
kernel: bump 5.4 to 5.4.128

Removed upstreamed:
  mvebu/patches-5.4/002-PCI-aardvark-Don-t-rely-on-jiffies-while-holding-spi.patch

All other patches automatically rebased.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.4 to 5.4.127
John Audia [Wed, 23 Jun 2021 07:00:41 +0000 (03:00 -0400)]
kernel: bump 5.4 to 5.4.127

All patches automatically rebased.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.4 to 5.4.126
John Audia [Wed, 23 Jun 2021 07:00:02 +0000 (03:00 -0400)]
kernel: bump 5.4 to 5.4.126

Manually rebased:
  bcm27xx/patches-5.4/950-0089-cgroup-Disable-cgroup-memory-by-default.patch

All other patches automatically rebased.

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.4 to 5.4.125
John Audia [Wed, 23 Jun 2021 06:59:39 +0000 (02:59 -0400)]
kernel: bump 5.4 to 5.4.125

All patches automatically rebased.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.10 to 5.10.46
Rui Salvaterra [Wed, 16 Jun 2021 16:22:50 +0000 (17:22 +0100)]
kernel: bump 5.10 to 5.10.46

Add the new symbol to the generic kconfig.

No deleted or manually refreshed patches.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agoramips: ethernet: ralink: rewrite esw_rt3050 to support link states
Alexander Couzens [Wed, 9 Jun 2021 21:46:35 +0000 (23:46 +0200)]
ramips: ethernet: ralink: rewrite esw_rt3050 to support link states

Ensure the esw is initialized before the ethernet device is sending
packets. Further implement carrier detection similar to mt7620.
If any port has a link, the ethernet device will detect a carrier.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoramips: ethernet: ralink: allow to return EPROBE_DEFER on switch_init
Alexander Couzens [Wed, 2 Jun 2021 00:01:53 +0000 (00:01 +0000)]
ramips: ethernet: ralink: allow to return EPROBE_DEFER on switch_init

For rt3050 the switch needs to be initialized before the ethernet start sending
packets. Allow switch_init to return -EPROBE_DEFER.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoramips: ethernet: ralink: move reset of the esw into the esw instead of fe
Alexander Couzens [Wed, 9 Jun 2021 22:16:53 +0000 (00:16 +0200)]
ramips: ethernet: ralink: move reset of the esw into the esw instead of fe

The esw reset should only done by the esw driver and not by the fe itself.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoramips: ethernet: ralink: use the reset controller api for esw & ephy
Alexander Couzens [Wed, 9 Jun 2021 21:35:54 +0000 (23:35 +0200)]
ramips: ethernet: ralink: use the reset controller api for esw & ephy

Instead of writing direct into the reset registers.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoramips: ethernet: ralink: add fe_reset_fe() to reset fe via reset controller
Alexander Couzens [Wed, 9 Jun 2021 21:08:07 +0000 (23:08 +0200)]
ramips: ethernet: ralink: add fe_reset_fe() to reset fe via reset controller

The dts defines the reset fe for all architectures. However
the soc code used direct register access of the reset controller.
Replace the custom soc reset with a generic fe_reset_fe().

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agoramips: ethernet: ralink: add struct fe_priv as context to fe_reset()
Alexander Couzens [Wed, 9 Jun 2021 20:55:30 +0000 (22:55 +0200)]
ramips: ethernet: ralink: add struct fe_priv as context to fe_reset()

The fe_reset function direct access the reset controller instead
using the reset controller api. In preparation to use the
reset controller.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2 years agobase-files: fix /tmp/TZ when zoneinfo not installed
Paul Spooren [Thu, 24 Jun 2021 17:42:53 +0000 (07:42 -1000)]
base-files: fix /tmp/TZ when zoneinfo not installed

The zoneinfo packages are not installed per default so neither
/tmp/localtime nor /tmp/TZ is generated.

This patch mostly reverts the previous fix and instead incooperates a
solution suggested by Jo.

Fixes "base-files: fix zoneinfo support " 8af62ed

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agozram-swap: robustify mkswap/swapon/swapoff invocation
Rui Salvaterra [Thu, 24 Jun 2021 19:05:21 +0000 (20:05 +0100)]
zram-swap: robustify mkswap/swapon/swapoff invocation

Instead of assuming /sbin contains the correct BusyBox symlinks, directly invoke
the busybox executable. The required utilities are guaranteed to be present,
since the zram-swap package selects them. Additionally, don't assume busybox
resides in /bin, rely on PATH to find it.

While at it, update the copyright year, use SPDX and switch to AUTORELEASE.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agohostapd: add support for providing vendor specific IE elements
Felix Fietkau [Thu, 24 Jun 2021 13:56:12 +0000 (15:56 +0200)]
hostapd: add support for providing vendor specific IE elements

They can be added as hex digit strings via the 'vendor_elements' option

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agoipq40xx: specify FritzBox 7530 LAN port label numbers
Rafał Miłecki [Thu, 10 Jun 2021 05:14:03 +0000 (07:14 +0200)]
ipq40xx: specify FritzBox 7530 LAN port label numbers

This helps managing LAN ports.

Ref: https://forum.openwrt.org/t/openwrt-21-02-0-second-release-candidate/98026/121
Fixes: 95b0c07a618f ("ipq40xx: add support for FritzBox 7530")
Cc: David Bauer <mail@david-bauer.net>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agohostapd: add default_disabled option to the supplicant
Raphaël Mélotte [Wed, 7 Oct 2020 08:08:14 +0000 (10:08 +0200)]
hostapd: add default_disabled option to the supplicant

With the default configuration we generate, the supplicant starts
scanning and tries to connect to any open network when the interface
is enabled.

In some cases it can be desirable to prevent the supplicant from
scanning by itself. For example, if on the same radio an AP is
configured and an unconfigured STA is added (to be configured with
WPS), the AP might not be able to beacon until the STA stops
scanning.

In such a case, the STA configuration can still be required to set
specific settings (e.g. multi_ap_backhaul_sta) so it can't be set to
"disabled" in uci (because that would prevent the supplicant from
being run at all). The alternative is to add the "disabled" parameter
to the default network block in the supplicant configuration.

This patch adds a "default_disabled" setting in UCI which, when set,
adds the "disabled" parameter to the supplicant default network block.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
2 years agobase-files: fix zoneinfo support
Rosen Penev [Sat, 10 Apr 2021 00:22:48 +0000 (17:22 -0700)]
base-files: fix zoneinfo support

The system init script currently sets /tmp/localinfo when zoneinfo is
populated. However, zoneinfo has spaces in it whereas the actual files
have _ instead of spaces. This made the if condition never return true.

Example failure when removing the if condition:

/tmp/localtime -> /usr/share/zoneinfo/America/Los Angeles

This file does not exist. America/Los_Angeles does.

Ran through shfmt -w -ci -bn -sr -s

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agoramips: fix software reboot failure on HILINK HLK-7628N
Liu Yu [Sat, 12 Jun 2021 12:02:45 +0000 (20:02 +0800)]
ramips: fix software reboot failure on HILINK HLK-7628N

In the new kernel version 5.X,reboot will fail.

When SOC is reset, flash has not exited the 4-byte address mode,
which causes the operation mode mismatch of flash during boot.Add
broken-flash-reset to make flash exit 4-byte address mode before
SOC reset

Signed-off-by: Liu Yu <f78fk@live.com>
2 years agoramips: add missing "pinctrl-names" for Youku YK1
Shiji Yang [Mon, 17 May 2021 04:46:52 +0000 (12:46 +0800)]
ramips: add missing "pinctrl-names" for Youku YK1

Without this definition ethernet led can work as usual, but it's better to
re-add it. Relying on default values may cause uncontrollable factors.

Fixes: 882a6116d3d6 ("ramips: improve pinctrl for Youku YK-L1")
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2 years agoramips: mt7620: disable SOC VLANs for external switches
Michael Pratt [Tue, 20 Apr 2021 16:35:47 +0000 (12:35 -0400)]
ramips: mt7620: disable SOC VLANs for external switches

These boards have AR8327 or QCA8337 external ethernet switch.
The SOC also has it's own internal switch
where VLAN is now enabled by default.

Changes to preinit caused all switches to have VLANs enabled by default
even if they are not configured with a topology in uci_defaults
(see commit f017f617aecbd47debd4d3a734dc0e471342db96)

When both internal and external switches have VLANs,
and the external switch has both LAN and WAN,
the TX traffic from the SOC cannot flow to the tagged port on the external switch
because the VLAN IDs are not matching.

So disable the internal switch VLANs by default on these boards.

Also, add a topology for the internal switch,
so that on LuCI there is not an "unknown topology" warning.

In theory, it may be possible to have LAN ports on both switches
through internal and external PHYs, but there are no known boards that have this.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: ethernet: use more macros and bump version
Michael Pratt [Sat, 1 May 2021 18:47:01 +0000 (14:47 -0400)]
ramips: mt7620: ethernet: use more macros and bump version

Define and use some missing macros,
and use them instead of BIT() or numbers for more readable code.

Add comment for a bit change that seems unrelated to ethernet
but is actually needed (PCIe Root Complex mode).

Remove unknown and unused macro RST_CTRL_MCM
(probably from MT7621 / MT7622)

This is the last of a series of fixes, so bump version.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: fix RGMII TXID PHY mode
Michael Pratt [Sat, 1 May 2021 18:17:11 +0000 (14:17 -0400)]
ramips: mt7620: fix RGMII TXID PHY mode

the register bits for TX delay and RX delay are opposites:
when TX delay bit is set, delay is enabled
when RX delay bit is set, delay is disabled

So, when both bits are unset, it is RX delay
and when both bits are set, it is TX delay

Note: TXID is the default RGMII mode of the SOC

Fixes: 5410a8e2959a ("ramips: mt7620: add rgmii delays support")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: add ephy-disable option to switch driver
Michael Pratt [Mon, 31 May 2021 07:56:20 +0000 (03:56 -0400)]
ramips: mt7620: add ephy-disable option to switch driver

Add back the register write to disable internal PHYs
as a separate option in the code that can be set using a DTS property.

Set the option to true by default
when an external mt7530 switch is identified.

This makes the driver more in sync with original SDK code
while keeping the lines separated into different options
to accommodate any board with any PHY layout.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: move mt7620_mdio_mode() to ethernet driver
Michael Pratt [Sun, 30 May 2021 06:02:47 +0000 (02:02 -0400)]
ramips: mt7620: move mt7620_mdio_mode() to ethernet driver

The function mt7620_mdio_mode is only called once
and both the function and mdio_mode block have been named incorrectly,
leading to confusion and useless commits.

These lines in the mdio_mode block of mt7620_hw_init
are only intended for boards with an external mt7530 switch.
(see commit 194ca6127ee18cd3a95da4d03f02e43b5428c0bb)

Therefore, move lines from mdio_mode to the place in soc_mt7620.c
where the type of mt7530 switch is identified,
and move lines from mt7620_mdio_mode to a main function.

mt7620_mdio_mode was called from mt7620_gsw_init
where the priv struct is available,
so the lines must stay in mt7620_gsw_init function.

In order to keep things as simple as possible,
keep the DTS property related function calls together,
by moving them from mt7620_gsw_probe to init.

Remove the now useless DTS properties and extra phy nodes.

Fixes: 5a6229a93df8 ("ramips: remove superfluous & confusing DT binding")
Fixes: b85fe43ec8c4 ("ramips: mt7620: add force use of mdio-mode")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: use DTS to set PHY base address for external PHYs
Michael Pratt [Sat, 3 Apr 2021 18:42:51 +0000 (14:42 -0400)]
ramips: mt7620: use DTS to set PHY base address for external PHYs

Set the PHY base address to 12 for mt7530 and 8 for others,
which is based on the default setting for some devices
from printing the register with the following command
after it is written to by uboot during the boot cycle.

`md 0x10117014 1`

PHY_BASE option only uses 5 bits of the register,
bits 16 to 20, so use 8-bit integer type.

Set the option using the DTS property mediatek,ephy-base
and create the gsw node if missing.

Also, added a kernel message to display the EPHY base address.

Note:
If anything is written to a PHY address that is greater than 1 hex char (greater than 0xf)
then there is adverse effects with Atheros switches.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: allow both internal and external PHYs
Michael Pratt [Tue, 20 Apr 2021 22:45:15 +0000 (18:45 -0400)]
ramips: mt7620: allow both internal and external PHYs

When the new variable ephy_base was introduced,
it was not applied to the if block for mdio_mode.

The first line in the mdio_mode if block
sets the EPHY base address to 12 in the SOC by writing a register,
but the corresponding variable in the driver
was still set to the default of 0.

This causes subsequent lines that write registers with the function
_mt7620_mii_write
to write to PHY addresses 0 through 4
while internal PHYs have been moved to addresses 12 through 16.

All of these lines are intended only for PHYs on the SOC internal switch,
however, they are being written to external ethernet switches
if they exist at those PHY addresses 0 through 4.
This causes some ethernet ports to be broken on boards with AR8327 or QCA8337 switch.

Other suggested fixes move those lines to the else block of mdio_mode,
but removing the else block completely also fixes it.

Therefore, move the lines to the mt7620_hw_init function main block,
and have only one instance of the function mtk_switch_w32
for writing the register with the EPHY base address.

In theory, this also allows for boards that have both external switches
and internal PHYs that lead to ethernet ports to be supported.

Fixes: 391df3782914 ("ramips: mt7620: add EPHY base mdio address changing possibility")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: fix ethernet driver GMAC port init
Michael Pratt [Wed, 2 Jun 2021 03:01:26 +0000 (23:01 -0400)]
ramips: mt7620: fix ethernet driver GMAC port init

A workaround was added to the switch driver
to set SOC port 4 as an RGMII GMAC interface
based on the DTS property mediatek,port4-gmac.
(previously mediatek,port4)

However, the ethernet driver already does this,
but is being blocked by a return statement
whenever the phy-handle and fixed-link properties
are both missing from nodes that define the port properties.

Revert the workaround, so that both the switch driver
and ethernet driver are not doing the same thing
and move the phy-handle related lines down
so nothing is ending the function prematurely.

While at it, clean up kernel messages
and delete useless return statements.

Fixes: f6d81e2fa1f1 ("mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possible")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: remove useless GMAC nodes
Michael Pratt [Fri, 11 Jun 2021 18:54:43 +0000 (14:54 -0400)]
ramips: mt7620: remove useless GMAC nodes

These nodes are used for configuring a GMAC interface
and for defining external PHYs to be accessed with MDIO.

None of this is possible on MT7620N, only MT7620A,
so remove them from all MT7620N DTS.

When the mdio-bus node is missing, the driver returns -NODEV
which causes the internal switch to not initialize.
Replace that return so that everything works without the DTS node.

Also, an extra kernel message to indicate for all error conditions
that mdio-bus is disabled.

Fixes: d482356322c9 ("ramips: mt7620n: add mdio node and disable port4 by default")
Fixes: aa5014dd1a58 ("ramips: mt7620n: enable port 4 as EPHY by default")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agoramips: mt7620: simplify DTS properties for GMAC
Michael Pratt [Wed, 31 Mar 2021 20:09:37 +0000 (16:09 -0400)]
ramips: mt7620: simplify DTS properties for GMAC

There are only 2 options in the driver
for the function of mt7620 internal switch port 4:

  EPHY mode (RJ-45, internal PHY)
  GMAC mode (RGMII, external PHY)

Let the DTS property be boolean instead of string
where EPHY mode is the default.

Fix how the properties are written
for all DTS that use them,
and add missing nodes where applicable,
and remove useless nodes,
and minor DTS formatting.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2 years agobase-files: bring up vlan interface too
Luiz Angelo Daros de Luca [Mon, 21 Jun 2021 22:45:22 +0000 (00:45 +0200)]
base-files: bring up vlan interface too

Vlan subinterface was never brought up when using vlan-based preinit network.
Tested forcing ifname="" before preinit_ip() on a Tp-Link Archer C5v4.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2 years agorealtek: Fix failsafe mode
Hauke Mehrtens [Mon, 21 Jun 2021 22:45:21 +0000 (00:45 +0200)]
realtek: Fix failsafe mode

The RTL8380-RTL9300 switches only forward packets when VLAN ID 1 is
configured. Do not use the standard failsafe configuration for DSA
accessing the default port directly, but configure a switch on the lan1
interface instead.

This will add the VLAN ID 1 configuration to the switch:
$ bridge vlan show
port              vlan-id
lan1              1 PVID Egress Untagged
switch            1 PVID Egress Untagged

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agobase-files: failsafe: Remove the VLAN modifier from interface name
Hauke Mehrtens [Mon, 21 Jun 2021 22:45:20 +0000 (00:45 +0200)]
base-files: failsafe: Remove the VLAN modifier from interface name

Some interfaces have a VLAN modifier like :t in lan1:t, this modifier
should be removed from the interface before calling preinit_ip_config().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agobase-files: failsafe: Fix IP configuration
Hauke Mehrtens [Mon, 21 Jun 2021 22:45:19 +0000 (00:45 +0200)]
base-files: failsafe: Fix IP configuration

Adapt the preinit_config_board() to the board.json network changes. It
now looks for the device and the ports variables to configure the LAN
network.

This works with swconfig configurations.

Fixes: FS#3866
Fixes: d42640e389a8 ("base-files: use "ports" array in board.json network for bridges")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Rafał Miłecki <rafal@milecki.pl>
2 years agokernel: Backport patch to automatically bring up DSA master when opening user port
Hauke Mehrtens [Mon, 21 Jun 2021 22:45:18 +0000 (00:45 +0200)]
kernel: Backport patch to automatically bring up DSA master when opening user port

Without this patch we have to manually bring up the CPU interface in
failsafe mode.

This was backported from kernel 5.12.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Rafał Miłecki <rafal@milecki.pl>
2 years agokernel-5.4: backport latest patches for wireguard
Jason A. Donenfeld [Sun, 6 Jun 2021 10:37:53 +0000 (12:37 +0200)]
kernel-5.4: backport latest patches for wireguard

These are the latest patches that just landed upstream for 5.13, will be
backported by Greg into 5.10 (because of stable@), and are now in the
5.4 backport branch of wireguard: https://git.zx2c4.com/wireguard-linux/log/?h=backport-5.4.y

Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Stijn Segers <foss@volatilesystems.org>
2 years agokernel: bump 5.10 to 5.10.44
Rui Salvaterra [Wed, 16 Jun 2021 16:22:50 +0000 (17:22 +0100)]
kernel: bump 5.10 to 5.10.44

Add the new symbol to the generic kconfig.

No deleted or manually refreshed patches.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agokernel: crypto: limit crypto-hw-hifn-795x to devices with pci support
Aleksander Jan Bajkowski [Mon, 3 May 2021 08:49:06 +0000 (10:49 +0200)]
kernel: crypto: limit crypto-hw-hifn-795x to devices with pci support

CONFIG_CRYPTO_DEV_HIFN_795X depends on PCI. This driver only makes sense on
devices with pci support.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
2 years agorealtek: Fix buffer length calculation on RTL8380 with CRC offload
Birger Koblitz [Sun, 6 Jun 2021 14:20:59 +0000 (16:20 +0200)]
realtek: Fix buffer length calculation on RTL8380 with CRC offload

Fixes the buffer and packet length calculations for Ethernet TX on
the RTL8380 SoC when CRC calculation offload is enabled.
CRC-offload is always done by the SoC, but additional CRC
calculation was previously done also by the kernel.
It also fixes detection of the DSA tag for packets on RTL8390
SoCs for ports > 28.

v2 has correct whitespace

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
2 years agohostapd: make wnm_sleep_mode_no_keys configurable
Timo Sigurdsson [Tue, 15 Jun 2021 21:09:41 +0000 (23:09 +0200)]
hostapd: make wnm_sleep_mode_no_keys configurable

In the aftermath of the KRACK attacks, hostapd gained an AP-side workaround
against WNM-Sleep Mode GTK/IGTK reinstallation attacks. WNM Sleep Mode is not
enabled by default on OpenWrt, but it is configurable through the option
wnm_sleep_mode. Thus, make the AP-side workaround configurable as well by
exposing the option wnm_sleep_mode_no_keys. If you use the option
wpa_disable_eapol_key_retries and have wnm_sleep_mode enabled, you might
consider using this workaround.

Signed-off-by: Timo Sigurdsson <public_timo.s@silentcreek.de>
2 years agobase-files: fix enabled for services with only STOP
Karel Kočí [Mon, 7 Jun 2021 17:25:06 +0000 (19:25 +0200)]
base-files: fix enabled for services with only STOP

There are services that have only STOP value set. They are executed only
on shutdown and it is common to use them for system cleanup. There is
one such service shipped directly with base-files, it is 'umount'. Those
work the same way as those with START but enabled does not report them
as enabled although it should have as they can be enabled and disabled
as any other service.

This also changes check from check for executable to check for symbolic
link. The implementation depends on those being links to service file
and it is much cleaner and direct to check for them being links.

Signed-off-by: Karel Kočí <karel.koci@nic.cz>
2 years agobcm63xx-cfe: update to the latest master
Rafał Miłecki [Tue, 22 Jun 2021 11:19:50 +0000 (13:19 +0200)]
bcm63xx-cfe: update to the latest master

e5050f3 linksys: ea9500-v2: add cferam file

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agobcm4908: fix Ethernet broken state after interface restart
Rafał Miłecki [Tue, 22 Jun 2021 05:47:18 +0000 (07:47 +0200)]
bcm4908: fix Ethernet broken state after interface restart

This fixes traffic stalls after ifdown & ifup.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agohostapd: fix handling of the channel utilization options
Timo Sigurdsson [Tue, 15 Jun 2021 21:12:08 +0000 (23:12 +0200)]
hostapd: fix handling of the channel utilization options

Commit 0a7657c ("hostapd: add channel utilization as config option") added the
two new uci options bss_load_update_period and chan_util_avg_period. However,
the corresponding "config_add_int" calls for these options weren't added, so
attempting to actually use these options and change their values is bound to
fail - they always stay at their defaults. Add the missing code to actually
make these options work.

Fixes: 0a7657c ("hostapd: add channel utilization as config option")
Signed-off-by: Timo Sigurdsson <public_timo.s@silentcreek.de>
2 years agohostapd: make country3 option configurable
Timo Sigurdsson [Tue, 15 Jun 2021 21:08:56 +0000 (23:08 +0200)]
hostapd: make country3 option configurable

The country3 option in hostapd.conf allows the third octet of the country
string to be set. It can be used e.g. to indicate indoor or outdoor use (see
hostapd.conf for further details). Make this option configurable but optional
in OpenWrt.

Signed-off-by: Timo Sigurdsson <public_timo.s@silentcreek.de>
2 years agoustream-ssl: variants conflict with each other
Karel Kočí [Mon, 21 Jun 2021 09:42:25 +0000 (11:42 +0200)]
ustream-ssl: variants conflict with each other

This adds conflicts between variants of libustream pacakge.
They provide the same file and thus it should not be possible to install
them side by side.

Signed-off-by: Karel Kočí <karel.koci@nic.cz>
2 years agoath79: add missing GPIO_LATCH symbol
David Bauer [Mon, 21 Jun 2021 21:50:05 +0000 (23:50 +0200)]
ath79: add missing GPIO_LATCH symbol

Fixes commit 7b8931678c36 ("ath79: add gpio-latch driver for MikroTik RouterBOARDs")

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agogrub2: update to 2.06
Dirk Neukirchen [Thu, 10 Jun 2021 10:15:58 +0000 (12:15 +0200)]
grub2: update to 2.06

-300-CVE-2015-8370.patch is upstreamed with different code
(upstream id: 451d80e52d851432e109771bb8febafca7a5f1f2)

- fixup OpenWrts setup_root patch

compile tested: x86_64,i386
runtime tested: VM x86_64,VM i386

- booted fine
- grub-editenv worked

Signed-off-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
2 years agokernel/modules: make sure igb loads at boot
Chris Blake [Tue, 15 Jun 2021 13:03:05 +0000 (08:03 -0500)]
kernel/modules: make sure igb loads at boot

Without loading the igb at boot, the recovery wouldn't have
network available. All network drivers should be loaded before
etc/board.d/02_network is called. Note that other network drivers
already have this set, such as tg3.

Fixes: 7e0e5110bc90 ("kernel: add igb kernel module")
Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
2 years agouci: add uci_revert function
Florian Eckert [Thu, 8 Apr 2021 07:28:02 +0000 (09:28 +0200)]
uci: add uci_revert function

Add missing uci_revert shell function wrapper.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>