Commit Graph

1563 Commits

Author SHA1 Message Date
Hauke Mehrtens
dced292d68 OpenWrt v23.05.5: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-09-24 00:53:40 +02:00
Hauke Mehrtens
28cf53e6bd OpenWrt v23.05.5: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-09-24 00:53:33 +02:00
Matthias Schiffer
5773538c90
base-files: fix merge of passwd/shadow/group lines with trailing colons
Empty trailing fields get lost when the lines are split and merged again
at colons, resulting in unparsable entries. Only use the split fields for
matching against the other file, but emit the original line unchanged
to fix the issue.

Fixes: de7ca7dafa ("base-files: merge /etc/passwd et al at sysupgrade config restore")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
(cherry picked from commit 9bbaa6f2c0)
2024-08-29 21:07:48 +02:00
Hauke Mehrtens
76a0c2932c OpenWrt v23.05.4: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-07-16 23:51:26 +02:00
Hauke Mehrtens
b9510660ce OpenWrt v23.05.4: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-07-16 23:51:19 +02:00
Thomas Winkler
ccac75a37f base-files: fix uid/gid auto-enumeration to avoid 16-bit limit
uid/gid range should be limited to 16bit unsigned integer range to
avoid "wraparound" issues with permissions where jffs2
is employed for storage and chown 65536 (first auto-created user)
becomes equivalent to chown 0

Fixes: #13927

Signed-off-by: Thomas Winkler <tewinkler86@gmail.com>
(cherry picked from commit 140b48a9e9)
Link: https://github.com/openwrt/openwrt/pull/15898
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-07-08 21:13:26 +02:00
Rodrigo Balerdi
9988f8adf8 base-files: minor fix to mmc_get_mac_ascii function
This is mostly a cosmetic cleanup. The absence of
the return statement was not causing any problems.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
(cherry picked from commit 8cf4ac5195)
2024-07-02 09:05:52 +02:00
Daniel Golle
4058d0e990 base-files: add mmc_get_mac_ascii function
Similar to the *_get_mac_binary function, also split the common parts
off mtd_get_mac_ascii into new get_mac_ascii function and introduce
mmc_get_mac_ascii which uses it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 45c85c1827)
2024-07-02 09:05:52 +02:00
Hauke Mehrtens
2b61e258b4 OpenWrt v23.05.3: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-03-22 23:26:12 +01:00
Hauke Mehrtens
01170d518d OpenWrt v23.05.3: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-03-22 23:26:03 +01:00
Rafał Miłecki
6b7c4739c4 base-files: execute package's "postinst" after executing uci-defaults
Allow "postinst" scripts to perform extra actions after applying all
kind of fixups implemented using uci-defaults.

This is needed e.g. by uhttpd-mod-ubus which after installation in a
running systems needs to:
1. Update uhttpd config using its uci-defaults script
2. Reload uhttpd

While this approach makes sense there is a risk it'll blow up some
corner case postinst usages. There is only 1 way to find out.

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit b799dd3c70)
2024-01-27 10:36:43 +01:00
Shiji Yang
7606dac661 base-files: support parse DT LED color and function
The 'label' property in led node has been deprecated and we'd better
to avoid using it. This patch allows us to extract DT OF LED name
from the newly introduced LED properties "color", "function" and
"function-enumerator".

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
(cherry picked from commit e814acc599)
2023-12-06 22:13:25 +01:00
Hauke Mehrtens
6cb1cb1b13 OpenWrt v23.05.2: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-11-15 00:00:58 +01:00
Hauke Mehrtens
1c26bcb108 OpenWrt v23.05.2: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-11-15 00:00:53 +01:00
Hauke Mehrtens
ce62c25c08 OpenWrt v23.05.1: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-11-12 21:21:21 +01:00
Hauke Mehrtens
a58a86693f OpenWrt v23.05.1: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-11-12 21:20:49 +01:00
Michael 'ASAP' Weinrich
0da199f60c
base-files: fix wrong ucidef_set_network_device_mac network-device entry
The ucidef_set_network_device_* functions in uci-defaults.sh disagree
on whether to use "network-device" or "network_device" in board.json.
With the additional caveat that jshn will translate hyphens (-) into
underscores (_). This casues problems in netifd which expected
"network_device" causing boards which depend on assigning MACs in
board.json via uci-defaults.sh (or jshn in general) to fail.

This commit addresses the issue by using network_device in
uci-defaults.sh.

The bug was uncovered in the forums here:
https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/2596

This was exposed by commit 4ebba8a05d ("realtek: add support for HPE
1920-8g-poe+") where the board_config_load call from 03_gpio introduced
the key normalization by jshn.

Fixes: 9290539ca9 ("base-files: allow setting device and bridge macs")
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Michael 'ASAP' Weinrich <michael@a5ap.net>
[ improve commit title, description and fix wrong Tested-by tag ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
(cherry picked from commit 12bc79d6d5)
2023-10-20 13:09:47 +02:00
Hauke Mehrtens
86e852bcd0 OpenWrt v23.05.0: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-10-11 23:06:34 +02:00
Hauke Mehrtens
bd4f415efa OpenWrt v23.05.0: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-10-11 23:06:24 +02:00
Hauke Mehrtens
b742216dc8 OpenWrt v23.05.0-rc4: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-09-29 20:28:43 +02:00
Hauke Mehrtens
50690dd5cc OpenWrt v23.05.0-rc4: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-09-29 20:28:35 +02:00
Leon M. Busch-George
83bf45ea5c
package: base-files: turn error into warning
Some users have their routers configured to supply a DHCP range that
includes the local interface address.
That worked with dnsmasq because it automatically skips the local
address.

Re-enable those existing configurations for the release and hint at
possible future problems.

Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
[ wrap commit description and remove unecessary text ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-19 15:38:59 +02:00
Hannu Nyman
6577b550df
base-files: sysupgrade: Add 2 sec sleep into process KILL loop
Add 2 seconds sleep after each forcibly killed/tried-to-kill process
in the final process termination loop in sysupgrade stage2.

This is needed especially for qualcommax/ipq807x, where ath11k
wireless driver may have a long 10-20 seconds delay after termination
before actually getting killed. This often breaks sysupgrade.

The current KILL loop in kill_remaining does all 10 kill attempts
consecutively without any delay, as evidenced here in a failing sysupgrade.
It does not allow any time for the process to finalize its internal
termination.

Sat Sep  2 19:05:56 EEST 2023 upgrade: Sending TERM to remaining processes ...
Sat Sep  2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2122)
Sat Sep  2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending KILL to remaining processes ...
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2122)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138)
Sat Sep  2 19:06:00 EEST 2023 upgrade: Failed to kill all processes.
sysupgrade aborted with return code: 256

The change in this commit adds a 2 seconds delay after each kill attempt
in order to allow some processes to more gracefully handle their
internal termination.

The result is like this:

Sun Sep  3 11:15:10 EEST 2023 upgrade: Sending TERM to remaining processes ...
Sun Sep  3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2309)
Sun Sep  3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2324)
Sun Sep  3 11:15:14 EEST 2023 upgrade: Sending KILL to remaining processes ...
Sun Sep  3 11:15:14 EEST 2023 upgrade: Sending signal KILL to hostapd (2309)
[  699.827521] br-lan: port 7(hn5wpa2r) entered disabled state
[  699.908673] device hn5wpa2r left promiscuous mode
[  699.908721] br-lan: port 7(hn5wpa2r) entered disabled state
[  701.038029] br-lan: port 6(hn5wpa3) entered disabled state
Sun Sep  3 11:15:16 EEST 2023 upgrade: Sending signal KILL to hostapd (2324)
[  702.058256] br-lan: port 5(hn2wlan) entered disabled state
[  709.250063] stage2 (8237): drop_caches: 3
Sun Sep  3 11:15:25 EEST 2023 upgrade: Switching to ramdisk...

The delay introduced here only kicks in if there is some process that
does not get terminated by the first TERM call. Then there is at least
one 2 sec wait after the first KILL loop round.

This commit is related to discussion in PRs #12235 and #12632

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Reviewed-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit 47d56ae546)
2023-09-12 14:53:40 +02:00
Hauke Mehrtens
b055769a48 OpenWrt v23.05.0-rc3: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-08-20 21:50:26 +02:00
Hauke Mehrtens
94cd25cb69 OpenWrt v23.05.0-rc3: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-08-20 21:50:15 +02:00
Hauke Mehrtens
123afce696 OpenWrt v23.05.0-rc2: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-06-28 00:08:33 +02:00
Hauke Mehrtens
55ae516f61 OpenWrt v23.05.0-rc2: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-06-28 00:08:24 +02:00
Álvaro Fernández Rojas
25f6252620 base-files: upgrade: nand: add JFFS2 cleanmarkers support
Some Broadcom MIPS devices require JFFS2 cleanmarkers to be present on the
kernel partition or the bootloader will identify the partition as corrupt and
won't boot the kernel.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry picked from commit 434df8df54)
2023-06-15 11:48:45 +02:00
Tony Ambardar
081dfcfb0f base-files: enable BPF JIT kallsyms by default
Set net.core.bpf_jit_kallsyms=1 in /etc/sysctl.d/10-default.conf.

For privileged users, this exports addresses of JIT-compiled programs to
appear in /proc/kallsyms when present, allowing their use for debugging
and in traces.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
(cherry picked from commit b3aaede2a7)
2023-06-09 13:20:05 +02:00
Hauke Mehrtens
5db2d6d009 OpenWrt v23.05.0-rc1: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-06-07 01:06:59 +02:00
Hauke Mehrtens
f29f876bfa OpenWrt v23.05.0-rc1: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-06-07 01:06:48 +02:00
Christian Marangi
8192380288
OpenWrt v23.05: set branch defaults
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-21 15:30:04 +02:00
Arınç ÜNAL
10a29216ce base-files: add protocol ncm support for ucidef_set_interface()
Make it possible to set up a default network (interface) for devices with
cellular modems using NCM.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2023-05-18 14:44:07 +02:00
Olliver Schinagl
3da70c6469 base-files: Do not break on non-eth ports
When using OpenWRT with DSA and 'lan' ports, we could get an empty
`next_eth`. This is of course not desirable, as this causes `sh: out of
range` errors when trying to determine which one would be greater.

It turns out, that we don't even need this check at all because, when
looking for all existin eth*s on a system, and take the highest index
and then iterate a set of devices and rename to eth${highest_index+n},
it is guaranteed that there will be no conflict.

Fixes: b688bf83f9 ("base-files: rename ethernet devs on known boards")
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2023-05-09 22:54:38 +02:00
Andre Heider
28e357d528
base-files: add 'isup' to the wifi script
This is a silent command that allows easy wifi up/down automation for
scripts.

It takes one or multiple devices as arguments (or all if none are passed),
and the exit code indicates if any of those is not up.

E.g.:
wifi isup && echo "all wifi devices are up"
wifi isup radio0 || echo "this wifi is down"

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-04-12 19:49:30 +02:00
Andre Heider
8fbe7738b9
base-files: use named variables in the wifi script
Use the already present but unused $cmd and $dev variables instead of
positional parameters in ubus_wifi_cmd() to improve readability.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-04-12 19:49:22 +02:00
Rafał Miłecki
c798adad6b base-files: fix nand_upgrade_ubinized()
When using "ubiformat" with stdin it requires passing image size using
the -S argument. Provide it just like we do for "ubiupdatevol".

This fixes:
ubiformat: error!: must use '-S' with non-zero value when reading from stdin

This change fixes sysupgrade for bcm53xx and bcm4908 NAND devices
possibly some other targets too.

Cc: Rodrigo Balerdi <lanchon@gmail.com>
Cc: Daniel Golle <daniel@makrotopia.org>
Fixes: 9710712120 ("base-files: accept gzipped nand sysupgrade images")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
2023-04-11 13:42:47 +01:00
Mark Baker
f35e2422b8 base-files: add support for retrieving IPv6 assignments
In DHCPv6-PD enabled environments, addresses are assigned to interfaces.
These new functions retrieve the IPv6 assigned prefix(es).

Signed-off-by: Mark Baker <mark@vpost.net>
2023-02-24 23:56:36 +01:00
Yuan Tao
fa08d900d4 base-files: sysfixtime: Fix time on the fake RTC
On some devices the chip has RTC but no battery save time.
This leads back to getting the wrong time
and skipping the check of the last file modification date.

This commit ensures that the file time is checked even
if the RTC exists.
which would ordinarily return an approbiate
system time used for e.g. certificate generation.

Tested-on: NanoPi R2S

Signed-off-by: Yuan Tao <ty@wevs.org>
2023-02-19 20:04:59 +08:00
Stijn Tintel
baf76634f3 build: add option to use preinit IP as LAN IP
We currently have build options to customize the IP address used in the
preinit phase of the boot process, but not to set the default LAN IP.

Introduce a boolean build option that, when enabled, results in the IP
address configured for the preinit phase, to be also used as the default
LAN IP address.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2023-02-17 16:20:03 +02:00
Daniel Golle
e8625c89ef treewide: replace /sys/devices/virtual/ubi by /sys/class/ubi
Starting from Linux Kernel version 6.3 UBI devices will no longer be
considered virtual, but rather have an MTD device parent. Hence they
will no longer be listed under /sys/devices/virtual/ubi which is
used in multiple places in OpenWrt. Prepare for future kernels by
using /sys/class/ubi instead of /sys/devuces/virtual/ubi.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-15 03:27:59 +00:00
Leon M. George
67d2a7ef9e
base-files: ipcalc.sh: fix awk regex syntax
It worked fine before but gawk warns about it.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:58 +01:00
Leon M. George
2903924b57
base-files: ipcalc.sh: trim for statement
For gawk compatibility.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:57 +01:00
Leon M. George
6ce9f42b98
base-files: ipcalc.sh: use shebang to invoke awk
There's hardly an shell logic in ipcalc.sh and a $* that would garble
parameter positions.
Move the awk invokation to the shebang.

A rename from "ipcalc.sh" to "ipcalc" is desirable but could prove tricky
with packages in other repositories depending on the filename.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:57 +01:00
Leon M. George
a40a96e54b
base-files: ipcalc.sh: fail when network is too small
It's possible to move range boundaries in a way that the start address
lies behind the end address.
Detect this condition and exit with an error message.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:56 +01:00
Leon M. George
4fe106afd1
base-files: ipcalc.sh: don't include own address in range
Make sure our own address doesn't lie in the calculated range.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:56 +01:00
Leon M. George
00a20335ba
base-files: ipcalc.sh: check for params before calculating start/end
With this patch, ipcalc only calculates range boundaries if the
corresponding parameters are supplied.

Signed-off-by: Leon M. George <leon@georgemail.eu>
2023-02-07 21:05:52 +01:00
Brian Norris
3cd882744d base-files: upgrade: Fix export_partdevice() quoting
$BOOTDEV_MAJOR may be empty for many of the uevents parsed in this
function. This condition thus tends to fail benignly (we just skip to
the next device), but it can really clutter the stage2 sysupgrade
stderr, since it looks like the "=" operand doesn't have an appropriate
left-hand argument.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2023-02-03 14:09:46 +01:00
Chen Minqiang
781a3ae5dc base-files: fix nand_do_platform_check fail
This change ensures compatibility with both types of sysupgrade-tar files.

1. For some boards like xiaomi,redmi-router-ax6s, sysupgrade-tar
   is pack in directory `vendor,name/`

2. For some boards like xiaomi,mi-router-3g, sysupgrade-tar is pack
   in directory `vendor_name/`

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2023-01-29 01:02:45 +00:00
Brian Norris
d3c19c71f6
base-files: Remove nand.sh dependency from emmc upgrade
emmc_do_upgrade() relies on identify() from the nand.sh upgrade helper.
This only works because FEATURES=emmc targets also tend to include
FEATURES=nand.

Rename identify_magic() to identify_magic_long() to match the common.sh
style and make it clear it pairs with other *_long() variants (and not,
say *_word()).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2023-01-21 01:02:23 +01:00