Skip to content

Commit

Permalink
Merge pull request #13 from openwrt/main
Browse files Browse the repository at this point in the history
Sync main branch with upstream openwrt/openwrt@main
  • Loading branch information
N-Storm authored Oct 2, 2024
2 parents 6bbcdaa + 859bb4d commit 2a62ce5
Show file tree
Hide file tree
Showing 38 changed files with 587 additions and 147 deletions.
4 changes: 2 additions & 2 deletions include/kernel-6.6
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-6.6 = .52
LINUX_KERNEL_HASH-6.6.52 = 1591ab348399d4aa53121158525056a69c8cf0fe0e90935b0095e9a58e37b4b8
LINUX_VERSION-6.6 = .53
LINUX_KERNEL_HASH-6.6.53 = 285d181d1b252b0bf905f040d094215cf183ac98c31a17f9cce9f3537ef4d779
5 changes: 5 additions & 0 deletions package/base-files/files/bin/config_generate
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ generate_static_system() {
uci -q set "system.@system[-1].compat_version=1.0"
fi

local timezone
if json_get_var timezone timezone; then
uci -q set "system.@system[-1].timezone=$timezone"
fi

if json_is_a ntpserver array; then
local keys key
json_get_keys keys ntpserver
Expand Down
3 changes: 2 additions & 1 deletion package/base-files/files/etc/init.d/boot
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ uci_apply_defaults() {
cd /etc/uci-defaults || return 0
files="$(ls)"
[ -z "$files" ] && return 0
mkdir -p /tmp/.uci
for file in $files; do
( . "./$(basename $file)" ) && rm -f "$file"
done
Expand Down Expand Up @@ -47,6 +46,8 @@ boot() {
sleep 1
}

mkdir -p /tmp/.uci
[ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
/bin/config_generate
rm -f /tmp/.config_pending
/sbin/wifi config
Expand Down
12 changes: 12 additions & 0 deletions package/base-files/files/etc/uci-defaults/50-root-passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
. /usr/share/libubox/jshn.sh

json_init
json_load "$(cat /etc/board.json)"

json_select credentials
json_get_vars root_password_hash root_password_hash
[ -z "$root_password_hash" ] || sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow

json_get_vars root_password_plain root_password_plain
[ -z "$root_password_plain" ] || { (echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root }
json_select ..
86 changes: 86 additions & 0 deletions package/base-files/files/lib/functions/uci-defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,92 @@ ucidef_set_hostname() {
json_select ..
}

ucidef_set_timezone() {
local timezone="$1"
json_select_object system
json_add_string timezone "$timezone"
json_select ..
}

ucidef_set_wireless() {
local band="$1"
local ssid="$2"
local encryption="$3"
local key="$4"

case "$band" in
all|2g|5g|6g) ;;
*) return;;
esac
[ -z "$ssid" ] && return

json_select_object wlan
json_select_object defaults
json_select_object ssids
json_select_object "$band"
json_add_string ssid "$ssid"
[ -n "$encryption" ] && json_add_string encryption "$encryption"
[ -n "$key" ] && json_add_string key "$key"
json_select ..
json_select ..
json_select ..
json_select ..
}

ucidef_set_country() {
local country="$1"

json_select_object wlan
json_select_object defaults
json_add_string country "$country"
json_select ..
json_select ..
}

ucidef_set_wireless_mac_count() {
local band="$1"
local mac_count="$2"

case "$band" in
2g|5g|6g) ;;
*) return;;
esac
[ -z "$mac_count" ] && return

json_select_object wlan
json_select_object defaults
json_select_object ssids
json_select_object "$band"
json_add_string mac_count "$mac_count"
json_select ..
json_select ..
json_select ..
json_select ..
}

ucidef_set_root_password_plain() {
local passwd="$1"
json_select_object credentials
json_add_string root_password_plain "$passwd"
json_select ..
}

ucidef_set_root_password_hash() {
local passwd="$1"
json_select_object credentials
json_add_string root_password_hash "$passwd"
json_select ..
}

ucidef_set_ssh_authorized_key() {
local ssh_key="$1"
json_select_object credentials
json_select_array ssh_authorized_keys
json_add_string "" "$ssh_key"
json_select ..
json_select ..
}

ucidef_set_ntpserver() {
local server

Expand Down
3 changes: 3 additions & 0 deletions package/boot/uboot-envtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ define Package/uboot-envtools/install
$(LN) fw_printenv $(1)/usr/sbin/fw_setenv
$(INSTALL_BIN) ./files/fw_printsys $(1)/usr/sbin
$(INSTALL_BIN) ./files/fw_setsys $(1)/usr/sbin
$(INSTALL_BIN) ./files/fw_loadenv $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/board.d
$(INSTALL_DATA) ./files/fw_defaults $(1)/etc/board.d/05_fw_defaults
$(INSTALL_DIR) $(1)/lib
$(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib
$(INSTALL_DIR) $(1)/etc/uci-defaults
Expand Down
17 changes: 17 additions & 0 deletions package/boot/uboot-envtools/files/fw_defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
. /lib/functions/uci-defaults.sh

fw_loadenv

board_config_update

[ -f /var/run/uboot-env/owrt_ssid -a -f /var/run/uboot-env/owrt_wifi_key ] &&
ucidef_set_wireless all "$(cat /var/run/uboot-env/owrt_ssid)" sae-mixed "$(cat /var/run/uboot-env/owrt_wifi_key)"
[ -f /var/run/uboot-env/owrt_country ] && ucidef_set_country "$(cat /var/run/uboot-env/owrt_country)"
[ -f /var/run/uboot-env/owrt_ssh_auth_key ] && ucidef_set_ssh_authorized_key "$(cat /var/run/uboot-env/owrt_ssh_auth_key)"
[ -f /var/run/uboot-env/owrt_root_password_plain ] && ucidef_set_root_password_plain "$(cat /var/run/uboot-env/owrt_root_password_plain)"
[ -f /var/run/uboot-env/owrt_root_password_hash ] && ucidef_set_root_password_hash "$(cat /var/run/uboot-env/owrt_root_password_hash)"
[ -f /var/run/uboot-env/owrt_timezone ] && ucidef_set_timezone "$(cat /var/run/uboot-env/owrt_timezone)"

board_config_flush

exit 0
26 changes: 26 additions & 0 deletions package/boot/uboot-envtools/files/fw_loadenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/ucode

'use strict';

const path = '/var/run/uboot-env/';

import * as fs from 'fs';

if (fs.lsdir(path)) {
warn(`env has already been loaded to ${path}\n`);
exit(0);
}

let fp = fs.popen('fw_printenv');
let raw = fp.read('all');
fp.close();

if (!length(raw))
exit(0);

fs.mkdir(path);
for (let line in split(raw, '\n')) {
let vals = split(line, '=');
if (vals[0] && vals[1])
fs.writefile(path + vals[0], vals[1]);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 2 Oct 2024 11:45:35 +0200
Subject: [PATCH] wifi: mac80211: do not pass a stopped vif to the driver in
.get_txpower

Avoid potentially crashing in the driver because of uninitialized private data

Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3134,7 +3134,8 @@ static int ieee80211_get_tx_power(struct
struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);

- if (local->ops->get_txpower)
+ if (local->ops->get_txpower &&
+ (sdata->flags & IEEE80211_SDATA_IN_DRIVER))
return drv_get_txpower(local, sdata, dbm);

if (local->emulate_chanctx)
3 changes: 2 additions & 1 deletion package/kernel/mt76/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ endef
define KernelPackage/mt7996e
$(KernelPackage/mt76-default)
TITLE:=MediaTek MT7996E wireless driver
DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY
DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +@DRIVER_11AX_SUPPORT \
+@KERNEL_RELAY +@DRIVER_11BE_SUPPORT
FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko
AUTOLOAD:=$(call AutoProbe,mt7996e)
endef
Expand Down
Loading

0 comments on commit 2a62ce5

Please sign in to comment.