openwrt/openwrt.git
2 years agoubus: update to version 2021-06-03
Petr Štetiar [Thu, 3 Jun 2021 07:49:58 +0000 (09:49 +0200)]
ubus: update to version 2021-06-03

This update contains following changes:

 * ubusd: protect against too-short messages
 * ubusd: add per-client tx queue limit
 * ubusd: convert tx_queue to linked list

Fixes: FS#1525
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit 4f2243d40a400aa1ce6ae5d06325f93b4d9463a5)

2 years agobuild/json: fix IMAGE_PREFIX and DEVICE_PACKAGES
Paul Spooren [Wed, 2 Jun 2021 20:13:28 +0000 (10:13 -1000)]
build/json: fix IMAGE_PREFIX and DEVICE_PACKAGES

These two variables were missing in the definition of
DEFAULT_DEVICE_VARS which caused them to contain wrong values, messing
up the resulting JSON files.

This patch adds the two variables IMAGE_PREFIX and DEVICE_PACKAGES to
DEFAULT_DEVICE_VARS.

Suggested-by: Baptiste Jonglez <git@bitsofnetworks.org>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agorampis: use lzma-loader for ZTE MF283+
Lech Perczak [Sun, 28 Feb 2021 02:24:19 +0000 (03:24 +0100)]
rampis: use lzma-loader for ZTE MF283+

Without that, after merging support to master, the device fails to boot
due to LZMA decompression error:

3: System Boot system code via Flash.
raspi_read: from:80000 len:40
.   Image Name:   MIPS OpenWrt Linux-5.4.99
   Created:      2021-02-25  23:35:00 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1786664 Bytes =  1.7 MB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:80040 len:1b4328
............................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

Use lzma-loader to fix it.

Fixes: 59d065c9f81c ("ramips: add support for ZTE MF283+")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
(cherry picked from commit 410fb05b445c89a147029d1471e184a5594602db)
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2 years agoramips: add support for ZTE MF283+
Lech Perczak [Sat, 6 Feb 2021 12:56:46 +0000 (13:56 +0100)]
ramips: add support for ZTE MF283+

ZTE MF283+ is a dual-antenna LTE category 4 router, based on Ralink
RT3352 SoC, and built-in ZTE P685M PCIe MiniCard LTE modem.

Hardware highlighs:
- CPU: MIPS24KEc at 400MHz,
- RAM: 64MB DDR2,
- Flash: 16MB SPI,
- Ethernet: 4 10/100M port switch with VLAN support,
- Wireless: Dual-stream 802.11n (RT2860), with two internal antennas,
- WWAN: Built-in ZTE P685M modem, with two internal antennas and two
  switching SMA connectors for external antennas,
- FXS: Single ATA, with two connectors marked PHONE1 and PHONE2,
  internally wired in parallel by 0-Ohm resistors, handled entirely by
  internal WWAN modem.
- USB: internal miniPCIe slot for modem,
  unpopulated USB A connector on PCB.
- SIM slot for the WWAN modem.
- UART connector for the console (unpopulated) at 3.3V,
  pinout: 1: VCC, 2: TXD, 3: RXD, 4: GND,
  settings: 57600-8-N-1.
- LEDs: Power (fixed), WLAN, WWAN (RGB),
  phone (bicolor, controlled by modem), Signal,
  4 link/act LEDs for LAN1-4.
- Buttons: WPS, reset.

Installation:
As the modem is, for most of the time, provided by carriers, there is no
possibility to flash through web interface, only built-in FOTA update
and TFTP recovery are supported.

There are two installation methods:
(1) Using serial console and initramfs-kernel - recommended, as it
allows you to back up original firmware, or
(2) Using TFTP recovery - does not require disassembly.

(1) Using serial console:
To install OpenWrt, one needs to disassemble the
router and flash it via TFTP by using serial console:
- Locate unpopulated 4-pin header on the top of the board, near buttons.
- Connect UART adapter to the connector. Use 3.3V voltage level only,
  omit VCC connection. Pin 1 (VCC) is marked by square pad.
- Put your initramfs-kernel image in TFTP server directory.
- Power-up the device.
- Press "1" to load initramfs image to RAM.
- Enter IP address chosen for the device (defaults to 192.168.0.1).
- Enter TFTP server IP address (defaults to 192.168.0.22).
- Enter image filename as put inside TFTP server - something short,
  like firmware.bin is recommended.
- Hit enter to load the image. U-boot will store above values in
  persistent environment for next installation.
- If you ever might want to return to vendor firmware,
  BACK UP CONTENTS OF YOUR FLASH NOW.
  For this router, commonly used by mobile networks,
  plain vendor images are not officially available.
  To do so, copy contents of each /dev/mtd[0-3], "firmware" - mtd3 being the
  most important, and copy them over network to your PC. But in case
  anything goes wrong, PLEASE do back up ALL OF THEM.
- From under OpenWrt just booted, load the sysupgrade image to tmpfs,
  and execute sysupgrade.

(2) Using TFTP recovery
- Set your host IP to 192.168.0.22 - for example using:
sudo ip addr add 192.168.0.22/24 dev <interface>
- Set up a TFTP server on your machine
- Put the sysupgrade image in TFTP server root named as 'root_uImage'
  (no quotes), for example using tftpd:
  cp openwrt-ramips-rt305x-zte_mf283plus-squashfs-sysupgrade.bin /srv/tftp/root_uImage
- Power on the router holding BOTH Reset and WPS buttons held for around
  5 seconds, until after WWAN and Signal LEDs blink.
- Wait for OpenWrt to start booting up, this should take around a
  minute.

Return to original firmware:
Here, again there are two possibilities are possible, just like for
installation:
(1) Using initramfs-kernel image and serial console
(2) Using TFTP recovery

(1) Using initramfs-kernel image and serial console
- Boot OpenWrt initramfs-kernel image via TFTP the same as for
  installation.
- Copy over the backed up "firmware.bin" image of "mtd3" to /tmp/
- Use "mtd write /tmp/firmware.bin /dev/mtd3", where firmware.bin is
  your backup taken before OpenWrt installation, and /dev/mtd3 is the
  "firmware" partition.

(2) Using TFTP recovery
- Follow the same steps as for installation, but replacing 'root_uImage'
  with firmware backup you took during installation, or by vendor
  firmware obtained elsewhere.

A few quirks of the device, noted from my instance:
- Wired and wireless MAC addresses written in flash are the same,
  despite being in separate locations.
- Power LED is hardwired to 3.3V, so there is no status LED per se, and
  WLAN LED is controlled by WLAN driver, so I had to hijack 3G/4G LED
  for status - original firmware also does this in bootup.
- FXS subsystem and its LED is controlled by the
  modem, so it work independently of OpenWrt.
  Tested to work even before OpenWrt booted.
  I managed to open up modem's shell via ADB,
  and found from its kernel logs, that FXS and its LED is indeed controlled
  by modem.
- While finding LEDs, I had no GPL source drop from ZTE, so I had to probe for
  each and every one of them manually, so this might not be complete -
  it looks like bicolor LED is used for FXS, possibly to support
  dual-ported variant in other device sharing the PCB.
- Flash performance is very low, despite enabling 50MHz clock and fast
  read command, due to using 4k sectors throughout the target. I decided
  to keep it at the moment, to avoid breaking existing devices - I
  identified one potentially affected, should this be limited to under
  4MB of Flash. The difference between sysupgrade durations is whopping
  3min vs 8min, so this is worth pursuing.

In vendor firmware, WWAN LED behaviour is as follows, citing the manual:
- red - no registration,
- green - 3G,
- blue - 4G.
Blinking indicates activity, so netdev trigger mapped from wwan0 to blue:wwan
looks reasonable at the moment, for full replacement, a script similar to
"rssileds" would need to be developed.

Behaviour of "Signal LED" in vendor firmware is as follows:
- Off - no signal,
- Blinking - poor coverage
- Solid - good coverage.

A few more details on the built-in LTE modem:
Modem is not fully supported upstream in Linux - only two CDC ports
(DIAG and one for QMI) probe. I sent patches upstream to add required device
IDs for full support.
The mapping of USB functions is as follows:
- CDC (QCDM) - dedicated to comunicating with proprietary Qualcomm tools.
- CDC (PCUI) - not supported by upstream 'option' driver yet. Patch
  submitted upstream.
- CDC (Modem) - Exactly the same as above
- QMI - A patch is sent upstream to add device ID, with that in place,
  uqmi did connect successfully, once I selected correct PDP context
  type for my SIM (IPv4-only, not default IPv4v6).
- ADB - self-explanatory, one can access the ADB shell with a device ID
  added to 51-android.rules like so:

SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
LABEL="android_usb_rules_begin"
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", ATTR{idProduct}=="1275", ENV{adb_user}="yes"
ENV{adb_user}=="yes", MODE="0660", GROUP="plugdev", TAG+="uaccess"
LABEL="android_usb_rules_end"

While not really needed in OpenWrt, it might come useful if one decides to
move the modem to their PC to hack it further, insides seem to be pretty
interesting. ADB also works well from within OpenWrt without that. O
course it isn't needed for normal operation, so I left it out of
DEVICE_PACKAGES.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[remove kmod-usb-ledtrig-usbport, take merged upstream patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 59d065c9f81c4d1a89464d071134a50529449f34)
[Manually remove no longer needed patches for modem]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2 years agokernel: bump 5.4 to 5.4.123
Kuan-Yi Li [Sun, 30 May 2021 01:58:26 +0000 (09:58 +0800)]
kernel: bump 5.4 to 5.4.123

Removed because in upstream
  generic/pending-5.4/770-02-net-ethernet-mtk_eth_soc-fix-rx-vlan-offload.patch

All others updated automatically.

Runtime-tested on bcm27xx/bcm2711.

Fixes: FS#3085
Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2 years agobuild: kernel2minor: work around path length limit
François Chavant [Fri, 7 May 2021 15:58:11 +0000 (17:58 +0200)]
build: kernel2minor: work around path length limit

When building for MikroTik devices the kernel2minor tool will sometimes
fail with:

  Can't get lstat from kernel file!: No such file or directory.

This is because kernel2minor expects paths no longer than 250 chars.
To work around this the include/image-commands.mk has been modified
to copy the kernel to a temporary file (/tmp/tmp.XXXXXXXXXX) before
calling kernel2minor.

Signed-off-by: François Chavant <francois@chavant.info>
(cherry picked from commit 5a9608102b3c444d0c963255f9d016a1d5469d5d)

2 years agoOpenWrt v21.02.0-rc2: revert to branch defaults
Hauke Mehrtens [Sat, 29 May 2021 18:02:03 +0000 (20:02 +0200)]
OpenWrt v21.02.0-rc2: revert to branch defaults

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agoOpenWrt v21.02.0-rc2: adjust config defaults v21.02.0-rc2
Hauke Mehrtens [Sat, 29 May 2021 18:01:58 +0000 (20:01 +0200)]
OpenWrt v21.02.0-rc2: adjust config defaults

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agobase-files: simplify setting device MAC
Rafał Miłecki [Fri, 28 May 2021 06:18:08 +0000 (08:18 +0200)]
base-files: simplify setting device MAC

1. Move code above interface generation
   It results in more logical order. Device gets its config section
   above interface section.
2. Drop the loop
   We have separated code handling bridges now so $device should be
   guaranteed to contain a single device name.
3. Drop section name
   It's not required by netifd or LuCI & it's not needed by this script
   as $device contains a single device name now.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit e002179a6d2eea8640e262160030336bea54ec26)

2 years agoubox: fix init script validation of log_ip option
Jo-Philipp Wich [Fri, 28 May 2021 13:23:14 +0000 (15:23 +0200)]
ubox: fix init script validation of log_ip option

The underlying logread process uses usock() to handle remote connections
which is able to handle both hostnames and IP addresses.

Ref: https://github.com/openwrt/luci/issues/5077
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ec83fb9ced138b7945135adffb9ff0ba63b695ec)

2 years agobase-files: generate network config with "device" options
Rafał Miłecki [Mon, 24 May 2021 14:45:06 +0000 (16:45 +0200)]
base-files: generate network config with "device" options

Replace "ifname" with "device" as netifd has been recently patches to
used the later one. It's more clear and accurate.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 4b9a67362d70c544b85078b8d5c661f43f7472d9)

2 years agobase-files: fix configuration generation of network if "bridge" exists
INAGAKI Hiroshi [Sun, 23 May 2021 11:30:58 +0000 (20:30 +0900)]
base-files: fix configuration generation of network if "bridge" exists

After the commit 43fc720657c6e3b30c6ed89d7227ee6e646c158b
("base-files: generate "device UCI type section for bridge"), the wrong
network configuration is generated for the devices that already have the
bridge device section for VLAN, such as the devices in realtek target.

As a result, the bridge device by additional "device" section is
specified to the "ports" option in the "bridge-vlan" section and netifd
shuts down the switch and the ethernet when the network service started.

Fixes: 43fc720657 ("base-files: generate "device" UCI type section for bridge")
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[rmilecki: use $ports for generate_bridge_vlan argument]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 8cc4e87a2f81df02dbe481759ae6c36cf056c13b)

2 years agobase-files: support setting bridge MAC address
Rafał Miłecki [Mon, 24 May 2021 05:46:12 +0000 (07:46 +0200)]
base-files: support setting bridge MAC address

Fixes: 43fc720657c6 ("base-files: generate "device" UCI type section for bridge")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 7a90ad3c431031191afe51b163bf97d3ec820d54)

2 years agobase-files: generate bridge device sections with br- name prefix
Rafał Miłecki [Thu, 20 May 2021 08:32:18 +0000 (10:32 +0200)]
base-files: generate bridge device sections with br- name prefix

Missing br- prefix could result in name conflict between DSA port
interface and bridge interface. Some devices with just one LAN port use
"lan" interface name for DSA port. Trying to create bridge with the same
"lan" name was failing.

Reported-by: David Bauer <mail@david-bauer.net>
Fixes: 43fc720657c6 ("base-files: generate "device" UCI type section for bridge")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 0e459668c5b3b158991803204f628b1b7dce9034)

2 years agobase-files: generate "device" UCI type section for bridge
Rafał Miłecki [Sat, 15 May 2021 19:06:27 +0000 (21:06 +0200)]
base-files: generate "device" UCI type section for bridge

This switches from the old way of defining bridges in an "interface" UCI
section type (that should be used for layer 3 only). From now a defualt
board switch will have its own "device" UCI section type. It's a new &
preferred way of defining L2 devices.

Before:

config interface 'lan'
        option type 'bridge'
        option ifname 'lan1 lan2 lan3 lan4'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

After:

config device
        option name 'lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option ifname 'lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 43fc720657c6e3b30c6ed89d7227ee6e646c158b)

2 years agobusybox: show reproducible timestamp
Paul Spooren [Thu, 13 May 2021 21:57:45 +0000 (23:57 +0200)]
busybox: show reproducible timestamp

On login busybox shows a timestamp per default contianing the build
date. Since the build date isn't reproducible per default this behaviour
was disabled by default via 34df4d40 "busybox: disable timestamp in
version".

This commit modifies busybox so that the printed timestamp reproducible
using SOURCE_DATE_EPOCH and therefore shouldn't be disabled anymore.

Before:

    BusyBox v1.33.1 () built-in shell (ash)

After:

    BusyBox v1.33.1 (2021-05-13 09:34:34 UTC) built-in shell (ash)

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit a725382978515abfb2eb7be3bafef735dca97dbd)

2 years agobusybox: use $(AUTORELEASE) and SPDX
Paul Spooren [Tue, 18 May 2021 13:36:10 +0000 (15:36 +0200)]
busybox: use $(AUTORELEASE) and SPDX

use AUTORELEASE since BusyBox is often updaten and PKG_RELEASE is not
consistently bumped. Also use SPDX license headers to be machine
readable and bump the copyright year to 2021.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 25fdb42249aef7b5eb53675f82f0091c532bf90c)

2 years agoipq806x: improve system latency
Ansuel Smith [Sun, 28 Mar 2021 01:29:59 +0000 (03:29 +0200)]
ipq806x: improve system latency

Various report and data show that the freq 384000 is too low and cause some
extra latency to the entire system. OEM qsdk code also set the min frequency
for this target to 800 mhz.
Also some user notice some instability with this idle frequency, solved by
setting the min frequency to 600mhz. Fix all these kind of problem by
introducing a boot init.d script that set the min frequency to 600mhz and set
the ondemand governor to be more aggressive. The script set these value only if
the ondemand governor is detected. 384 mhz freq is still available and user can
decide to restore the old behavior by disabling this script.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit 861b82d36ae43efec8d16e61b82482e38996af92)

2 years agoarchs38: set device vendor and model variables
Moritz Warning [Mon, 8 Mar 2021 15:34:25 +0000 (16:34 +0100)]
archs38: set device vendor and model variables

This fixes the profiles.json output.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
(cherry picked from commit cc54f65daa6101721c068cd00fdead1815db0bbf)

2 years agoarc770: set device vendor and model variables
Moritz Warning [Mon, 8 Mar 2021 13:12:53 +0000 (14:12 +0100)]
arc770: set device vendor and model variables

This fixes the profiles.json output.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
(cherry picked from commit d00bbd9de0719eededc7ee6a7cb2d8f4de6e4540)

2 years agobuild: avoid generating JSON info on missing image
David Bauer [Wed, 24 Feb 2021 20:38:15 +0000 (21:38 +0100)]
build: avoid generating JSON info on missing image

Previously, build would fail for targets containing devices with not
initramfs image (such as mpc85xx-p1010). Only generate the JSON image
info for the initramfs image when we have one to avoid breaking the
builds.

Fixes commit d3140d052964 ("build/json: generate json file for initramfs")

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 512229ce4967814a09ce202855e6b632d2e97a3c)

2 years agobuild/json: generate json file for initramfs
Moritz Warning [Fri, 8 Jan 2021 23:02:57 +0000 (00:02 +0100)]
build/json: generate json file for initramfs

The initramfs images are missing from the profiles.json files.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
[fix code by exporting device variables]
Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit d3140d05296461deddaaa8ca2ce4a4a97a320eff)

2 years agonetifd: update to the latest master
Rafał Miłecki [Wed, 26 May 2021 05:54:19 +0000 (07:54 +0200)]
netifd: update to the latest master

899c2a4 interface: support "device" attribute and deprecate "ifname"
62e3cb5 scripts/netifd-wireless.sh: add support for specifying the operating band

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 5fe549836fefea5ed656d73a0040dd0451f84705)

2 years agonetifd: update to the latest master
Rafał Miłecki [Thu, 20 May 2021 10:22:12 +0000 (12:22 +0200)]
netifd: update to the latest master

config: fix ifname->ports compat rename

Fixes: 829b5c2ba32f ("netifd: update to the latest version")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit cea6631cdf09c577ae87a21bc3b03273a233c17e)

2 years agonetifd: update to the latest version
Felix Fietkau [Tue, 18 May 2021 10:52:31 +0000 (12:52 +0200)]
netifd: update to the latest version

02dd2f2df7cb fix unannotated fall-through warnings
3052f2f67686 extdev: remove unused function
2a97fd006c3b device: add support for configuring devices with external auth handler
87e469be0c08 wireless: fix memory corruption bug when using vlans/station entries in the config
7277764bf817 bridge: rename "ifname" attribute to "ports"

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 829b5c2ba32f5ec821eab6762deecdf3522470a9)

2 years agolibubox: update to the latest version
Felix Fietkau [Mon, 17 May 2021 15:58:52 +0000 (17:58 +0200)]
libubox: update to the latest version

870acee325fe tests: cram: test_base64: fix failing tests
4d8995e91d56 tests: cram: test_base64: really fix failing tests
551d75b5662c libubox: tests: add more blobmsg/json test cases
a0dbcf8b8f96 tests: add blob-buffer overflow test
b36a3a90098d blob: fix exceeding maximum buffer length
b8abed749423 utils.h: add fallthrough macro
b14c4688612c json_script: fix unannotated fall-through warning

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 04d21604fd72f337c8a0410d13b3d878914b7e7e)

2 years agonetifd: read udhcpc user scripts from directory
Leon M. George [Tue, 23 Mar 2021 10:02:36 +0000 (11:02 +0100)]
netifd: read udhcpc user scripts from directory

Placeholder DHCP user scripts were added recently.

These files make package-based installations of such scripts more difficult.
Pull user callbacks from directories instead to allow packages and users to
install co-existing scripts more easily.

References:
130118f7a netifd: add a udhcpc.user placeholder script

Signed-off-by: Leon M. George <leon@georgemail.eu>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
(cherry picked from commit 467c32600cc575fcb67c5f01ad32e02141220ceb)

2 years agonetifd: update to Git version 2021-04-03
Hauke Mehrtens [Sat, 3 Apr 2021 17:11:38 +0000 (19:11 +0200)]
netifd: update to Git version 2021-04-03

f8899b9 netifd: bridge: set default value for igmp_snoop
327da98 netifd: add possibility to switch off route config

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit b974293efa24b8e1bf859b1ed253ca0042ab273e)

2 years agonetifd: update to git HEAD
Daniel Golle [Wed, 31 Mar 2021 00:32:51 +0000 (01:32 +0100)]
netifd: update to git HEAD

 09632d4 device: remove left-over comment
 b22f83d handler: add mechanism to generate external device handler stubs
 80bf9d7 extdev: add support for external device handlers
 44c0f40 system-linux: reorder sysctl functions
 c84f3b0 system-linux: add device options used by wpad

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit e62ace0ecf228f3a8bc86cea2252539ac7fd988c)

2 years agonetifd: add a udhcpc.user placeholder script
Rui Salvaterra [Tue, 9 Mar 2021 22:22:09 +0000 (22:22 +0000)]
netifd: add a udhcpc.user placeholder script

Document the existence of this feature. This allows the user to execute a script
at each DHCPv4 event. This is useful, for example, as an ad-hoc way to update a
DDNS entry when (and only when) required.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 130118f7aa3191a2afd244d49e3057d4c5688676)

2 years agolibubox: update to git HEAD
Daniel Golle [Tue, 2 Mar 2021 19:09:11 +0000 (19:09 +0000)]
libubox: update to git HEAD

 2e52c7e libubox: fix BLOBMSG_CAST_INT64 (do not override BLOBMSG_TYPE_DOUBLE)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit c82cc4407adebd683593d8f0b71d10e694ff8804)

2 years agobase-files: use "ports" array in board.json network for bridges
Rafał Miłecki [Fri, 14 May 2021 09:09:57 +0000 (11:09 +0200)]
base-files: use "ports" array in board.json network for bridges

Bridge aggregates multiple ports so use a more accurate name ("ports")
and format (array) for storing them in board.json.

Example:

"network": {
"lan": {
"ports": [
"lan1",
"lan2",
"lan3",
"lan4"
],
"protocol": "static"
},
"wan": {
"ifname": "wan",
"protocol": "dhcp"
}
}

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit d42640e389a8b22a31fb0061c12cd9dfbddb87b8)

2 years agotreewide: Mark packages nonshared if they depend on @TARGET_
Hauke Mehrtens [Sun, 2 May 2021 22:35:38 +0000 (00:35 +0200)]
treewide: Mark packages nonshared if they depend on @TARGET_

This marks all packages which depend on a target with @TARGET nonshared.
If they are not marked nonshared they would be build by the SDK build
and if this happens with a different SDK, then the SDK from the target
the package depends on, the package would not be added to the index.

This should fix the image builder for some of these packages.

This should fix the image builder at least for bcm27xx/bcm2710 and
bcm4908/generic.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 1903233f2b312caf87aa369cd325d9689c45a1c6)

2 years agofakeroot: Alpine linux libc.musl build error fix
Ruslan Isaev [Mon, 10 May 2021 14:56:59 +0000 (14:56 +0000)]
fakeroot: Alpine linux libc.musl build error fix

Prevent build error on Alpine Linux host:
libfakeroot.c error: conflicting types for 'id_t'
Error relocating openwrt/staging_dir/host/lib/libfakeroot.so: SEND_GET_XATTR: symbol not found

Signed-off-by: Ruslan Isaev <legale.legale@gmail.com>
(cherry picked from commit 7a70f78fb7da4dc3e8c58e7662f4dc623274a78b)

2 years agokernel-defaults: fix external kernel build when user_headers is missing
Matt Merhar [Fri, 26 Feb 2021 04:28:53 +0000 (23:28 -0500)]
kernel-defaults: fix external kernel build when user_headers is missing

Use an 'if' so the absence of $(LINUX_DIR)/user_headers doesn't make the
line evaluate to false and cause the build to fail.

Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
(cherry picked from commit cc76e34c10e57cb1a4f7971268a77aad2f24c8ca)

2 years agomvebu: 5.4 fix DVFS caused random boot crashes
Robert Marko [Wed, 19 May 2021 11:02:31 +0000 (13:02 +0200)]
mvebu: 5.4 fix DVFS caused random boot crashes

5.10.37 and 5.4.119 introduced a lot of DVFS changes for Armada 37xx from 5.13 kernel.

Unfortunately commit:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/cpufreq/armada-37xx-cpufreq.c?h=v5.10.37&id=a13b110e7c9e0dc2edcc7a19d4255fc88abd83cc

This patch actually corrects the things so that 1 or 1.2GHz models would actually get scaled to their native frequency.

However, due to a AVS setting voltages too low this will cause random crashes on 1.2GHz models.

So, until a new safe for everybody voltage is agreed on
lets revert the patch.

Fixes: 9d21ecc ("kernel: bump 5.4 to 5.4.119")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
(cherry picked from commit 080a0b74e39d159eecf69c468debec42f28bf4d8)

2 years agoccache: Build with ENABLE_DOCUMENTATION=OFF
David Adair [Fri, 14 May 2021 23:04:27 +0000 (16:04 -0700)]
ccache: Build with ENABLE_DOCUMENTATION=OFF

This adjusts the Makefile to use the new option to turn off the
doc builds. It will not cause any problems except a warning
about unused options if combined with a ccache source missing
the upstream patch.

Since a config setting is required to re-enable the doc build this
is equivalent to unconditionally disabling the docs if the config
setting is not created.

Signed-off-by: David Adair <djabhead@aol.com>
(cherry picked from commit 2d1546832357a3a8bd18680bd31dd92050e739b2)

2 years agogeneric: mt7530: fix EEE patch
DENG Qingfang [Fri, 7 May 2021 04:36:03 +0000 (12:36 +0800)]
generic: mt7530: fix EEE patch

The higher 16-bit of EEE register was overwritten by mistake, fix that.

Fixes: 5b9ba4a93e83 ("generic: mt7530: support adjusting EEE")
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
(cherry picked from commit 8d1567ba6177f24969e76733d0cee30a830b5f7e)

2 years agokernel: backport "mvmdio avoid error message for optional IRQ"
Daniel González Cabanelas [Fri, 23 Apr 2021 15:33:32 +0000 (17:33 +0200)]
kernel: backport "mvmdio avoid error message for optional IRQ"

Rid of kernel error message:
  [    0.780828] orion-mdio d0072004.mdio: IRQ index 0 not found

on Marvell targets backporting the kernel commit fa2632f74e57

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(cherry picked from commit d6831752367722e916bd15e5d1af79993c637a67)

2 years agobcm63xx: Remove patch already applied upstream
Hauke Mehrtens [Sun, 23 May 2021 13:38:57 +0000 (15:38 +0200)]
bcm63xx: Remove patch already applied upstream

The patch 434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch is
integrated in the kernel update 5.4.119 and not needed any more.

Fixes: 9d21eccc6b76 ("kernel: bump 5.4 to 5.4.119")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agouclient: update to Git version 2021-05-14
Baptiste Jonglez [Fri, 14 May 2021 21:40:40 +0000 (23:40 +0200)]
uclient: update to Git version 2021-05-14

6a6011d uclient-http: set eof mark when content-length is 0
19571e4 tests: fix help usage test for uclient built with sanitizer
c5fc04b tests: fix help usage test

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
(cherry picked from commit 1ec6fc4dcba16045a6bfcc493bdbe892de1265a9)

2 years agouclient: update to Git version 2021-04-03
Hauke Mehrtens [Sat, 3 Apr 2021 17:04:53 +0000 (19:04 +0200)]
uclient: update to Git version 2021-04-03

83efca2 tests: fix possibly longer start of HTTP server
64e00d6 uclient-fetch: document missing options

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 1371910b76f021486810b18f371b3dc528d952ea)

2 years agobusybox: disable PREFER_IPV4_ADDRESS
Baptiste Jonglez [Thu, 13 May 2021 17:50:22 +0000 (19:50 +0200)]
busybox: disable PREFER_IPV4_ADDRESS

PREFER_IPV4_ADDRESS is broken on IPv6-only hosts, as it causes busybox
utilities (ping, traceroute, ntpd) to forcibly use the A record instead of
the AAAA record when resolving a DNS name.  This obviously fails when
there is no IPv4 connectivity.  Since IPv6-only hosts or routers will only
become more common over time, disable PREFER_IPV4_ADDRESS to support this
use-case.

As a side-effect, disabling PREFER_IPV4_ADDRESS changes the default
resolution behaviour of busybox utilities on dual-stack hosts.  Busybox
utilities now simply use the order given by getaddrinfo(), so they will
now prefer IPv6 addresses when resolving a name with both A and AAAA
records if there is IPv6 connectivity.  This is in line with RFC 6724.

PREFER_IPV4_ADDRESS was likely intended to work around naive
implementations of getaddrinfo() that could return AAAA records first,
even on an IPv4-only host.  But both musl (since 1.1.3) and glibc
correctly implement RFC 6724 for getaddrinfo() and check connectivity to
determine the correct order in which to return records.  On IPv4-only
hosts, getaddrinfo() will return A records first, so there is no need for
the PREFER_IPV4_ADDRESS hack.

See also: https://bugs.busybox.net/show_bug.cgi?id=12381

Fixes: FS#84
Fixes: FS#2608
References: https://github.com/openwrt/openwrt/pull/4167
Signed-off-by: Alexander Traud <pabstraud@compuserve.com>
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
(cherry picked from commit 7fea9d9f5dd282a7049d77cc6b75e0a703ead26c)

2 years agoopenwrt-keyring: Only copy sign key for 21.02
Hauke Mehrtens [Fri, 14 May 2021 22:00:39 +0000 (00:00 +0200)]
openwrt-keyring: Only copy sign key for 21.02

Instead of adding all public signature keys from the openwrt-keyring
repository only add the key which is used to sign the OpenWrt 21.02 feeds.

If one of the other keys would be compromised this would not affect
users of 21.02 release builds.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agoramips: fix SUPPORTED_DEVICES for ALFA Network devices
Piotr Dymacz [Sun, 16 May 2021 21:48:04 +0000 (23:48 +0200)]
ramips: fix SUPPORTED_DEVICES for ALFA Network devices

Vendor firmware expects model name without manufacturer name inside
'supported_devices' part of metadata. This allows direct upgrade to
OpenWrt from vendor's GUI.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
(cherry picked from commit cf3f1f82eaa95c72b3b2620c6da15a81f8d57ba7)

2 years agoprocd: update to git HEAD
Daniel Golle [Tue, 23 Feb 2021 13:16:23 +0000 (13:16 +0000)]
procd: update to git HEAD

 2be57ed cosmetics: provide compatible system info on Aarch64
 37eed13 system: expose if system was booted from initramfs

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry-picked from commit 5f1bd952785e3257199879248e0b82216757b0b6)

2 years agomt76: update to the latest version
Felix Fietkau [Mon, 10 May 2021 10:36:42 +0000 (12:36 +0200)]
mt76: update to the latest version

Includes fix for CVE-2020-24588

186af01047b2 mt76: mt7921: introduce MCU_EVENT_LP_INFO event parsing
93b5c28c97d5 mt76: mt7921: add rcu section in mt7921_mcu_tx_rate_report
a8e89c5a1d1f mt76: testmode: add support to send larger packet
a0cc9a9e3877 mt76: mt7915: rework mt7915_tm_set_tx_len()
c8b96630324e mt76: mt7915: fix rate setting of tx descriptor in testmode
22fd2958c42a mt76: mt7615: fix memleak when mt7615_unregister_device()
7401e0db3143 mt76: mt7915: fix memleak when mt7915_unregister_device()
c3656268b3f6 mt76: mt7915: only free skbs after mt7915_dma_reset() when reset happens
0ce955b04ba8 mt76: mt7615: only free skbs after mt7615_dma_reset() when reset happens
b03d1e62acf7 mt76: mt7615: use ieee80211_free_txskb() in mt7615_tx_token_put()
5ac02e22fb03 mt76: flush tx status queue on DMA reset
c71f609b398a mt76: sync with upstream changes
23ecadd4af77 mt76: mt7615: fix hardware error recovery for mt7663
57a899ee3c3c mt76: mt7615: fix entering driver-own state on mt7663
42a2dddb706b mt76: mt7615: load ROM patch before checking patch semaphore status
cf0e406af84a mt76: mt7915: add support for applying pre-calibration data
459940ccbc58 mt76: mt7921: move hw configuration in mt7921_register_device
0a094b11f3c0 mt76: improve mcu error logging
bf536832e37d mt76: mt7921: run mt7921_mcu_fw_log_2_host holding mt76 mutex
7616f4f78163 mt76: mt7921: add wifisys reset support in debugfs
e620bd881ef5 mt76: mt7921: abort uncompleted scan by wifi reset
e8dacf59ab1c mt76: mt7915: rework the flow of txpower setting
c8c78e577236 mt76: mt7915: directly read per-rate tx power from registers
1622bf4f8705 mt76: mt7921: add mt7921_dma_cleanup in mt7921_unregister_device
ef96fafad8a9 mt76: Convert to DEFINE_SHOW_ATTRIBUTE
90e4bfea2948 mt76: mt7921: do not use 0 as NULL pointer
0a139d7f5966 mt76: connac: move mcu_update_arp_filter in mt76_connac module
de26c73ce3c2 mt76: mt7921: remove leftover function declaration
1c0b6cb4f942 mt76: mt7921: fix a race between mt7921_mcu_drv_pmctrl and mt7921_mcu_fw_pmctrl
2923e3e2b8e4 mt76: mt7663: fix a race between mt7615_mcu_drv_pmctrl and mt7615_mcu_fw_pmctrl
74d0fdaa7a99 mt76: connac: introduce wake counter for fw_pmctrl synchronization
28c87e09a5ea mt76: mt7921: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path
36f664edc7db mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path
51b3d1a9a2b7 mt76: dma: add the capability to define a custom rx napi poll routine
4f1339c9fb72 mt76: mt7921: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx/rx napi
1bc5e67a60be mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx/rx napi
325f7b451c03 mt76: connac: unschedule ps_work in mt76_connac_pm_wake
12115052a02f mt76: connac: check wake refcount in mcu_fw_pmctrl
e5d28e3cef66 mt76: connac: remove MT76_STATE_PM in mac_tx_free
475112a3cdcc mt76: mt7921: get rid of useless MT76_STATE_PM in mt7921_mac_work
112998f32d85 mt76: connac: alaways wake the device before scanning
4334f3e2fc43 mt76: mt7615: rely on pm refcounting in mt7615_led_set_config
0562380659ad mt76: connac: do not run mt76_txq_schedule_all directly
acfa78df5708 mt76: connac: use waitqueue for runtime-pm
ca74a4cd0722 mt76: remove MT76_STATE_PM in tx path
0c2d3e74852e mt76: mt7921: add awake and doze time accounting
45e0eefffe9f mt76: mt7921: enable sw interrupts
fd2ff641166f mt76: mt7615: Fix a dereference of pointer sta before it is null checked
7e2521468767 mt76: mt7921: move mt7921_dma_reset in dma.c
c9dd6b1fa171 mt76: mt7921: introduce mt7921_wpdma_reset utility routine
2ac7c7e9c568 mt76: mt7921: introduce mt7921_dma_{enable,disable} utilities
662a89f2b9d1 mt76: mt7921: introduce mt7921_wpdma_reinit_cond utility routine
614efe9e9180 mt76: connac: introduce mt76_connac_mcu_set_deep_sleep utility
0dbb16ef39d8 mt76: mt7921: enable deep sleep when the device suspends
3c19f569cc70 mt76: mt7921: fix possible invalid register access
ade1f5aad4c6 mt76: move token_lock, token and token_count in mt76_dev
8d5c456be1ff mt76: move token utilities in mt76 common module
fb04d9df5e52 mt76: mt7915: do not read rf value from efuse in flash mode
2126b2176336 mt76: mt7921: get rid of mcu_reset function pointer
d325b7eff1b1 mt76: mt7921: improve doze opportunity
2ae25c7e547e mt76: mt7663: add awake and doze time accounting
349bbb9d6f13 mt76: connac: unschedule mac_work before going to sleep
98a235004dea mt76: mt7921: mt7921_stop should put device in fw_own state
63d80b9ab251 mt76: mt7921: introduce mt7921_mcu_sta_add routine
3c5bf837fdbd mt76: mt7615: fix a precision vs width bug in printk
ded14da5eacc mt76: mt7915: fix a precision vs width bug in printk
aaf0d254f9ea mt76: mt7921: fix a precision vs width bug in printk
757af5c67d32 mt76: move mt76_token_init in mt76_alloc_device
ed41ed73a495 mt76: mt7921: reinit wpdma during drv_own if necessary
92fb81e085c6 mt76: mt7921: fix possible AOOB issue in mt7921_mcu_tx_rate_report
53d915a23bc9 mt76: connac: do not schedule wake_work if the runtime-pm is disabled
23fe1bdcf15a mt76: connac: do not schedule mac_work if the device is not running
e5b19336c58e mt76: mt7615: do not set MT76_STATE_PM at bootstrap
0fc2136a61dd mt76_connac_mcu: move mt76_connac_mcu_update_arp_filter outside of CONFIG_PM
e693f3e23e06 mt76: mt7915: add MSI support
5231e7300fa4 mt7915: disable ASPM
554b50dabf54 mt76: connac: fix uninitialized HT A-MPDU setting field in STA_REC_PHY
43b9c0a838bb mt76: mt7921: fix max aggregation subframes setting
5a387a0a3004 mt76: mt7921: enable rx hw de-amsdu
c8cbcb87be07 mt76: connac: add missing configuration in mt76_connac_mcu_wtbl_hdr_trans_tlv
55921e57b380 mt76: mt7921: enable rx header traslation offload
01441f67d8b2 mt76: mt7921: enable rx csum offload
c9ab76dd93a0 mt76: mt7915: move mt7915_queue_rx_skb to mac.c
caedb4c4ee41 mt76: mt7615: fix fixed-rate tx status reporting
c6ae95d43e6d mt76: improve tx status codepath
27d468d094e6 mt76: mt7915: rework tx rate reporting
3b4ca5b09e2c mt76: mt7615: avoid use of ieee80211_tx_info_clear_status
e1f07d7f1cb9 mt76: mt7603: avoid use of ieee80211_tx_info_clear_status
18513ba5fbc2 mt76: mt7915: add support for tx status reporting
35f189cf81b2 mt76: mt7915: fix uninitialized variable in MSI error handling
9e928ac1ea9b mt76: dma: use ieee80211_tx_status_ext to free packets when tx fails
628eee9c386c mt76: fill queue entry wcid for all skbs with a station
a9bc4d94b7a1 mt76: intialize tx queue entry wcid to 0xffff by default
998ca8af7d17 mt76: mt7915: fix tssi indication field of DBDC NICs
7dd24b3cfacf mt76: mt7915: fix a signedness bug in mt7915_mcu_apply_tx_dpd()
535025d65d8d mt76: mt7915: cleanup mt7915_mcu_sta_rate_ctrl_tlv()
ff8bbe22dd87 mt76: mt7915: add .set_bitrate_mask() callback
c7dd54a22e30 mt76: connac: skip wtbl reset on sta disconnect
3511fd430356 mt76: validate rx A-MSDU subframes
aedc3145de6e mt76: fix possible NULL pointer dereference in mt76_tx
5c2baab92cd0 mt76: mt7615: fix NULL pointer dereference in tx_prepare_skb()
af21659ee834 mt76: mt76x0: use dev_debug instead of dev_err for hw_rf_ctrl
e423c16f16f7 mt76: mt7615: free irq if mt7615_mmio_probe fails
f2d0da8da9b7 mt76: mt7663: enable hw rx header translation
d2713a5d9de9 mt76: mt7921: fix mt7921_wfsys_reset sequence
ce5f32d84f33 mt76: mt7921: Don't alter Rx path classifier
8ab8c7747197 mt76: connac: fw_own rely on all packet memory all being free
a747b0bb4956 mt76: mt7921: enable deep sleep at runtime
2e6e999509b1 mt76: mt7921: add deep sleep control to runtime-pm knob
30bcb2338ce2 mt76: connac: fix WoW with disconnetion and bitmap pattern
56518f4a126e mt76: mt7921: consider the invalid value for to_rssi
e969ab10a034 mt76: mt7921: add back connection monitor support
28b162366d09 mt76: fix calling mt76_get_of_eeprom with an offset for pre-cal data
9d736545bb5a mt76: mt7915: disable pre-calibration support for now

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit f62aa9e7816fd0601a7997d87c89767939a6afcf)

2 years agomac80211: backport upstream fixes for FragAttacks
Felix Fietkau [Wed, 12 May 2021 12:28:37 +0000 (14:28 +0200)]
mac80211: backport upstream fixes for FragAttacks

From the patch series description:

Several security issues in the 802.11 implementations were found by
Mathy Vanhoef (New York University Abu Dhabi), who has published all
the details at

https://papers.mathyvanhoef.com/usenix2021.pdf

Specifically, the following CVEs were assigned:

 * CVE-2020-24586 - Fragmentation cache not cleared on reconnection
 * CVE-2020-24587 - Reassembling fragments encrypted under different
                    keys
 * CVE-2020-24588 - Accepting non-SPP A-MSDU frames, which leads to
                    payload being parsed as an L2 frame under an
                    A-MSDU bit toggling attack
 * CVE-2020-26139 - Forwarding EAPOL from unauthenticated sender
 * CVE-2020-26140 - Accepting plaintext data frames in protected
                    networks
 * CVE-2020-26141 - Not verifying TKIP MIC of fragmented frames
 * CVE-2020-26142 - Processing fragmented frames as full frames
 * CVE-2020-26143 - Accepting fragmented plaintext frames in
                    protected networks
 * CVE-2020-26144 - Always accepting unencrypted A-MSDU frames that
                    start with RFC1042 header with EAPOL ethertype
 * CVE-2020-26145 - Accepting plaintext broadcast fragments as full
                    frames
 * CVE-2020-26146 - Reassembling encrypted fragments with non-consecutive
                    packet numbers
 * CVE-2020-26147 - Reassembling mixed encrypted/plaintext fragments

In general, the scope of these attacks is that they may allow an
attacker to
 * inject L2 frames that they can more or less control (depending on the
   vulnerability and attack method) into an otherwise protected network;
 * exfiltrate (some) network data under certain conditions, this is
   specific to the fragmentation issues.

A subset of these issues is known to apply to the Linux IEEE 802.11
implementation (mac80211). Where it is affected, the attached patches
fix the issues, even if not all of them reference the exact CVE IDs.

In addition, driver and/or firmware updates may be necessary, as well
as potentially more fixes to mac80211, depending on how drivers are
using it.

Specifically, for Intel devices, firmware needs to be updated to the
most recently released versions (which was done without any reference
to the security issues) to address some of the vulnerabilities.

To have a single set of patches, I'm also including patches for the
ath10k and ath11k drivers here.

We currently don't have information about how other drivers are, if
at all, affected.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agokernel: bump 5.4 to 5.4.119
Hauke Mehrtens [Sat, 15 May 2021 14:21:46 +0000 (16:21 +0200)]
kernel: bump 5.4 to 5.4.119

Removed because in upstream
  generic/backport-5.4/050-gro-fix-napi_gro_frags-Fast-GRO-breakage-due-to-IP-a.patch
  ath79/patches-5.4/0050-spi-ath79-remove-spi-master-setup-and-cleanup-assign.patch
  ramips/patches-5.4/999-fix-pci-init-mt7620.patch

Manually rebased
  ath79/patches-5.4/0033-spi-ath79-drop-pdata-support.patch

All others updated automatically.

Compile-tested on: x86/64, ath79/generic
Runtime-tested on: x86/64, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agomvebu: Remove patch only needed for kernel 5.10
Hauke Mehrtens [Thu, 13 May 2021 20:37:30 +0000 (22:37 +0200)]
mvebu: Remove patch only needed for kernel 5.10

Kernel 5.10 is not supported by OpenWrt 21.02, remove this patch.

Fixes: d530ff37bf33 ("mvebu: armada 370: dts: fix the crypto engine")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agobusybox: update to 1.33.1
Nick Hainke [Sat, 8 May 2021 07:38:58 +0000 (09:38 +0200)]
busybox: update to 1.33.1

Remove backports:
- 001-backport1330fix-ash-make-strdup-copy.patch
- 002-backport1330fix-traceroute.patch
- 005-backport-CVE-2021-28831.patch

Remove upstreamed:
- 010-fix-wrong-variable.patch

Signed-off-by: Nick Hainke <vincent@systemli.org>
[don't use $(AUTORELEASE) for now]
Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 6713fe030fca32fc3d5ad9761f3b2f96501aedd6)

2 years agokernel: Activate FORTIFY_SOURCE for MIPS kernel 5.4
Hauke Mehrtens [Sat, 3 Apr 2021 18:02:54 +0000 (20:02 +0200)]
kernel: Activate FORTIFY_SOURCE for MIPS kernel 5.4

CONFIG_FORTIFY_SOURCE=y is already set in the generic kernel
configuration, but it is not working for MIPS on kernel 5.4, support for
MIPS was only added with kernel 5.5, other architectures like aarch64
support FORTIFY_SOURCE already since some time.

This patch adds support for FORTIFY_SOURCE to MIPS with kernel 5.4,
kernel 5.10 already supports this and needs no changes.

This backports one patch from kernel 5.5 and one fix from 5.8 to make
fortify source also work on our kernel 5.4.

The changes are not compatible with the
306-mips_mem_functions_performance.patch patch which was also removed
with kernel 5.10, probably because of the same problems. I think it is
not needed anyway as the compiler should automatically optimize the
calls to memset(), memcpy() and memmove() even when not explicitly
telling the compiler to use the build in variant.

This increases the size of an uncompressed kernel by less than 1 KB.

Acked-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 9ffa2f8193a43b9044fcfd0e16b204e989b0d941)

2 years agomac80211/rtl: backport a rtl8192cu AP mode fix
Rui Salvaterra [Wed, 21 Apr 2021 11:09:17 +0000 (12:09 +0100)]
mac80211/rtl: backport a rtl8192cu AP mode fix

Running USB devices in AP mode is never a good idea. That said, fix the TIM
issue in rtl8192cu [1], allowing these devices to "work" in AP mode.

[1] https://patchwork.kernel.org/project/linux-wireless/patch/20210419065956.6085-1-pkshih@realtek.com/

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit eeda8652f1655d4f9c11e9c9f51ddcd3377d119a)

2 years agoglibc: update to latest 2.33 HEAD (bug 27744)
Hans Dedecker [Wed, 28 Apr 2021 18:48:01 +0000 (20:48 +0200)]
glibc: update to latest 2.33 HEAD (bug 27744)

3f5080aedd nptl: Do not build nptl/tst-pthread-gdb-attach as PIE
36783141cf nptl: Check for compatible GDB in nptl/tst-pthread-gdb-attach
ea299b62e8 nptl_db: Support different libpthread/ld.so load orders (bug 27744)
162df872f0 x86: tst-cpu-features-supports.c: Update AMX check

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
(cherry picked from commit 2fc20886ec70d55a4e445689a849cfd1fab07750)

2 years agoramips: fix mac addresses of Youku YK1
Shiji Yang [Wed, 5 May 2021 11:48:01 +0000 (19:48 +0800)]
ramips: fix mac addresses of Youku YK1

MAC addresses read from official firmware

        value       location
Wlan    xx 71 de    factory@0x04
Lan     xx 71 dd    factory@0x28
Wan     xx 71 df    factory@0x2e
Label   xx 71 dd    factory@0x28

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[fix sorting in 02_network, redact commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit e57e460dc75836d3227e7370b9e64a0eabc9d91d)

2 years agoipq40xx: fix hard_config partition size on MikroTik hAP-ac2
Baptiste Jonglez [Mon, 3 May 2021 10:39:47 +0000 (12:39 +0200)]
ipq40xx: fix hard_config partition size on MikroTik hAP-ac2

The routerbootparts driver dynamically discovers the location of MikroTik
partitions, but it cannot determine their size (except by extending them
up to the start of the next discovered partition).

The hard_config partition has a default size of 0x1000 in the driver,
while it actually takes 0x2000 on the hAP-ac2.  Set the correct size in
the hAP-ac2 DTS.

On most devices, this isn't a problem as the actual data fits in 0x1000
bytes.  However, some devices have larger data that doesn't fit in 0x1000
bytes.  In any case, all devices seen so far have enough space for a
0x2000 hard_config partition before the start of the dtb_config partition.
With the current 0x1000 size:

0x00000000e000-0x00000000f000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

With this patch extending the size to 0x2000:

0x00000000e000-0x000000010000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

Other ipq40xx boards may need the same fix but it needs testing.

References: https://forum.openwrt.org/t/support-for-mikrotik-hap-ac2/23333/324
Acked-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
(cherry picked from commit 979f4063668185182db7bd2ad4efe6010047765e)

2 years agosdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives
Sven Roederer [Fri, 7 May 2021 19:35:21 +0000 (21:35 +0200)]
sdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives

Using these config-options to customize the folders used at build-time makes these
folder settings appear in generated archive. This causes the SDK to be not
portable, as it's going to use the build-time folders on the new systems.
The errors vary from passing the build, disk out-of-space to permission denied.

The build-time settings of these folders are passed into the archive via Config.build.
The expected behavior is that the SDK acts after unpacking like these settings have
their defaults, using intree folders. So just filter these folders out when running
convert-config.pl to create Config.build.

This addresses the same issue that's fixed in the previous commit for the imagebuilder.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 1e4b191ac8901328a726ebdc09ebe35da4363521)

2 years agoimagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archive
Sven Roederer [Fri, 7 May 2021 19:35:20 +0000 (21:35 +0200)]
imagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archive

Using these config-options to customize the folders used at build-time
makes these folder settings appear in generated archive. This causes the
imagebuilder to be not portable, as it's going to use the build-time folders
on the new systems. Errors look like:

  mkdir: cannot create directory '/mnt/build': Permission denied
  Makefile:116: recipe for target '_call_image' failed
  make[2]: *** [_call_image] Error 1
  Makefile:241: recipe for target 'image' failed
  make[1]: *** [image] Error 2

The build-time settings of these folders are passed into the archives via
.config file.
The expected behavior is that after unpacking the imagebuilder acts like
these settings have their defaults, using intree folders. So unset the
build-time settings.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 6967903b01ea9f7c9f70d0185c3da276801dd78f)

2 years agobusybox: add SRV support to nslookup_lede.c patch
Perry Melange [Tue, 30 Jul 2019 09:05:22 +0000 (11:05 +0200)]
busybox: add SRV support to nslookup_lede.c patch

Add support for querying and parsing SRV DNS records to nslookup_lede.c

This patch is based on http://lists.busybox.net/pipermail/busybox/2019-June/087359.html

Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
[reword subject, bump PKG_RELEASE]
Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 3a359398f04f3f4c4a42d1ca274bb1a0f0303e05)

2 years agobase-files: shinit: properly handle dashes in service names
Jo-Philipp Wich [Wed, 12 May 2021 10:44:32 +0000 (12:44 +0200)]
base-files: shinit: properly handle dashes in service names

Fixes: FS#3801
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 75ea878d1ba05610121a732dc0abf7c914e83ca1)

2 years agogeneric: platform/mikrotik: release mtd device after use
Thibaut VARÈNE [Tue, 11 May 2021 10:50:21 +0000 (12:50 +0200)]
generic: platform/mikrotik: release mtd device after use

The code uses get_mtd_device_nm() which must be followed by a call to
put_mtd_device() once the handle is no longer used.

This fixes spurious shutdown console messages such as:
[ 2256.334562] Removing MTD device #7 (soft_config) with use count 1

Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(cherry picked from commit 4e385a27d6c4aab62ef7fc9856f09ebee9632985)

2 years agouqmi: fix network registration loop
Thomas Richard [Tue, 20 Apr 2021 14:49:02 +0000 (16:49 +0200)]
uqmi: fix network registration loop

With some debug in qmi.sh using following patch, some errors are visible
in the registration step
@@ -29,6 +29,7 @@ proto_qmi_init_config() {
 }

 proto_qmi_setup() {
+       set -x
        local interface="$1"
        local dataformat connstat plmn_mode mcc mnc
        local device apn auth username password pincode delay modes pdptype
@@ -224,6 +225,8 @@ proto_qmi_setup() {
                fi
        done

+       registration=$(uqmi -s -d "$device" --get-serving-system)
+
        [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1

        echo "Starting network $interface"

During the boot of the system, modem could not start automatically its
network registration.
netifd: wan (9235): + echo 'Waiting for network registration'
netifd: wan (9235): Waiting for network registration
netifd: wan (9235): + local 'registration_timeout=0'
netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system
netifd: wan (9235): + grep '"searching"'
netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system
netifd: wan (9235): + registration='{"registration":"not_registered","plmn_mcc":208,"plmn_mnc":20,"plmn_description":"","roaming":true}'
netifd: wan (9235): + '[' -n  ]
netifd: wan (9235): + echo 'Starting network wan'

As the while loop checks only "searching" pattern, uqmi.sh script quits
searching loop and continues whereas the modem is not registered

Other issue, after X seconds modem stops searching.
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + grep '"searching"'
netifd: wan (9213): + '[' -e /dev/cdc-wdm0 ]
netifd: wan (9213): + '[' 3 -lt 0 -o 0 '=' 0 ]
netifd: wan (9213): + let registration_timeout++
netifd: wan (9213): + sleep 1
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + grep '"searching"'
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + registration='{"registration":"not_registered"}'
netifd: wan (9213): + '[' -n  ]
netifd: wan (9213): + echo 'Starting network wan'
netifd: wan (9213): Starting network wan

If registration_timeout is not expired, registration can be restarted

Signed-off-by: Thomas Richard <thomas.richard@kontron.com>
Tested-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 2eda042d553c23590c9d6ade8a1a17ffcfb4be7c)

2 years agokernel: fix parsing fixed subpartitions
Rafał Miłecki [Thu, 6 May 2021 11:10:17 +0000 (13:10 +0200)]
kernel: fix parsing fixed subpartitions

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit ed4641e9f1ad940cb60187dea09cf17c865efcaf)

2 years agoExtend checks on build prerequisites for building OpenWRT core
Bas Mevissen [Mon, 19 Apr 2021 23:08:19 +0000 (01:08 +0200)]
Extend checks on build prerequisites for building OpenWRT core

OpenWRT requires a number of Perl modules to be installed. It wasn't checking on all of them.
This patch adds checks for Perl FindBin, File::Copy, File::Compare and Thread::Queue modules.

Failing to install these, will have the build break at some point. By adding these to the
prereq-build.mk script, they are checked on forehand.

Tested on a Fedora 33 and 34 (beta) that was freshly installed. Fedora appears to
break up Perl modules into small packages that need to be installed for the build to succeed.

Signed-off-by: Bas Mevissen <abuse@basmevissen.nl>
(cherry picked from commit f68c9474acf9a65b5a9538db8e45c173462487e3)

2 years agokernel: bump 5.4 to 5.4.117
Hauke Mehrtens [Fri, 7 May 2021 20:49:56 +0000 (22:49 +0200)]
kernel: bump 5.4 to 5.4.117

All updated automatically.

Compile-tested on: x86/64, armvirt/32, ath79/generic
Runtime-tested on: x86/64, armvirt/32, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agotplink-safeloader: fix product_name of TP-Link AD7200
Alex Henrie [Tue, 4 May 2021 03:07:17 +0000 (21:07 -0600)]
tplink-safeloader: fix product_name of TP-Link AD7200

The stock firmware does not accept firmware with "Talon" in the name.

Tested on firmware version 1.0.10 Build 20160902 rel. 57400 which came
preinstalled, as well as latest firmware version 2.0.1 Build 20170103
rel.71053 flashed from
AD7200v1-up-ver2-0-1-P1[20170103-rel71053]_2017-01-04_10.08.28.bin.

Fixes: 1a775a4fd033 ("ipq806x: add support for TP-Link Talon AD7200")
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
[added details about vendor firmware]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit dfef88b6cacceec151ca4ce4bb3dc50c1c5cf1d2)

2 years agodnsmasq: Update to version 2.85
Alan Swanson [Tue, 27 Apr 2021 15:24:05 +0000 (16:24 +0100)]
dnsmasq: Update to version 2.85

Fixes issue with merged DNS requests in 2.83/2.84 not being
retried on the firsts failed request causing lookup failures.

Also fixes the following security problem in dnsmasq:
* CVE-2021-3448:
  If specifiying the source address or interface to be used
  when contacting upstream name servers such as:
  server=8.8.8.8@1.2.3.4, server=8.8.8.8@1.2.3.4#66 and
  server=8.8.8.8@eth0 then all would use the same socket
  bound to the explicitly configured port. Now only
  server=8.8.8.8@1.2.3.4#66 will use the explicitly
  configured port and the others random source ports.

Remove upstreamed patches and update remaining patch.

Signed-off-by: Alan Swanson <reiver@improbability.net>
[refreshed old runtime support patch]
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 3980daffa4e284377cd1ae803fba78331c1fc40b)

2 years agoltq-dsl-base: Make package nonshared to fix image builder
Hauke Mehrtens [Sun, 2 May 2021 20:59:36 +0000 (22:59 +0200)]
ltq-dsl-base: Make package nonshared to fix image builder

This package depends on the lantiq target and is only build for that
target. A normal package would be build by the SDK builder probably
under a different target and then this package will not be selected.
Mark it as nonshared to build it when the lantiq target gets build.

Fixes: FS#3773, FS#3774
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 454d514f4647d6f1f0d93d8f67abdef94cd66a7d)

2 years agomac80211: Update to version 5.10.34-1
Hauke Mehrtens [Sun, 2 May 2021 16:45:40 +0000 (18:45 +0200)]
mac80211: Update to version 5.10.34-1

The removed patches were applied upstream and are not needed anymore.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 17ac9849d3ff687c8c14d63e46f3e205adc22a3e)

2 years agobusybox: backport fix for CVE-2021-28831
Hauke Mehrtens [Sun, 2 May 2021 15:42:19 +0000 (17:42 +0200)]
busybox: backport fix for CVE-2021-28831

This backports a fix for the low priority CVE-2021-28831:
  decompress_gunzip.c in BusyBox through 1.32.1 mishandles the error bit
  on the huft_build result pointer, with a resultant invalid free or
  segmentation fault, via malformed gzip data.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 13397b2b95b4800fb0a29c3d483fa280d10f0eb0)

2 years agoipq40xx: add support for MikroTik SXTsq 5 ac
Roger Pueyo Centelles [Fri, 23 Oct 2020 14:05:28 +0000 (16:05 +0200)]
ipq40xx: add support for MikroTik SXTsq 5 ac

This commit adds support for the MikroTik SXTsq 5 ac (RBSXTsqG-5acD),
an outdoor 802.11ac wireless CPE with one 10/100/1000 Mbps Ethernet
port.

Specifications:
 - SoC: Qualcomm Atheros IPQ4018
 - RAM: 256 MB
 - Storage: 16 MB NOR
 - Wireless: IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 16 dBi antennae
 - Ethernet: IPQ4018 (SoC) 1x 10/100/1000 port, 10-28 Vdc PoE in
 - 1x Ethernet LED (green)
 - 7x user-controllable LEDs
  · 1x power (blue)
  · 1x user (green)
  · 5x rssi (green)

Note:
 Serial UART is probably available on the board, but it has not been
 tested.

Flashing:
 Boot via TFTP the initramfs image. Then, upload a sysupgrade image
 via SSH and flash it normally. More info at the "Common procedures
 for MikroTik products" page https://openwrt.org/toh/mikrotik/common.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit d1f1e5269ed992e6fc30d575b43b0913c9e58ca2)
[Compile and Run Tested]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2 years agoipq40xx: add MikroTik hAP ac2 support
Robert Marko [Thu, 12 Nov 2020 18:45:22 +0000 (19:45 +0100)]
ipq40xx: add MikroTik hAP ac2 support

This adds support for the MikroTik RouterBOARD RBD52G-5HacD2HnD-TC
(hAP ac²), a  indoor dual band, dual-radio 802.11ac
wireless AP with integrated omnidirectional antennae, USB port and  five
10/100/1000 Mbps Ethernet ports.

See https://mikrotik.com/product/hap_ac2 for more info.

Specifications:
 - SoC: Qualcomm Atheros IPQ4018
 - RAM: 128 MB
 - Storage: 16 MB NOR
 - Wireless:
   · Built-in IPQ4018 (SoC) 802.11b/g/n 2x2:2, 2.5 dBi antennae
   · Built-in IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 2.5 dBi antennae
 - Ethernet: Built-in IPQ4018 (SoC, QCA8075) , 5x 1000/100/10 port,
             passive PoE in
- 1x USB Type A port

Installation:
Boot the initramfs image via TFTP and then flash the sysupgrade
image using "sysupgrade -n"

Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit faea7becafc634dc882f0ad8f9388862ccd5bd0d)
[Compile Tested]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2 years agoath79: force SGMII SerDes mode to MAC operation
David Bauer [Wed, 31 Mar 2021 23:20:45 +0000 (01:20 +0200)]
ath79: force SGMII SerDes mode to MAC operation

The mode on the SGMII SerDes on the QCA9563 is 1000 Base-X by default.
This only allows for 1000 Mbit/s links, however when used with an SGMII
PHY in 100 Mbit/s link mode, the link remains dead.

This strictly has nothing to do with the SerDes calibration, however it
is done at the same point in the QCA reference U-Boot which is the
blueprint for everything happening here. As the current state is more or
less a hack, this should be fine.

This fixes the issues outlined above on a TP-Link EAP-225 Outdoor.

Reported-by: Tom Herbers <freifunk@tomherbers.de>
Tested-by: Tom Herbers <freifunk@tomherbers.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit fbbad9a9a629b388626b477e6cd692c160f63fb3)

2 years agoath79: fix USB power on TP-Link TL-WR810N v1
Tom Stöveken [Thu, 25 Feb 2021 18:49:10 +0000 (19:49 +0100)]
ath79: fix USB power on TP-Link TL-WR810N v1

Before: Kernel reported "usb_vbus: disabling" and the USB was not
        providing power
After:  USB power is switched on, peripheral is powered from the
        device

Signed-off-by: Tom Stöveken <tom@naaa.de>
[squash and tidy up]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit a6f7268dc7519b57251532fe4239412e8acf4ca7)

2 years agokernel: bump 5.4 to 5.4.114
Hauke Mehrtens [Fri, 23 Apr 2021 23:01:21 +0000 (01:01 +0200)]
kernel: bump 5.4 to 5.4.114

Removed because in upstream*
  mvebu/patches-5.4/319-ARM-dts-turris-omnia-configure-LED-2--INTn-pin-as-interrupt-pin.patch

Manually rebased*
  generic/backport-5.4/700-v5.5-net-core-allow-fast-GRO-for-skbs-with-Ethernet-heade.patch

Added new backport*
  generic/backport-5.4/050-gro-fix-napi_gro_frags-Fast-GRO-breakage-due-to-IP-a.patch

All others updated automatically.

The new backport was included based on this[1] upstream commit that will be
mainlined soon.  This change is needed because Eric Dumazet's check for
NET_IP_ALIGN (landed in 5.4.114) causes huge slowdowns on drivers which use
napi_gro_frags().

Compile-tested on: x86/64, armvirt/64, ath79/generic
Runtime-tested on: x86/64, armvirt/64, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agoath79: mikrotik: swap RB922UAGS-5HPaCD eth0/1 MACs
Roger Pueyo Centelles [Thu, 29 Apr 2021 09:38:16 +0000 (11:38 +0200)]
ath79: mikrotik: swap RB922UAGS-5HPaCD eth0/1 MACs

Since support for SFP on the MikroTik RouterBOARD 922UAGS-5HPacD was
added by 4387fe00cb, the MAC addresses for eth0 (Ethernet) and eth1
(SFP) were swapped. This patch fixes the 02_network script to assign MAC
addresses correctly, so they match the label and the vendor's OS.

Tested on a RouterBOARD 922UAGS-5HPacD board.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit 14a95b36b1ecd038fffc279878c5a4c51043d709)

2 years agoath79: mikrotik: enable SFP on RB922UAGS-5HPaCD
Roger Pueyo Centelles [Fri, 18 Dec 2020 21:26:55 +0000 (22:26 +0100)]
ath79: mikrotik: enable SFP on RB922UAGS-5HPaCD

This patch enables the SFP cage on the MikroTik RouterBOARD 922UAGS-5HPacD.

GPIO16 (tx-disable-gpios) should be governed by the SFP driver to enable
or disable transmission, but no change is observed. Therefore, it is
left as output high to ensure the SFP module is forced to transmit.

Tested on a RouterBOARD 922UAGS-5HPacD board, with a CISCO GLC-LH-SMD
1310nm module and an unbranded GLC-T RJ45 Gigabit module. PC=>router
iperf3 tests deliver 440/300 Mbps up/down, both via regular eth0 port
or SFP port with RJ45 module. Bridge between eth0 and eth1 delivers
950 Mbps symmetric.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit 4387fe00cb7536d9d341f6d27e465ff0f0b29b1b)

2 years agomac80211: minstrel_ht: fix issue in calculating success probability
Felix Fietkau [Wed, 28 Apr 2021 19:06:36 +0000 (21:06 +0200)]
mac80211: minstrel_ht: fix issue in calculating success probability

Missing braces in a macro were leading to badly working rates sometimes
getting a success probabilty of 1.0

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 12cb52bd0665da33cb5dc64697f1751a8b33fb05)

2 years agokernel: drop the conntrack rtcache patch
Rui Salvaterra [Thu, 8 Apr 2021 22:57:48 +0000 (23:57 +0100)]
kernel: drop the conntrack rtcache patch

It's in backports-5.4, but it wasn't ever merged. Upstream followed another
approach, with flow offloading, which has much better performance. Drop this
obsolete patch and refresh the kernel patches.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 17576b1b2aeacf0a23bb9a911d675bd324754745)

3 years agoltq-vdsl-app: extent dsl metrics with state_num and power_state_num
Florian Eckert [Tue, 13 Apr 2021 09:30:33 +0000 (11:30 +0200)]
ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information.

For this the internal values are mapped to numbers.

* additional JSON output for state_num:
"state_num": <map_state_number>

Since not all values are meaningful only the following values are
implemented, this can be extended if the future.

* LSTATE_MAP_NOT_INITIALIZED
* LSTATE_MAP_EXCEPTION
* LSTATE_MAP_IDLE
* LSTATE_MAP_SILENT
* LSTATE_MAP_HANDSHAKE
* LSTATE_MAP_FULL_INIT
* LSTATE_MAP_SHOWTIME_NO_SYNC
* LSTATE_MAP_SHOWTIME_TC_SYNC
* LSTATE_MAP_RESYNC

* additinal JSON output for power_level:
"power_state_num": <map_power_satte_number>,

Since there are not so many here, all are mapped.

* PSTATE_MAP_NA,
* PSTATE_MAP_L0,
* PSTATE_MAP_L1,
* PSTATE_MAP_L2,
* PSTATE_MAP_L3,

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
v6:
Add state LSTATE_MAP_NOT_INITILIZED at the beginning of the list
Start the list LSTATE_MAP with -1
Reviewed-by: Andre Heider <a.heider@gmail.com>
(cherry picked from commit 4407d45d9667ab3d376ad4a6b760e07f4dd43e49)

3 years agolantiq: use ActualNetDataRate for speed reporting
Jeroen Peelaerts [Tue, 9 Feb 2021 22:33:51 +0000 (23:33 +0100)]
lantiq: use ActualNetDataRate for speed reporting

Switch to Actual Net Data Rate (ACTNDR) for speed reporting on lantiq VDSL modems

Refer to ITU-T G.997.1 chapter 7.5.2.8

Independent whether retransmission is used or not in a given transmit direction:
-   In L0 state, this parameter reports the Net Data Rate (as specified in G.992.3, G.992.5 or G.993.2) at which the bearer channel is operating.
-   In  L2 state, the parameter contains the Net Data Rate (as specified in G.992.3, G.992.5 or G.993.2) in the previous L0 state.

Signed-off-by: Jeroen Peelaerts <jeroen.peelaerts@gmail.com>
Reviewed-by: Andre Heider <a.heider@gmail.com>
(cherry picked from commit 4f27ea7c33447f4b0c8e577509726927916b9625)

3 years agolantiq: enable G.INP retransmission counters
Jeroen Peelaerts [Sat, 16 May 2020 10:12:46 +0000 (12:12 +0200)]
lantiq: enable G.INP retransmission counters

This commit adds monitoring for a couple of DSL line features that are
present in the lantiq firmware blobs.

* G.INP ON/OFF
* Trellis encoding ON/OFF
* Virtaul Noise ON/OFF
* Bitswap ON/OFF

Difference in size for ltq-vdsl-app = 1k
Difference in size for kmod-ltq-vdsl-vr9 < 1k

Reviewed-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Jeroen Peelaerts <jeroen.peelaerts@gmail.com>
(cherry picked from commit 48162e4c0c85a7f64d9007565bf5be2c7ace3ada)

3 years agoOpenWrt v21.02.0-rc1: revert to branch defaults
Hauke Mehrtens [Mon, 19 Apr 2021 19:10:17 +0000 (21:10 +0200)]
OpenWrt v21.02.0-rc1: revert to branch defaults

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
3 years agoOpenWrt v21.02.0-rc1: adjust config defaults v21.02.0-rc1
Hauke Mehrtens [Mon, 19 Apr 2021 19:10:14 +0000 (21:10 +0200)]
OpenWrt v21.02.0-rc1: adjust config defaults

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
3 years agorealtek: allow writing to "u-boot-env2"
Bjørn Mork [Tue, 6 Apr 2021 09:43:05 +0000 (11:43 +0200)]
realtek: allow writing to "u-boot-env2"

U-Boot uses the "bootpartition" variable stored in
"u-boot-env2" to select the active system partition. Allow
updates to enable system switching from OpenWrt.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 11d24ffe961570533a4fc54a7511d30c17290623)

3 years agorealtek: rename partitions in Netgear DTSI
Stijn Segers [Sun, 28 Feb 2021 21:50:15 +0000 (22:50 +0100)]
realtek: rename partitions in Netgear DTSI

Switch the Netgear DTSI for the Realtek target from the OEM partition
naming scheme to accepted OpenWrt naming practices. A quick git grep for
'u-boot-env' e.g. in the OpenWrt tree turns up almost 500 hits whereas
grepping for 'bdinfo' (the OEM equivalent) returns a meagre 14.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
(cherry picked from commit 1601b39b6197963e85c441a043702e022779f371)

3 years agorealtek: add ZYXEL_VERS to DEVICE_VARS
Adrian Schmutzler [Mon, 22 Mar 2021 19:58:16 +0000 (20:58 +0100)]
realtek: add ZYXEL_VERS to DEVICE_VARS

Otherwise, the last defined value will be set for all devices.

Fixes: c6c8d597e183 ("realtek: Add generic zyxel_gs1900 image definition")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 851dadc257b7223f879a3733507e83cfcaae1af1)

3 years agorealtek: enable SerDes NWAY and SGMII negotiation
Bjørn Mork [Sat, 13 Mar 2021 16:45:54 +0000 (17:45 +0100)]
realtek: enable SerDes NWAY and SGMII negotiation

This allows copper SFPs to negotiate speeds lower than 1gig.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 963b2ae702510c11e912c9438fdb9222763a22d5)

3 years agorealtek: enabled Marvell and Realtek PHYs
Bjørn Mork [Sat, 13 Mar 2021 16:45:53 +0000 (17:45 +0100)]
realtek: enabled Marvell and Realtek PHYs

The rtl83xx-phy driver is necessary for proper configuration of the
PHYs if U-Boot hasn't done that.

1000Base-T SFPs often contains a Marvell 88E1111 and will not work
without this driver. Include it by default to support copper SFPs.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 07bf5aaa4c12d6e7eb797b3871a7586f90a46e67)

3 years agorealtek: enable HWMON for SFP sensors
Bjørn Mork [Sat, 13 Mar 2021 16:45:52 +0000 (17:45 +0100)]
realtek: enable HWMON for SFP sensors

This adds SFP sensors as a hwmon device, allowing readout of
temperatures, DOM and other sensor readings available from the
SFP.  Example from a ZyXEL GS1900-10HP with a DOM capable
1000Base-SX SFP:

root@gs1900-10hp:~# grep . /sys/class/hwmon/hwmon0/*
/sys/class/hwmon/hwmon0/curr1_crit:90
/sys/class/hwmon/hwmon0/curr1_crit_alarm:0
/sys/class/hwmon/hwmon0/curr1_input:4
/sys/class/hwmon/hwmon0/curr1_label:bias
/sys/class/hwmon/hwmon0/curr1_lcrit:0
/sys/class/hwmon/hwmon0/curr1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/curr1_max:85
/sys/class/hwmon/hwmon0/curr1_max_alarm:0
/sys/class/hwmon/hwmon0/curr1_min:0
/sys/class/hwmon/hwmon0/curr1_min_alarm:0
/sys/class/hwmon/hwmon0/in0_crit:3795
/sys/class/hwmon/hwmon0/in0_crit_alarm:0
/sys/class/hwmon/hwmon0/in0_input:3317
/sys/class/hwmon/hwmon0/in0_label:VCC
/sys/class/hwmon/hwmon0/in0_lcrit:2805
/sys/class/hwmon/hwmon0/in0_lcrit_alarm:0
/sys/class/hwmon/hwmon0/in0_max:3465
/sys/class/hwmon/hwmon0/in0_max_alarm:0
/sys/class/hwmon/hwmon0/in0_min:3135
/sys/class/hwmon/hwmon0/in0_min_alarm:0
/sys/class/hwmon/hwmon0/name:sfp_p10
/sys/class/hwmon/hwmon0/power1_crit:708
/sys/class/hwmon/hwmon0/power1_crit_alarm:0
/sys/class/hwmon/hwmon0/power1_input:259
/sys/class/hwmon/hwmon0/power1_label:TX_power
/sys/class/hwmon/hwmon0/power1_lcrit:89
/sys/class/hwmon/hwmon0/power1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/power1_max:501
/sys/class/hwmon/hwmon0/power1_max_alarm:0
/sys/class/hwmon/hwmon0/power1_min:126
/sys/class/hwmon/hwmon0/power1_min_alarm:0
/sys/class/hwmon/hwmon0/power2_crit:1259
/sys/class/hwmon/hwmon0/power2_crit_alarm:0
/sys/class/hwmon/hwmon0/power2_input:404
/sys/class/hwmon/hwmon0/power2_label:RX_power
/sys/class/hwmon/hwmon0/power2_lcrit:6
/sys/class/hwmon/hwmon0/power2_lcrit_alarm:0
/sys/class/hwmon/hwmon0/power2_max:794
/sys/class/hwmon/hwmon0/power2_max_alarm:0
/sys/class/hwmon/hwmon0/power2_min:10
/sys/class/hwmon/hwmon0/power2_min_alarm:0
/sys/class/hwmon/hwmon0/temp1_crit:100000
/sys/class/hwmon/hwmon0/temp1_crit_alarm:0
/sys/class/hwmon/hwmon0/temp1_input:22547
/sys/class/hwmon/hwmon0/temp1_label:temperature
/sys/class/hwmon/hwmon0/temp1_lcrit:-50000
/sys/class/hwmon/hwmon0/temp1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/temp1_max:85000
/sys/class/hwmon/hwmon0/temp1_max_alarm:0
/sys/class/hwmon/hwmon0/temp1_min:-40000
/sys/class/hwmon/hwmon0/temp1_min_alarm:0
/sys/class/hwmon/hwmon0/uevent:OF_NAME=sfp-p10
/sys/class/hwmon/hwmon0/uevent:OF_FULLNAME=/sfp-p10
/sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_0=sff,sfp
/sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_N=1

Tested-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 2a912fb63adc3fb3a1ee746589f6df4bb02e4296)

3 years agorealtek: re-enable sfp driver for ZyXEL GS1900-10HP
Bjørn Mork [Sat, 13 Mar 2021 16:45:51 +0000 (17:45 +0100)]
realtek: re-enable sfp driver for ZyXEL GS1900-10HP

There is no need to define a static link or a phy for the sfp
ports.  Using phy-mode and managed properties to  describe the
link to the sfp phy.

We have to keep the now unconnected virtual "phys" because the
switch  driver uses their "phy-is-integrated" property to figure
out which ports to enable as fibre ports.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit e8d391bd4650418182d96ca06ccd10d636efcbc3)

3 years agorealtek: need to handle PHY_INTERFACE_MODE_NA for sfps
Bjørn Mork [Sat, 13 Mar 2021 16:45:50 +0000 (17:45 +0100)]
realtek: need to handle PHY_INTERFACE_MODE_NA for sfps

From the validate docs in include/linux/phylink.h:

 When state->interface is PHY_INTERFACE_MODE_NA, phylink expects the
 MAC driver to return all supported link modes.

Tested-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 785d830e889ba18793acf369e447d704269169af)

3 years agorealtek: fix link-state interrupt
Bjørn Mork [Sat, 13 Mar 2021 16:45:49 +0000 (17:45 +0100)]
realtek: fix link-state interrupt

This bug was the root cause for the failing sfp driver.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit b8e473d18c6af2abf0d047247fdbe6d178228ac0)

3 years agorealtek: Add ZyXEL GS1900-8
Hauke Mehrtens [Wed, 27 Jan 2021 21:16:11 +0000 (22:16 +0100)]
realtek: Add ZyXEL GS1900-8

The ZyXEL GS1900-8 is a 8 port switch without any PoE functionality or
SFP ports, but otherwise similar to the other GS1900 switches.

Specifications
--------------
* Device:    ZyXEL GS1900-8 v1.2
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L12835F 16 MiB
* RAM:       Nanya NT5TU128M8GE-AC 128 MiB DDR2 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* LEDs:      1 PWR LED (green, not configurable)
             1 SYS LED (green, configurable)
             8 ethernet port status LEDs (green, SoC controlled)
* Buttons:   1 on-off glide switch at the back (not configurable)
             1 reset button at the right side, behind the air-vent
               (not configurable)
             1 reset button on front panel (configurable)
* Power      12V 1A barrel connector
* UART:      1 serial header (JP2) with populated standard pin connector on
             the left side of the PCB, towards the back. Pins are labelled:
             + VCC (3.3V)
             + TX (really RX)
             + RX (really TX)
             + GND
             the labelling is done from the usb2serial connector's point of
             view, so RX/ TX are mixed up.

Serial connection parameters for both devices: 115200 8N1.

Installation
------------
Instructions are identical to those for the GS1900-10HP and GS1900-8HP.

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).
* Set up a TFTP server on your client and make it serve the initramfs
  image.
* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:
  > rtk network on
* Since the GS1900-10HP is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot off the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:
  > setsys bootpartition 0
  > savesys
* Download the image onto the device and boot from it:
  > tftpboot 0x84f00000 192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-8-initramfs-kernel.bin
  > bootm
* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:
  > sysupgrade /tmp/openwrt-realtek-generic-zyxel_gs1900-8-squashfs-sysupgrade.bin

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit e6ba970b6ef2289a2a4d3dd6c0c158ee8d10160f)

3 years agorealtek: Add generic zyxel_gs1900 image definition
Hauke Mehrtens [Wed, 24 Feb 2021 21:03:39 +0000 (22:03 +0100)]
realtek: Add generic zyxel_gs1900 image definition

Add a new common device definition for the Zyxel GS1900 line of
switches.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit c6c8d597e18300cd679bf5ea88a46ed18709da01)

3 years agorealtek: drop ethtool log noise
Bjørn Mork [Thu, 11 Mar 2021 12:35:38 +0000 (13:35 +0100)]
realtek: drop ethtool log noise

Demote a number of debugging printk's to pr_debug to avoid log
nosie.  Several of these functions are called as a result of
userspace activity.  This can cause a lot of log noise when
userspace does periodic polling.

Most of this could probably be removed completely, but let's
keep it for now since these drivers are still in development.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
(cherry picked from commit ba220ad2fd915aaed2e9c850a84078c5c5977d3e)

3 years agouboot-envtools: add support for ZyXEL GS-1900-8HP v1 and v2
Stijn Segers [Thu, 18 Feb 2021 23:22:26 +0000 (00:22 +0100)]
uboot-envtools: add support for ZyXEL GS-1900-8HP v1 and v2

This adds the necessary nuts and bolts for the uboot settings for both the ZyXEL GS1900-8HP v1 and v2.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
(cherry picked from commit b5bc53813d28cb4229f9800a36c1e600a239e6a9)

3 years agobase-files: fix status display command
Alexander Egorenkov [Sun, 28 Mar 2021 08:45:08 +0000 (10:45 +0200)]
base-files: fix status display command

If service() is called w/o parameter then the status display for services
with multiple instances is incorrect. E.g. samba4 or wpad have 2 instances.

root@OpenWrt:~# /etc/init.d/samba4 status
running
root@OpenWrt:~# /etc/init.d/wpad status
running

Before change:
/etc/init.d/samba4                 enabled         stopped
/etc/init.d/wpad                   enabled         stopped

After change:
/etc/init.d/samba4                 enabled         running
/etc/init.d/wpad                   enabled         running

Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
(cherry picked from commit 9318f61556c5443eb66eec7e26715b00f0df86fc)

3 years agozram-swap: bail out early if the kernel doesn't support swap
Rui Salvaterra [Thu, 1 Apr 2021 13:36:33 +0000 (14:36 +0100)]
zram-swap: bail out early if the kernel doesn't support swap

Since KERNEL_SWAP is only enabled by default for !SMALL_FLASH targets, we need
to check if the current kernel supports swap before trying to configure
zram-swap, as opkg can't check for kernel dependencies.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 565dfeb1280343fb3f838581169e5d7a1c947862)

3 years agouboot-imx6: define 'BUILD_DEVICES' for Toradex Apalis
Piotr Dymacz [Thu, 7 Jan 2021 16:30:49 +0000 (17:30 +0100)]
uboot-imx6: define 'BUILD_DEVICES' for Toradex Apalis

Without 'BUILD_DEVICES' defined, the U-Boot related package won't be
automatically selected when building for Toradex Apalis device.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
(cherry picked from commit 8c3383799a496fda5cfa31000b65c9b8565cf575)