Merge remote-tracking branch 'remotes/remote/openwrt-24.10' into openwrt-24.10
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled

This commit is contained in:
Nanako 2025-03-09 14:49:04 +08:00
commit 795e78f4c2
5 changed files with 109 additions and 39 deletions

View File

@ -23,7 +23,7 @@ hostapd_ucode_bss_get_uval(struct hostapd_data *hapd)
uc_value_t *val;
if (hapd->ucode.idx)
return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx);
return ucv_get(wpa_ucode_registry_get(bss_registry, hapd->ucode.idx));
val = uc_resource_new(bss_type, hapd);
hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val);
@ -37,7 +37,7 @@ hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd)
uc_value_t *val;
if (hapd->ucode.idx)
return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx);
return ucv_get(wpa_ucode_registry_get(iface_registry, hapd->ucode.idx));
val = uc_resource_new(iface_type, hapd);
hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
@ -54,12 +54,11 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u
list = ucv_array_new(vm);
for (i = 0; iface->bss && i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
uc_value_t *val = hostapd_ucode_bss_get_uval(hapd);
ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface)));
ucv_object_add(bss, hapd->conf->iface, ucv_get(val));
ucv_array_set(list, i, ucv_string_new(hapd->conf->iface));
ucv_object_add(bss, hapd->conf->iface, hostapd_ucode_bss_get_uval(hapd));
}
ucv_object_add(if_bss, iface->phy, ucv_get(list));
ucv_object_add(if_bss, iface->phy, list);
}
static void
@ -73,13 +72,14 @@ hostapd_ucode_update_interfaces(void)
for (i = 0; i < interfaces->count; i++) {
struct hostapd_iface *iface = interfaces->iface[i];
ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface)));
ucv_object_add(ifs, iface->phy, hostapd_ucode_iface_get_uval(iface));
hostapd_ucode_update_bss_list(iface, if_bss, bss);
}
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs));
ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss));
ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss));
ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
ucv_object_add(ucv_prototype_get(global), "interface_bss", if_bss);
ucv_object_add(ucv_prototype_get(global), "bss", bss);
ucv_gc(vm);
}
@ -362,6 +362,10 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs)
hapd->driver = iface->bss[0]->driver;
hapd->drv_priv = iface->bss[0]->drv_priv;
#ifdef CONFIG_IEEE80211BE
os_strlcpy(hapd->ctrl_sock_iface, hapd->conf->iface,
sizeof(hapd->ctrl_sock_iface));
#endif
if (interfaces->ctrl_iface_init &&
interfaces->ctrl_iface_init(hapd) < 0)
goto free_hapd;
@ -721,11 +725,10 @@ int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
if (wpa_ucode_call_prepare("sta_auth"))
return 0;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
uc_value_push(ucv_string_new(hapd->conf->iface));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
uc_value_push(ucv_string_new(addr));
val = wpa_ucode_call(2);
@ -787,16 +790,15 @@ void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta
if (wpa_ucode_call_prepare("sta_connected"))
return;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
uc_value_push(ucv_string_new(hapd->conf->iface));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
uc_value_push(ucv_string_new(addr));
val = ucv_object_new(vm);
if (sta->psk_idx)
ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1));
uc_value_push(ucv_get(val));
uc_value_push(val);
val = wpa_ucode_call(3);
if (ucv_type(val) != UC_OBJECT)
@ -878,7 +880,7 @@ void hostapd_ucode_free(void)
void hostapd_ucode_free_iface(struct hostapd_iface *iface)
{
wpa_ucode_registry_remove(iface_registry, iface->ucode.idx);
ucv_put(wpa_ucode_registry_remove(iface_registry, iface->ucode.idx));
}
void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type)
@ -889,10 +891,11 @@ void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type)
return;
val = hostapd_ucode_bss_get_uval(hapd);
uc_value_push(ucv_get(ucv_string_new(hapd->iface->phy)));
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
uc_value_push(ucv_string_new(hapd->iface->phy));
uc_value_push(ucv_string_new(hapd->conf->iface));
uc_value_push(ucv_get(val));
ucv_put(wpa_ucode_call(3));
ucv_put(val);
ucv_gc(vm);
}
@ -911,6 +914,8 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd)
uc_value_push(ucv_string_new(hapd->conf->iface));
uc_value_push(ucv_get(val));
ucv_put(wpa_ucode_call(2));
ucv_put(val);
ucv_gc(vm);
}
@ -923,10 +928,11 @@ void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname)
return;
val = hostapd_ucode_bss_get_uval(hapd);
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); // BSS ifname
uc_value_push(ucv_string_new(hapd->conf->iface)); // BSS ifname
uc_value_push(ucv_get(val));
uc_value_push(ucv_get(ucv_string_new(ifname))); // APuP peer ifname
uc_value_push(ucv_string_new(ifname)); // APuP peer ifname
ucv_put(wpa_ucode_call(2));
ucv_put(val);
ucv_gc(vm);
}
#endif // def CONFIG_APUP

View File

@ -171,7 +171,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
ucv_object_add(ret, "op_class", ucv_int64_new(op_class));
ucv_object_add(ret, "channel", ucv_int64_new(channel));
ucv_object_add(ret, "hw_mode", ucv_int64_new(hw_mode));
ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr)));
ucv_object_add(ret, "hw_mode_str", ucv_string_new(modestr));
ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel));
ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
@ -425,7 +425,7 @@ uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_t
uc_vm_registry_set(&vm, "hostap.global", global);
proto = ucv_prototype_get(global);
ucv_object_add(proto, "data", ucv_get(ucv_object_new(&vm)));
ucv_object_add(proto, "data", ucv_object_new(&vm));
#define ADD_CONST(x) ucv_object_add(proto, #x, ucv_int64_new(x))
ADD_CONST(MSG_EXCESSIVE);
@ -470,6 +470,7 @@ uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx)
if (!val)
return NULL;
ucv_get(val);
ucv_array_set(reg, idx - 1, NULL);
dataptr = ucv_resource_dataptr(val, NULL);
if (dataptr)

View File

@ -20,7 +20,7 @@ wpas_ucode_iface_get_uval(struct wpa_supplicant *wpa_s)
uc_value_t *val;
if (wpa_s->ucode.idx)
return wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
return ucv_get(wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx));
val = uc_resource_new(iface_type, wpa_s);
wpa_s->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
@ -36,9 +36,9 @@ wpas_ucode_update_interfaces(void)
int i;
for (wpa_s = wpa_global->ifaces; wpa_s; wpa_s = wpa_s->next)
ucv_object_add(ifs, wpa_s->ifname, ucv_get(wpas_ucode_iface_get_uval(wpa_s)));
ucv_object_add(ifs, wpa_s->ifname, wpas_ucode_iface_get_uval(wpa_s));
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs));
ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
ucv_gc(vm);
}
@ -49,8 +49,8 @@ void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s)
if (wpa_ucode_call_prepare("iface_add"))
return;
uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
uc_value_push(ucv_get(wpas_ucode_iface_get_uval(wpa_s)));
uc_value_push(ucv_string_new(wpa_s->ifname));
uc_value_push(wpas_ucode_iface_get_uval(wpa_s));
ucv_put(wpa_ucode_call(2));
ucv_gc(vm);
}
@ -67,9 +67,10 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s)
if (wpa_ucode_call_prepare("iface_remove"))
return;
uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
uc_value_push(ucv_string_new(wpa_s->ifname));
uc_value_push(ucv_get(val));
ucv_put(wpa_ucode_call(2));
ucv_put(val);
ucv_gc(vm);
}
@ -86,9 +87,9 @@ void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
return;
state = wpa_supplicant_state_txt(wpa_s->wpa_state);
uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
uc_value_push(ucv_string_new(wpa_s->ifname));
uc_value_push(ucv_get(val));
uc_value_push(ucv_get(ucv_string_new(state)));
uc_value_push(ucv_string_new(state));
ucv_put(wpa_ucode_call(3));
ucv_gc(vm);
}
@ -108,9 +109,9 @@ void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_d
if (wpa_ucode_call_prepare("event"))
return;
uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
uc_value_push(ucv_string_new(wpa_s->ifname));
uc_value_push(ucv_get(val));
uc_value_push(ucv_get(ucv_string_new(event_to_string(event))));
uc_value_push(ucv_string_new(event_to_string(event)));
val = ucv_object_new(vm);
uc_value_push(ucv_get(val));
@ -212,15 +213,14 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
{
struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
struct wpa_bss *bss;
uc_value_t *ret, *val;
uc_value_t *ret;
if (!wpa_s)
return NULL;
ret = ucv_object_new(vm);
val = ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state));
ucv_object_add(ret, "state", ucv_get(val));
ucv_object_add(ret, "state", ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state)));
bss = wpa_s->current_bss;
if (bss) {

View File

@ -157,12 +157,12 @@ my %update_method = (
'src-git' => {
'init' => "git clone --depth 1 '%s' '%s'",
'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'",
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'init_commit' => "git clone --depth 1 '%s' '%s' && cd '%s' && git fetch --depth=1 origin '%s' && git -c advice.detachedHead=false checkout '%s' && cd -",
'update' => "git pull --ff-only",
'update_rebase' => "git pull --rebase=merges",
'update_stash' => "git pull --rebase=merges --autostash",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",
'post_update' => "git submodule update --init --recursive --depth 1",
'controldir' => ".git",
'revision' => "git rev-parse HEAD | tr -d '\n'"},
'src-git-full' => {

View File

@ -0,0 +1,63 @@
From linux-netdev Tue Dec 03 13:04:55 2024
From: Dominique Martinet <asmadeus () codewreck ! org>
Date: Tue, 03 Dec 2024 13:04:55 +0000
To: linux-netdev
Subject: [PATCH] net: usb: usbnet: restore usb%d name exception for local mac addresses
Message-Id: <20241203130457.904325-1-asmadeus () codewreck ! org>
X-MARC-Message: https://marc.info/?l=linux-netdev&m=173323431631309
From: Dominique Martinet <dominique.martinet@atmark-techno.com>
The previous commit assumed that local addresses always came from the
kernel, but some devices hand out local mac addresses so we ended up
with point-to-point devices with a mac set by the driver, renaming to
eth%d when they used to be named usb%d.
Userspace should not rely on device name, but for the sake of stability
restore the local mac address check portion of the naming exception:
point to point devices which either have no mac set by the driver or
have a local mac handed out by the driver will keep the usb%d name.
Fixes: 8a7d12d674ac ("net: usb: usbnet: fix name regression")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
drivers/net/usb/usbnet.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -178,6 +178,17 @@ int usbnet_get_ethernet_addr(struct usbn
}
EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr);
+static bool usbnet_needs_usb_name_format(struct usbnet *dev, struct net_device *net)
+{
+ /* Point to point devices which don't have a real MAC address
+ * (or report a fake local one) have historically used the usb%d
+ * naming. Preserve this..
+ */
+ return (dev->driver_info->flags & FLAG_POINTTOPOINT) != 0 &&
+ (is_zero_ether_addr(net->dev_addr) ||
+ is_local_ether_addr(net->dev_addr));
+}
+
static void intr_complete (struct urb *urb)
{
struct usbnet *dev = urb->context;
@@ -1766,13 +1777,10 @@ usbnet_probe (struct usb_interface *udev
if (status < 0)
goto out1;
- // heuristic: "usb%d" for links we know are two-host,
- // else "eth%d" when there's reasonable doubt. userspace
- // can rename the link if it knows better.
+ /* heuristic: rename to "eth%d" if we are not sure this link
+ * is two-host (these links keep "usb%d") */
if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
- ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
- /* somebody touched it*/
- !is_zero_ether_addr(net->dev_addr)))
+ !usbnet_needs_usb_name_format(dev, net))
strscpy(net->name, "eth%d", sizeof(net->name));
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)