Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-12-04 23:43:06 +08:00
commit 8d9a896b81
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
10 changed files with 40 additions and 213 deletions

View File

@ -37,7 +37,7 @@ define FeedSourcesAppendOPKG
echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo 'src/gz %d_base %U/packages/%A/base'; \
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
$(if $(CONFIG_BUILDBOT), \
echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
@ -51,7 +51,7 @@ define FeedSourcesAppendAPK
echo '%U/targets/%S/packages/packages.adb'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo '%U/packages/%A/base/packages.adb'; \
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
$(if $(CONFIG_BUILDBOT), \
echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \

View File

@ -391,8 +391,8 @@ define Build/fit
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new
$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new)
@mv $@.new $@
endef

View File

@ -210,6 +210,9 @@ function setup() {
}
data.phy_suffix = phy_suffix(data.config.radio, ":");
data.vif_phy_suffix = phy_suffix(data.config.radio, ".");
data.ifname_prefix = data.config.ifname_prefix;
if (!data.ifname_prefix)
data.ifname_prefix = data.phy + data.vif_phy_suffix + "-";
let active_ifnames = [];
log('Starting');
@ -229,12 +232,12 @@ function setup() {
let mode_idx = idx[mode]++;
if (!v.config.ifname)
v.config.ifname = data.phy + data.vif_phy_suffix + "-" + mode + mode_idx;
v.config.ifname = data.ifname_prefix + mode + mode_idx;
push(active_ifnames, v.config.ifname);
if (v.config.encryption == 'owe' && v.config.owe_transition) {
mode_idx = idx[mode]++;
v.config.owe_transition_ifname = data.phy + data.vif_phy_suffix + "-" + mode + mode_idx;
v.config.owe_transition_ifname = data.ifname_prefix + mode + mode_idx;
push(active_ifnames, v.config.ifname);
}

View File

@ -396,6 +396,10 @@
"type": "alias",
"default": "assoc_sa_query_retry_timeout"
},
"ifname_prefix": {
"description": "Default ifname prefix for this radio",
"type": "string"
},
"iface_max_num_sta": {
"description": "Limits the maximum allowed number of associated clients",
"type": "number"

View File

@ -58,7 +58,7 @@ function get_hardware_id(iface) {
};
let path = `/sys/class/ieee80211/phy${iface.wiphy}/device/`;
if (stat(path) + 'vendor') {
if (stat(path + 'vendor')) {
let data = [];
for (let lookup in [ 'vendor', 'device', 'subsystem_vendor', 'subsystem_device' ])
push(data, trim(readfile(path + lookup), '\n'));
@ -162,16 +162,11 @@ function format_band(freq) {
}
function format_frequency(freq) {
if (!freq)
return 'unknown';
freq = '' + freq;
return substr(freq, 0, 1) + '.' + substr(freq, 1);
return freq ? sprintf('%.03f', freq / 1000.0) : 'unknown';
}
function format_rate(rate) {
if (!rate)
return 'unknown';
return '' + (rate / 10) + '.' + (rate % 10);
return rate ? sprintf('%.01f', rate / 10.0) : 'unknown';
}
function format_mgmt_key(key) {
@ -269,7 +264,7 @@ function dbm2mw(dbm) {
for (let k = 0; k < ip; k++)
res *= 10;
for (let k = 0; k < fp; k++)
res *= 1.25892541179;
res *= LOG10_MAGIC;
return int(res);
}
@ -554,23 +549,23 @@ export function scan(dev) {
case 48:
cell.crypto = {
group: rsn_cipher[+ord(ie.data, 5)] ?? '',
group: rsn_cipher[ord(ie.data, 5)] ?? '',
pair: [],
key_mgmt: [],
};
let offset = 6;
let count = +ord(ie.data, offset);
let count = ord(ie.data, offset);
offset += 2;
for (let i = 0; i < count; i++) {
let key = rsn_cipher[+ord(ie.data, offset + 3)];
let key = rsn_cipher[ord(ie.data, offset + 3)];
if (key)
push(cell.crypto.pair, key);
offset += 4;
}
count = +ord(ie.data, offset);
count = ord(ie.data, offset);
offset += 2;
for (let i = 0; i < count; i++) {

View File

@ -1,6 +1,7 @@
'use strict';
import * as libuci from 'uci';
import { md5 } from 'digest';
import * as fs from 'fs';
import { append, append_raw, append_value, append_vars, comment, push_config, set_default, touch_file } from 'wifi.common';
@ -140,10 +141,10 @@ function iface_auth_type(config) {
config.vlan_possible = 1;
if (config.fils) {
set_default(config, 'erp_domain', substr(digest.md5(config.ssid), 0, 4));
set_default(config, 'erp_domain', substr(md5(config.ssid), 0, 4));
set_default(config, 'fils_realm', config.erp_domain);
set_default(config, 'erp_send_reauth_start', 1);
set_default(config, 'fils_cache_id', substr(digest.md5(config.fils_realm), 0, 4));
set_default(config, 'fils_cache_id', substr(md5(config.fils_realm), 0, 4));
}
if (!config.eap_server) {
@ -329,7 +330,7 @@ function iface_roaming(config) {
if (!config.ieee80211r || config.wpa < 2)
return;
set_default(config, 'mobility_domain', substr(digest.md5(config.ssid), 0, 4));
set_default(config, 'mobility_domain', substr(md5(config.ssid), 0, 4));
set_default(config, 'ft_psk_generate_local', config.auth_type == 'psk');
set_default(config, 'ft_iface', config.network_ifname);
@ -338,7 +339,7 @@ function iface_roaming(config) {
if (!config.auth_secret && !config.key)
netifd.setup_failed('FT_KEY_CANT_BE_DERIVED');
let ft_key = digest.md5(`${mobility_domain}/${auth_secret ?? key}`);
let ft_key = md5(`${mobility_domain}/${auth_secret ?? key}`);
set_default(config, 'r0kh', 'ff:ff:ff:ff:ff:ff,*,' + ft_key);
set_default(config, 'r1kh', '00:00:00:00:00:00,00:00:00:00:00:00,' + ft_key);

View File

@ -333,7 +333,7 @@ function device_htmode_append(config) {
config.vht_capab += rx_stbc[min(config.rx_stbc, (vht_capab >> 8) & 7)];
if (vht_capab & 0x800 && config.su_beamformer)
config.vht_capab += '[SOUNDING-DIMENSION' + min(((vht_capab >> 16) & 3) + 1, config.beamformer_antennas) + ']';
config.vht_capab += '[SOUNDING-DIMENSION-' + min(((vht_capab >> 16) & 3) + 1, config.beamformer_antennas) + ']';
if (vht_capab & 0x1000 && config.su_beamformee)
config.vht_capab += '[BF-ANTENNA-' + min(((vht_capab >> 13) & 3) + 1, config.beamformer_antennas) + ']';

View File

@ -29,6 +29,7 @@ drv_mac80211_init_device_config() {
config_add_string path phy 'macaddr:macaddr'
config_add_string tx_burst
config_add_string distance
config_add_string ifname_prefix
config_add_int radio beacon_int chanbw frag rts
config_add_int rxantenna txantenna txpower min_tx_power
config_add_int num_global_macaddr multiple_bssid
@ -660,9 +661,9 @@ mac80211_check_ap() {
}
mac80211_set_ifname() {
local phy="$1"
local prefix="$2"
eval "ifname=\"$phy-$prefix\${idx_$prefix:-0}\"; idx_$prefix=\$((\${idx_$prefix:-0 } + 1))"
local prefix="$1"
local type="$2"
eval "ifname=\"$prefix$type\${idx_$type:-0}\"; idx_$type=\$((\${idx_$type:-0 } + 1))"
}
mac80211_prepare_vif() {
@ -679,7 +680,7 @@ mac80211_prepare_vif() {
monitor) prefix=mon;;
esac
mac80211_set_ifname "$phy$vif_phy_suffix" "$prefix"
mac80211_set_ifname "$ifname_prefix" "$prefix"
}
append active_ifnames "$ifname"
@ -1105,7 +1106,8 @@ drv_mac80211_setup() {
txpower \
rxantenna txantenna \
frag rts beacon_int:100 htmode \
num_global_macaddr:1 multiple_bssid
num_global_macaddr:1 multiple_bssid \
ifname_prefix
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
json_select ..
@ -1124,6 +1126,8 @@ drv_mac80211_setup() {
return 1
}
set_default ifname_prefix "$phy$vif_phy_suffix-"
local wdev
local cwdev
local found

View File

@ -37,135 +37,22 @@ wifi_isup() {
return 0
}
find_net_config() {(
local vif="$1"
local cfg
local ifname
config_get cfg "$vif" network
[ -z "$cfg" ] && {
include /lib/network
scan_interfaces
config_get ifname "$vif" ifname
cfg="$(find_config "$ifname")"
}
[ -z "$cfg" ] && return 0
echo "$cfg"
)}
bridge_interface() {(
local cfg="$1"
[ -z "$cfg" ] && return 0
include /lib/network
scan_interfaces
for cfg in $cfg; do
config_get iftype "$cfg" type
[ "$iftype" = bridge ] && config_get "$cfg" ifname
prepare_interface_bridge "$cfg"
return $?
done
)}
prepare_key_wep() {
local key="$1"
local hex=1
echo -n "$key" | grep -qE "[^a-fA-F0-9]" && hex=0
[ "${#key}" -eq 10 -a $hex -eq 1 ] || \
[ "${#key}" -eq 26 -a $hex -eq 1 ] || {
[ "${key:0:2}" = "s:" ] && key="${key#s:}"
key="$(echo -n "$key" | hexdump -ve '1/1 "%02x" ""')"
}
echo "$key"
}
wifi_fixup_hwmode() {
local device="$1"
local default="$2"
local hwmode hwmode_11n
config_get channel "$device" channel
config_get hwmode "$device" hwmode
case "$hwmode" in
11bg) hwmode=bg;;
11a) hwmode=a;;
11ad) hwmode=ad;;
11b) hwmode=b;;
11g) hwmode=g;;
11n*)
hwmode_11n="${hwmode##11n}"
case "$hwmode_11n" in
a|g) ;;
default) hwmode_11n="$default"
esac
config_set "$device" hwmode_11n "$hwmode_11n"
;;
*)
hwmode=
if [ "${channel:-0}" -gt 0 ]; then
if [ "${channel:-0}" -gt 14 ]; then
hwmode=a
else
hwmode=g
fi
else
hwmode="$default"
fi
;;
esac
config_set "$device" hwmode "$hwmode"
}
_wifi_updown() {
for device in ${2:-$DEVICES}; do (
config_get disabled "$device" disabled
[ "$disabled" = "1" ] && {
echo "'$device' is disabled"
set disable
}
config_get iftype "$device" type
if eval "type ${1}_$iftype" 2>/dev/null >/dev/null; then
eval "scan_$iftype '$device'"
eval "${1}_$iftype '$device'" || echo "$device($iftype): ${1} failed"
elif [ ! -f /lib/netifd/wireless/$iftype.sh ]; then
echo "$device($iftype): Interface type not supported"
fi
); done
}
wifi_updown() {
cmd=down
[ enable = "$1" ] && {
_wifi_updown disable "$2"
ubus_wifi_cmd "$cmd" "$2"
ubus call network reload
scan_wifi
cmd=up
}
[ reconf = "$1" ] && {
ubus call network reload
scan_wifi
cmd=reconf
}
ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@"
}
wifi_reload_legacy() {
_wifi_updown "disable" "$1"
scan_wifi
_wifi_updown "enable" "$1"
}
wifi_reload() {
ubus call network reload
wifi_reload_legacy
}
wifi_detect_notice() {
@ -189,75 +76,9 @@ wifi_config() {
); done
}
start_net() {(
local iface="$1"
local config="$2"
local vifmac="$3"
[ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
[ -z "$config" ] || {
include /lib/network
scan_interfaces
for config in $config; do
setup_interface "$iface" "$config" "" "$vifmac"
done
}
)}
set_wifi_up() {
local cfg="$1"
local ifname="$2"
uci_set_state wireless "$cfg" up 1
uci_set_state wireless "$cfg" ifname "$ifname"
}
set_wifi_down() {
local cfg="$1"
local vifs vif vifstr
[ -f "/var/run/wifi-${cfg}.pid" ] &&
kill "$(cat "/var/run/wifi-${cfg}.pid")" 2>/dev/null
uci_revert_state wireless "$cfg"
config_get vifs "$cfg" vifs
for vif in $vifs; do
uci_revert_state wireless "$vif"
done
}
scan_wifi() {
local cfgfile="$1"
DEVICES=
config_cb() {
local type="$1"
local section="$2"
# section start
case "$type" in
wifi-device)
append DEVICES "$section"
config_set "$section" vifs ""
config_set "$section" ht_capab ""
;;
esac
# section end
config_get TYPE "$CONFIG_SECTION" TYPE
case "$TYPE" in
wifi-iface)
config_get device "$CONFIG_SECTION" device
config_get vifs "$device" vifs
append vifs "$CONFIG_SECTION"
config_set "$device" vifs "$vifs"
;;
esac
}
config_load "${cfgfile:-wireless}"
}
DEVICES=
DRIVERS=
include /lib/wifi
scan_wifi
case "$1" in
down) wifi_updown "disable" "$2";;
@ -266,7 +87,6 @@ case "$1" in
status) ubus_wifi_cmd "status" "$2";;
isup) wifi_isup "$2"; exit $?;;
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
reconf) wifi_updown "reconf" "$2";;
''|up) wifi_updown "enable" "$2";;

View File

@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=apk
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2024-11-13
PKG_SOURCE_VERSION:=e3464d096708b270138653ef93db59134bb24813
PKG_MIRROR_HASH:=cc633e5c294c9d92391fba5537dfe2f12f82011b55d282beb0d5d7ceba212962
PKG_SOURCE_DATE:=2024-11-30
PKG_SOURCE_VERSION:=8d93a79fb8958607f097be2c4ac97f4596faf91d
PKG_MIRROR_HASH:=565c87fac26e696c362c2fe85159cc3ed2fd27153f244c2e9dc0fd7fa67a4173
PKG_VERSION=3.0.0_pre$(subst -,,$(PKG_SOURCE_DATE))