mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
patches: drop unused patches
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -1,285 +0,0 @@
|
||||
From 4e4128e44fcb6c0f444e4aa481eb8941f47a801a Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 15 Sep 2023 20:47:10 +0200
|
||||
Subject: [PATCH] netifd: add support for enabling/disabling wifi interfaces
|
||||
via ifup/ifdown
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
package/network/config/netifd/files/sbin/ifup | 33 ---
|
||||
.../patches/410-wireless_network_state.patch | 194 ++++++++++++++++++
|
||||
2 files changed, 194 insertions(+), 33 deletions(-)
|
||||
create mode 100644 package/network/config/netifd/patches/410-wireless_network_state.patch
|
||||
|
||||
diff --git a/package/network/config/netifd/files/sbin/ifup b/package/network/config/netifd/files/sbin/ifup
|
||||
index 15be535bbfc9..fbf2fd80c7ea 100755
|
||||
--- a/package/network/config/netifd/files/sbin/ifup
|
||||
+++ b/package/network/config/netifd/files/sbin/ifup
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
ifup_all=
|
||||
-setup_wifi=
|
||||
|
||||
if_call() {
|
||||
local interface="$1"
|
||||
@@ -14,7 +13,6 @@ case "$0" in
|
||||
*ifdown) modes=down;;
|
||||
*ifup)
|
||||
modes="down up"
|
||||
- setup_wifi=1
|
||||
;;
|
||||
*) echo "Invalid command: $0";;
|
||||
esac
|
||||
@@ -25,10 +23,6 @@ while :; do
|
||||
ifup_all=1
|
||||
shift
|
||||
;;
|
||||
- -w)
|
||||
- setup_wifi=
|
||||
- shift
|
||||
- ;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
@@ -40,7 +34,6 @@ if [ -n "$ifup_all" ]; then
|
||||
for interface in $(ubus -S list 'network.interface.*'); do
|
||||
if_call "${interface##network.interface.}"
|
||||
done
|
||||
- [ -n "$setup_wifi" ] && /sbin/wifi up
|
||||
exit
|
||||
else
|
||||
ubus -S list "network.interface.$1" > /dev/null || {
|
||||
@@ -49,29 +42,3 @@ else
|
||||
}
|
||||
if_call "$1"
|
||||
fi
|
||||
-
|
||||
-if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then
|
||||
- . /lib/functions.sh
|
||||
-
|
||||
- find_related_radios() {
|
||||
- local wdev wnet
|
||||
- config_get wdev "$1" device
|
||||
- config_get wnet "$1" network
|
||||
-
|
||||
- if [ -n "$wdev" ]; then
|
||||
- for wnet in $wnet; do
|
||||
- if [ "$wnet" = "$network" ]; then
|
||||
- append radio_devs "$wdev" "$N"
|
||||
- fi
|
||||
- done
|
||||
- fi
|
||||
- }
|
||||
-
|
||||
- network="$1"
|
||||
- config_load wireless
|
||||
- config_foreach find_related_radios wifi-iface
|
||||
-
|
||||
- for dev in $(echo "$radio_devs" | sort -u); do
|
||||
- /sbin/wifi up "$dev"
|
||||
- done
|
||||
-fi
|
||||
diff --git a/package/network/config/netifd/patches/410-wireless_network_state.patch b/package/network/config/netifd/patches/410-wireless_network_state.patch
|
||||
new file mode 100644
|
||||
index 000000000000..4e9b905190b6
|
||||
--- /dev/null
|
||||
+++ b/package/network/config/netifd/patches/410-wireless_network_state.patch
|
||||
@@ -0,0 +1,194 @@
|
||||
+--- a/config.c
|
||||
++++ b/config.c
|
||||
+@@ -784,7 +784,7 @@ config_init_all(void)
|
||||
+ vlist_flush(&interfaces);
|
||||
+ interface_refresh_assignments(false);
|
||||
+ interface_start_pending();
|
||||
+- wireless_start_pending();
|
||||
++ wireless_start_pending(0);
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+--- a/interface.c
|
||||
++++ b/interface.c
|
||||
+@@ -25,6 +25,7 @@
|
||||
+ #include "ubus.h"
|
||||
+ #include "config.h"
|
||||
+ #include "system.h"
|
||||
++#include "wireless.h"
|
||||
+
|
||||
+ struct vlist_tree interfaces;
|
||||
+ static LIST_HEAD(iface_all_users);
|
||||
+@@ -1125,6 +1126,7 @@ interface_set_up(struct interface *iface
|
||||
+ const char *error = NULL;
|
||||
+
|
||||
+ iface->autostart = true;
|
||||
++ wireless_check_network_enabled();
|
||||
+
|
||||
+ if (iface->state != IFS_DOWN)
|
||||
+ return;
|
||||
+@@ -1157,6 +1159,7 @@ interface_set_down(struct interface *ifa
|
||||
+ __interface_set_down(iface, false);
|
||||
+ } else {
|
||||
+ iface->autostart = false;
|
||||
++ wireless_check_network_enabled();
|
||||
+ __interface_set_down(iface, false);
|
||||
+ }
|
||||
+ }
|
||||
+--- a/wireless.c
|
||||
++++ b/wireless.c
|
||||
+@@ -198,6 +198,9 @@ prepare_config(struct wireless_device *w
|
||||
+
|
||||
+ l = blobmsg_open_table(&b, "interfaces");
|
||||
+ vlist_for_each_element(&wdev->interfaces, vif, node) {
|
||||
++ if (vif->disabled)
|
||||
++ continue;
|
||||
++
|
||||
+ i = blobmsg_open_table(&b, vif->name);
|
||||
+ vif_config_add_bridge(&b, vif->network, up);
|
||||
+ put_container(&b, vif->config, "config");
|
||||
+@@ -438,6 +441,8 @@ wireless_device_run_handler(struct wirel
|
||||
+ wdev->prev_config = NULL;
|
||||
+ } else {
|
||||
+ prepare_config(wdev, &b, up);
|
||||
++ free(wdev->prev_config);
|
||||
++ wdev->prev_config = up ? blob_memdup(b.head) : NULL;
|
||||
+ config = blobmsg_format_json(b.head, true);
|
||||
+ }
|
||||
+
|
||||
+@@ -495,8 +500,6 @@ __wireless_device_set_up(struct wireless
|
||||
+ if ((!force && wdev->state != IFS_DOWN) || config_init)
|
||||
+ return;
|
||||
+
|
||||
+- free(wdev->prev_config);
|
||||
+- wdev->prev_config = NULL;
|
||||
+ wdev->state = IFS_SETUP;
|
||||
+ wireless_device_run_handler(wdev, true);
|
||||
+ }
|
||||
+@@ -690,16 +693,6 @@ wdev_set_config_state(struct wireless_de
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+-wdev_prepare_prev_config(struct wireless_device *wdev)
|
||||
+-{
|
||||
+- if (wdev->prev_config)
|
||||
+- return;
|
||||
+-
|
||||
+- prepare_config(wdev, &b, false);
|
||||
+- wdev->prev_config = blob_memdup(b.head);
|
||||
+-}
|
||||
+-
|
||||
+-static void
|
||||
+ wdev_change_config(struct wireless_device *wdev, struct wireless_device *wd_new)
|
||||
+ {
|
||||
+ struct blob_attr *new_config = wd_new->config;
|
||||
+@@ -709,7 +702,6 @@ wdev_change_config(struct wireless_devic
|
||||
+ wdev->serialize = wd_new->serialize;
|
||||
+ free(wd_new);
|
||||
+
|
||||
+- wdev_prepare_prev_config(wdev);
|
||||
+ if (blob_attr_equal(wdev->config, new_config) && wdev->disabled == disabled)
|
||||
+ return;
|
||||
+
|
||||
+@@ -1533,19 +1525,78 @@ wireless_device_notify(struct wireless_d
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+-/* called on startup and by netifd reload() */
|
||||
+-void
|
||||
+-wireless_start_pending(void)
|
||||
++static void
|
||||
++wdev_check_network_enabled(struct wireless_device *wdev)
|
||||
++{
|
||||
++ struct wireless_interface *vif;
|
||||
++ struct interface *iface;
|
||||
++ struct blob_attr *cur;
|
||||
++ int rem;
|
||||
++
|
||||
++ vlist_for_each_element(&wdev->interfaces, vif, node) {
|
||||
++ int enabled = -1;
|
||||
++
|
||||
++ blobmsg_for_each_attr(cur, vif->network, rem) {
|
||||
++ iface = vlist_find(&interfaces, blobmsg_get_string(cur), iface, node);
|
||||
++ if (!iface)
|
||||
++ continue;
|
||||
++
|
||||
++ if (iface->autostart) {
|
||||
++ enabled = 1;
|
||||
++ break;
|
||||
++ }
|
||||
++ if (enabled != 1)
|
||||
++ enabled = 0;
|
||||
++ }
|
||||
++
|
||||
++ if (vif->disabled == !enabled)
|
||||
++ continue;
|
||||
++
|
||||
++ vif->disabled = !enabled;
|
||||
++ wdev->config_update = true;
|
||||
++ }
|
||||
++}
|
||||
++
|
||||
++static void
|
||||
++__wireless_start_pending(struct uloop_timeout *t)
|
||||
+ {
|
||||
+ struct wireless_device *wdev;
|
||||
+
|
||||
+ vlist_for_each_element(&wireless_devices, wdev, node) {
|
||||
++ wdev_check_network_enabled(wdev);
|
||||
+ if (wdev->config_update)
|
||||
+ wdev_set_config_state(wdev, IFC_RELOAD);
|
||||
+ __wireless_device_set_up(wdev, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
++void wireless_start_pending(int timeout)
|
||||
++{
|
||||
++ static struct uloop_timeout timer = {
|
||||
++ .cb = __wireless_start_pending
|
||||
++ };
|
||||
++
|
||||
++ if (timeout) {
|
||||
++ uloop_timeout_set(&timer, timeout);
|
||||
++ return;
|
||||
++ }
|
||||
++
|
||||
++ uloop_timeout_cancel(&timer);
|
||||
++ timer.cb(&timer);
|
||||
++}
|
||||
++
|
||||
++void wireless_check_network_enabled(void)
|
||||
++{
|
||||
++ struct wireless_device *wdev;
|
||||
++
|
||||
++ vlist_for_each_element(&wireless_devices, wdev, node) {
|
||||
++ wdev_check_network_enabled(wdev);
|
||||
++
|
||||
++ if (wdev->config_update)
|
||||
++ wireless_start_pending(1000);
|
||||
++ }
|
||||
++}
|
||||
++
|
||||
+ void wireless_device_hotplug_event(const char *name, bool add)
|
||||
+ {
|
||||
+ struct wireless_interface *vif;
|
||||
+--- a/wireless.h
|
||||
++++ b/wireless.h
|
||||
+@@ -94,6 +94,7 @@ struct wireless_interface {
|
||||
+ int multicast_to_unicast;
|
||||
+ int vlan_idx;
|
||||
+ int sta_idx;
|
||||
++ bool disabled;
|
||||
+ };
|
||||
+
|
||||
+ struct wireless_vlan {
|
||||
+@@ -142,7 +143,8 @@ void wireless_station_create(struct wire
|
||||
+ int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
|
||||
+ struct ubus_request_data *req);
|
||||
+
|
||||
+-void wireless_start_pending(void);
|
||||
++void wireless_check_network_enabled(void);
|
||||
++void wireless_start_pending(int timeout);
|
||||
+ void wireless_init(void);
|
||||
+ void wireless_device_hotplug_event(const char *name, bool add);
|
||||
+
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,607 +0,0 @@
|
||||
From f7feafa6a88a70f96ac4bf556ff5b0665eb9735a Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 15 Sep 2023 15:01:44 +0200
|
||||
Subject: [PATCH] netifd: add wireless vlan/sta fix
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
.../patches/400-wireless_vlan_fix.patch | 587 ++++++++++++++++++
|
||||
1 file changed, 587 insertions(+)
|
||||
create mode 100644 package/network/config/netifd/patches/400-wireless_vlan_fix.patch
|
||||
|
||||
diff --git a/package/network/config/netifd/patches/400-wireless_vlan_fix.patch b/package/network/config/netifd/patches/400-wireless_vlan_fix.patch
|
||||
new file mode 100644
|
||||
index 000000000000..449121dd3d9e
|
||||
--- /dev/null
|
||||
+++ b/package/network/config/netifd/patches/400-wireless_vlan_fix.patch
|
||||
@@ -0,0 +1,587 @@
|
||||
+--- a/config.c
|
||||
++++ b/config.c
|
||||
+@@ -557,8 +557,8 @@ config_parse_wireless_device(struct uci_
|
||||
+ wireless_device_create(drv, s->e.name, b.head);
|
||||
+ }
|
||||
+
|
||||
+-static struct wireless_interface*
|
||||
+-config_parse_wireless_interface(struct wireless_device *wdev, struct uci_section *s)
|
||||
++static void
|
||||
++config_parse_wireless_vlan(struct wireless_interface *vif, struct uci_section *s)
|
||||
+ {
|
||||
+ char *name;
|
||||
+
|
||||
+@@ -566,12 +566,12 @@ config_parse_wireless_interface(struct w
|
||||
+ sprintf(name, "@%s[%d]", s->type, config_section_idx(s));
|
||||
+
|
||||
+ blob_buf_init(&b, 0);
|
||||
+- uci_to_blob(&b, s, wdev->drv->interface.config);
|
||||
+- return wireless_interface_create(wdev, b.head, s->anonymous ? name : s->e.name);
|
||||
++ uci_to_blob(&b, s, vif->wdev->drv->vlan.config);
|
||||
++ wireless_vlan_create(vif, b.head, s->anonymous ? name : s->e.name);
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+-config_parse_wireless_vlan(struct wireless_device *wdev, char *vif, struct uci_section *s)
|
||||
++config_parse_wireless_station(struct wireless_interface *vif, struct uci_section *s)
|
||||
+ {
|
||||
+ char *name;
|
||||
+
|
||||
+@@ -579,21 +579,62 @@ config_parse_wireless_vlan(struct wirele
|
||||
+ sprintf(name, "@%s[%d]", s->type, config_section_idx(s));
|
||||
+
|
||||
+ blob_buf_init(&b, 0);
|
||||
+- uci_to_blob(&b, s, wdev->drv->vlan.config);
|
||||
+- wireless_vlan_create(wdev, vif, b.head, s->anonymous ? name : s->e.name);
|
||||
++ uci_to_blob(&b, s, vif->wdev->drv->station.config);
|
||||
++ wireless_station_create(vif, b.head, s->anonymous ? name : s->e.name);
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+-config_parse_wireless_station(struct wireless_device *wdev, char *vif, struct uci_section *s)
|
||||
++config_parse_wireless_interface(struct wireless_device *wdev, struct uci_section *s)
|
||||
+ {
|
||||
++ struct wireless_interface *vif;
|
||||
++ struct uci_element *f;
|
||||
+ char *name;
|
||||
+
|
||||
+ name = alloca(strlen(s->type) + 16);
|
||||
+ sprintf(name, "@%s[%d]", s->type, config_section_idx(s));
|
||||
+
|
||||
+ blob_buf_init(&b, 0);
|
||||
+- uci_to_blob(&b, s, wdev->drv->station.config);
|
||||
+- wireless_station_create(wdev, vif, b.head, s->anonymous ? name : s->e.name);
|
||||
++ uci_to_blob(&b, s, wdev->drv->interface.config);
|
||||
++ vif = wireless_interface_create(wdev, b.head, s->anonymous ? name : s->e.name);
|
||||
++ if (!vif)
|
||||
++ return;
|
||||
++
|
||||
++ vif->vlan_idx = vif->sta_idx = 0;
|
||||
++ vlist_update(&vif->vlans);
|
||||
++ vlist_update(&vif->stations);
|
||||
++
|
||||
++ if (s->anonymous)
|
||||
++ goto out;
|
||||
++
|
||||
++ uci_foreach_element(&uci_wireless->sections, f) {
|
||||
++ struct uci_section *cur = uci_to_section(f);
|
||||
++ const char *vif_name;
|
||||
++
|
||||
++ if (strcmp(cur->type, "wifi-vlan") != 0)
|
||||
++ continue;
|
||||
++
|
||||
++ vif_name = uci_lookup_option_string(uci_ctx, cur, "iface");
|
||||
++ if (vif_name && strcmp(s->e.name, vif_name))
|
||||
++ continue;
|
||||
++ config_parse_wireless_vlan(vif, cur);
|
||||
++ }
|
||||
++
|
||||
++ uci_foreach_element(&uci_wireless->sections, f) {
|
||||
++ struct uci_section *cur = uci_to_section(f);
|
||||
++ const char *vif_name;
|
||||
++
|
||||
++ if (strcmp(cur->type, "wifi-station") != 0)
|
||||
++ continue;
|
||||
++
|
||||
++ vif_name = uci_lookup_option_string(uci_ctx, cur, "iface");
|
||||
++ if (vif_name && strcmp(s->e.name, vif_name))
|
||||
++ continue;
|
||||
++ config_parse_wireless_station(vif, cur);
|
||||
++ }
|
||||
++
|
||||
++out:
|
||||
++ vlist_flush(&vif->vlans);
|
||||
++ vlist_flush(&vif->stations);
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+@@ -623,16 +664,10 @@ config_init_wireless(void)
|
||||
+ vlist_for_each_element(&wireless_devices, wdev, node) {
|
||||
+ wdev->vif_idx = 0;
|
||||
+ vlist_update(&wdev->interfaces);
|
||||
+- wdev->vlan_idx = 0;
|
||||
+- vlist_update(&wdev->vlans);
|
||||
+- wdev->sta_idx = 0;
|
||||
+- vlist_update(&wdev->stations);
|
||||
+ }
|
||||
+
|
||||
+ uci_foreach_element(&uci_wireless->sections, e) {
|
||||
+ struct uci_section *s = uci_to_section(e);
|
||||
+- struct wireless_interface *vif;
|
||||
+- struct uci_element *f;
|
||||
+
|
||||
+ if (strcmp(s->type, "wifi-iface") != 0)
|
||||
+ continue;
|
||||
+@@ -647,42 +682,11 @@ config_init_wireless(void)
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+- vif = config_parse_wireless_interface(wdev, s);
|
||||
+-
|
||||
+- if (!vif || s->anonymous)
|
||||
+- continue;
|
||||
+- uci_foreach_element(&uci_wireless->sections, f) {
|
||||
+- struct uci_section *s = uci_to_section(f);
|
||||
+- const char *vif_name;
|
||||
+-
|
||||
+- if (strcmp(s->type, "wifi-vlan") != 0)
|
||||
+- continue;
|
||||
+-
|
||||
+- vif_name = uci_lookup_option_string(uci_ctx, s, "iface");
|
||||
+- if (vif_name && strcmp(e->name, vif_name))
|
||||
+- continue;
|
||||
+- config_parse_wireless_vlan(wdev, vif->name, s);
|
||||
+- }
|
||||
+-
|
||||
+- uci_foreach_element(&uci_wireless->sections, f) {
|
||||
+- struct uci_section *s = uci_to_section(f);
|
||||
+- const char *vif_name;
|
||||
+-
|
||||
+- if (strcmp(s->type, "wifi-station") != 0)
|
||||
+- continue;
|
||||
+-
|
||||
+- vif_name = uci_lookup_option_string(uci_ctx, s, "iface");
|
||||
+- if (vif_name && strcmp(e->name, vif_name))
|
||||
+- continue;
|
||||
+- config_parse_wireless_station(wdev, vif->name, s);
|
||||
+- }
|
||||
++ config_parse_wireless_interface(wdev, s);
|
||||
+ }
|
||||
+
|
||||
+- vlist_for_each_element(&wireless_devices, wdev, node) {
|
||||
++ vlist_for_each_element(&wireless_devices, wdev, node)
|
||||
+ vlist_flush(&wdev->interfaces);
|
||||
+- vlist_flush(&wdev->vlans);
|
||||
+- vlist_flush(&wdev->stations);
|
||||
+- }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+--- a/scripts/netifd-wireless.sh
|
||||
++++ b/scripts/netifd-wireless.sh
|
||||
+@@ -108,14 +108,16 @@ _wdev_wrapper() {
|
||||
+ }
|
||||
+
|
||||
+ _wdev_notify_init() {
|
||||
+- local command="$1"
|
||||
+- local name="$2"
|
||||
+- local value="$3"
|
||||
++ local command="$1"; shift;
|
||||
+
|
||||
+ json_init
|
||||
+ json_add_int "command" "$command"
|
||||
+ json_add_string "device" "$__netifd_device"
|
||||
+- [ -n "$name" -a -n "$value" ] && json_add_string "$name" "$value"
|
||||
++ while [ -n "$1" ]; do
|
||||
++ local name="$1"; shift
|
||||
++ local value="$1"; shift
|
||||
++ json_add_string "$name" "$value"
|
||||
++ done
|
||||
+ json_add_object "data"
|
||||
+ }
|
||||
+
|
||||
+@@ -151,7 +153,7 @@ _wireless_add_vlan() {
|
||||
+ local name="$1"; shift
|
||||
+ local ifname="$1"; shift
|
||||
+
|
||||
+- _wdev_notify_init $CMD_SET_DATA "vlan" "$name"
|
||||
++ _wdev_notify_init $CMD_SET_DATA interface "$__cur_interface" "vlan" "$name"
|
||||
+ json_add_string "ifname" "$ifname"
|
||||
+ _wdev_add_variables "$@"
|
||||
+ _wdev_notify
|
||||
+@@ -333,6 +335,7 @@ for_each_interface() {
|
||||
+ continue
|
||||
+ }
|
||||
+ fi
|
||||
++ __cur_interface="$_w_iface"
|
||||
+ "$@" "$_w_iface"
|
||||
+ json_select ..
|
||||
+ done
|
||||
+--- a/wireless.c
|
||||
++++ b/wireless.c
|
||||
+@@ -205,9 +205,7 @@ prepare_config(struct wireless_device *w
|
||||
+ blobmsg_add_blob(&b, vif->data);
|
||||
+
|
||||
+ j = blobmsg_open_table(&b, "vlans");
|
||||
+- vlist_for_each_element(&wdev->vlans, vlan, node) {
|
||||
+- if (strcmp(vlan->vif, vif->name))
|
||||
+- continue;
|
||||
++ vlist_for_each_element(&vif->vlans, vlan, node) {
|
||||
+ k = blobmsg_open_table(&b, vlan->name);
|
||||
+ vif_config_add_bridge(&b, vlan->network, up);
|
||||
+ put_container(&b, vlan->config, "config");
|
||||
+@@ -218,9 +216,7 @@ prepare_config(struct wireless_device *w
|
||||
+ blobmsg_close_table(&b, j);
|
||||
+
|
||||
+ j = blobmsg_open_table(&b, "stas");
|
||||
+- vlist_for_each_element(&wdev->stations, sta, node) {
|
||||
+- if (strcmp(sta->vif, vif->name))
|
||||
+- continue;
|
||||
++ vlist_for_each_element(&vif->stations, sta, node) {
|
||||
+ k = blobmsg_open_table(&b, sta->name);
|
||||
+ put_container(&b, sta->config, "config");
|
||||
+ if (sta->data)
|
||||
+@@ -311,15 +307,15 @@ wireless_device_free_state(struct wirele
|
||||
+ free(vif->data);
|
||||
+ vif->data = NULL;
|
||||
+ vif->ifname = NULL;
|
||||
+- }
|
||||
+- vlist_for_each_element(&wdev->vlans, vlan, node) {
|
||||
+- free(vlan->data);
|
||||
+- vlan->data = NULL;
|
||||
+- vlan->ifname = NULL;
|
||||
+- }
|
||||
+- vlist_for_each_element(&wdev->stations, sta, node) {
|
||||
+- free(sta->data);
|
||||
+- sta->data = NULL;
|
||||
++ vlist_for_each_element(&vif->vlans, vlan, node) {
|
||||
++ free(vlan->data);
|
||||
++ vlan->data = NULL;
|
||||
++ vlan->ifname = NULL;
|
||||
++ }
|
||||
++ vlist_for_each_element(&vif->stations, sta, node) {
|
||||
++ free(sta->data);
|
||||
++ sta->data = NULL;
|
||||
++ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+@@ -510,8 +506,6 @@ wireless_device_free(struct wireless_dev
|
||||
+ {
|
||||
+ wireless_handler_stop(wdev);
|
||||
+ vlist_flush_all(&wdev->interfaces);
|
||||
+- vlist_flush_all(&wdev->vlans);
|
||||
+- vlist_flush_all(&wdev->stations);
|
||||
+ avl_delete(&wireless_devices.avl, &wdev->node.avl);
|
||||
+ free(wdev->config);
|
||||
+ free(wdev->prev_config);
|
||||
+@@ -547,11 +541,12 @@ wireless_device_mark_down(struct wireles
|
||||
+
|
||||
+ netifd_log_message(L_NOTICE, "Wireless device '%s' is now down\n", wdev->name);
|
||||
+
|
||||
+- vlist_for_each_element(&wdev->vlans, vlan, node)
|
||||
+- wireless_vlan_handle_link(vlan, false);
|
||||
+
|
||||
+- vlist_for_each_element(&wdev->interfaces, vif, node)
|
||||
++ vlist_for_each_element(&wdev->interfaces, vif, node) {
|
||||
+ wireless_interface_handle_link(vif, NULL, false);
|
||||
++ vlist_for_each_element(&vif->vlans, vlan, node)
|
||||
++ wireless_vlan_handle_link(vlan, false);
|
||||
++ }
|
||||
+
|
||||
+ wireless_process_kill_all(wdev, SIGTERM, true);
|
||||
+
|
||||
+@@ -623,10 +618,11 @@ wireless_device_mark_up(struct wireless_
|
||||
+ netifd_log_message(L_NOTICE, "Wireless device '%s' is now up\n", wdev->name);
|
||||
+ wdev->retry = WIRELESS_SETUP_RETRY;
|
||||
+ wdev->state = IFS_UP;
|
||||
+- vlist_for_each_element(&wdev->interfaces, vif, node)
|
||||
++ vlist_for_each_element(&wdev->interfaces, vif, node) {
|
||||
+ wireless_interface_handle_link(vif, NULL, true);
|
||||
+- vlist_for_each_element(&wdev->vlans, vlan, node)
|
||||
+- wireless_vlan_handle_link(vlan, true);
|
||||
++ vlist_for_each_element(&vif->vlans, vlan, node)
|
||||
++ wireless_vlan_handle_link(vlan, true);
|
||||
++ }
|
||||
+ }
|
||||
+
|
||||
+ static void
|
||||
+@@ -848,6 +844,16 @@ wireless_interface_init_config(struct wi
|
||||
+ vif->multicast_to_unicast = cur ? blobmsg_get_bool(cur) : -1;
|
||||
+ }
|
||||
+
|
||||
++static void
|
||||
++vif_free(struct wireless_interface *vif)
|
||||
++{
|
||||
++ vlist_flush_all(&vif->vlans);
|
||||
++ vlist_flush_all(&vif->stations);
|
||||
++ free((void *) vif->section);
|
||||
++ free(vif->config);
|
||||
++ free(vif);
|
||||
++}
|
||||
++
|
||||
+ /* vlist update call for wireless interface list */
|
||||
+ static void
|
||||
+ vif_update(struct vlist_tree *tree, struct vlist_node *node_new,
|
||||
+@@ -884,9 +890,7 @@ vif_update(struct vlist_tree *tree, stru
|
||||
+ } else if (vif_old) {
|
||||
+ D(WIRELESS, "Delete wireless interface %s on device %s\n", vif_old->name, wdev->name);
|
||||
+ wireless_interface_handle_link(vif_old, NULL, false);
|
||||
+- free((void *) vif_old->section);
|
||||
+- free(vif_old->config);
|
||||
+- free(vif_old);
|
||||
++ vif_free(vif_old);
|
||||
+ }
|
||||
+
|
||||
+ wdev->config_update = true;
|
||||
+@@ -921,14 +925,10 @@ static void
|
||||
+ vlan_update(struct vlist_tree *tree, struct vlist_node *node_new,
|
||||
+ struct vlist_node *node_old)
|
||||
+ {
|
||||
+- struct wireless_vlan *vlan_old = container_of(node_old, struct wireless_vlan, node);
|
||||
+- struct wireless_vlan *vlan_new = container_of(node_new, struct wireless_vlan, node);
|
||||
+- struct wireless_device *wdev;
|
||||
+-
|
||||
+- if (vlan_old)
|
||||
+- wdev = vlan_old->wdev;
|
||||
+- else
|
||||
+- wdev = vlan_new->wdev;
|
||||
++ struct wireless_vlan *vlan_old = container_of_safe(node_old, struct wireless_vlan, node);
|
||||
++ struct wireless_vlan *vlan_new = container_of_safe(node_new, struct wireless_vlan, node);
|
||||
++ struct wireless_interface *vif = container_of(tree, struct wireless_interface, vlans);
|
||||
++ struct wireless_device *wdev = vif->wdev;
|
||||
+
|
||||
+ if (vlan_old && vlan_new) {
|
||||
+ free((void *) vlan_old->section);
|
||||
+@@ -951,7 +951,7 @@ vlan_update(struct vlist_tree *tree, str
|
||||
+ vlan_new->config = blob_memdup(vlan_new->config);
|
||||
+ wireless_vlan_init_config(vlan_new);
|
||||
+ } else if (vlan_old) {
|
||||
+- D(WIRELESS, "Delete wireless interface %s on device %s\n", vlan_old->name, wdev->name);
|
||||
++ D(WIRELESS, "Delete wireless vlan %s on device %s\n", vlan_old->name, wdev->name);
|
||||
+ wireless_vlan_handle_link(vlan_old, false);
|
||||
+ free((void *) vlan_old->section);
|
||||
+ free(vlan_old->config);
|
||||
+@@ -966,14 +966,10 @@ static void
|
||||
+ station_update(struct vlist_tree *tree, struct vlist_node *node_new,
|
||||
+ struct vlist_node *node_old)
|
||||
+ {
|
||||
+- struct wireless_station *sta_old = container_of(node_old, struct wireless_station, node);
|
||||
+- struct wireless_station *sta_new = container_of(node_new, struct wireless_station, node);
|
||||
+- struct wireless_device *wdev;
|
||||
+-
|
||||
+- if (sta_old)
|
||||
+- wdev = sta_old->wdev;
|
||||
+- else
|
||||
+- wdev = sta_new->wdev;
|
||||
++ struct wireless_station *sta_old = container_of_safe(node_old, struct wireless_station, node);
|
||||
++ struct wireless_station *sta_new = container_of_safe(node_new, struct wireless_station, node);
|
||||
++ struct wireless_interface *vif = container_of(tree, struct wireless_interface, stations);
|
||||
++ struct wireless_device *wdev = vif->wdev;
|
||||
+
|
||||
+ if (sta_old && sta_new) {
|
||||
+ free((void *) sta_old->section);
|
||||
+@@ -1088,10 +1084,6 @@ wireless_device_create(struct wireless_d
|
||||
+ INIT_LIST_HEAD(&wdev->script_proc);
|
||||
+ vlist_init(&wdev->interfaces, avl_strcmp, vif_update);
|
||||
+ wdev->interfaces.keep_old = true;
|
||||
+- vlist_init(&wdev->vlans, avl_strcmp, vlan_update);
|
||||
+- wdev->vlans.keep_old = true;
|
||||
+- vlist_init(&wdev->stations, avl_strcmp, station_update);
|
||||
+- wdev->stations.keep_old = true;
|
||||
+
|
||||
+ wdev->timeout.cb = wireless_device_setup_timeout;
|
||||
+ wdev->script_task.cb = wireless_device_script_task_cb;
|
||||
+@@ -1108,12 +1100,12 @@ wireless_device_create(struct wireless_d
|
||||
+
|
||||
+ /* creates a wireless station object. Called by config */
|
||||
+ void
|
||||
+-wireless_station_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section)
|
||||
++wireless_station_create(struct wireless_interface *vif, struct blob_attr *data, const char *section)
|
||||
+ {
|
||||
+ struct wireless_station *sta;
|
||||
+ struct blob_attr *tb[__STA_ATTR_MAX];
|
||||
+ struct blob_attr *cur;
|
||||
+- char *name_buf, *vif_buf;
|
||||
++ char *name_buf;
|
||||
+ char name[8];
|
||||
+
|
||||
+ blobmsg_parse(sta_policy, __STA_ATTR_MAX, tb, blob_data(data), blob_len(data));
|
||||
+@@ -1122,18 +1114,15 @@ wireless_station_create(struct wireless_
|
||||
+ if (cur && blobmsg_get_bool(cur))
|
||||
+ return;
|
||||
+
|
||||
+- sprintf(name, "%d", wdev->sta_idx++);
|
||||
++ sprintf(name, "%d", vif->sta_idx++);
|
||||
+
|
||||
+ sta = calloc_a(sizeof(*sta),
|
||||
+- &name_buf, strlen(name) + 1,
|
||||
+- &vif_buf, strlen(vif) + 1);
|
||||
++ &name_buf, strlen(name) + 1);
|
||||
+ sta->name = strcpy(name_buf, name);
|
||||
+- sta->vif = strcpy(vif_buf, vif);
|
||||
+- sta->wdev = wdev;
|
||||
+ sta->config = data;
|
||||
+ sta->section = section;
|
||||
+
|
||||
+- vlist_add(&wdev->stations, &sta->node, sta->name);
|
||||
++ vlist_add(&vif->stations, &sta->node, sta->name);
|
||||
+ }
|
||||
+
|
||||
+ /* ubus callback network.wireless.status, runs for every interface, encode the station */
|
||||
+@@ -1151,12 +1140,12 @@ wireless_station_status(struct wireless_
|
||||
+
|
||||
+ /* create a vlan object. Called by config */
|
||||
+ void
|
||||
+-wireless_vlan_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section)
|
||||
++wireless_vlan_create(struct wireless_interface *vif, struct blob_attr *data, const char *section)
|
||||
+ {
|
||||
+ struct wireless_vlan *vlan;
|
||||
+ struct blob_attr *tb[__VLAN_ATTR_MAX];
|
||||
+ struct blob_attr *cur;
|
||||
+- char *name_buf, *vif_buf;
|
||||
++ char *name_buf;
|
||||
+ char name[8];
|
||||
+
|
||||
+ blobmsg_parse(vlan_policy, __VLAN_ATTR_MAX, tb, blob_data(data), blob_len(data));
|
||||
+@@ -1165,19 +1154,14 @@ wireless_vlan_create(struct wireless_dev
|
||||
+ if (cur && blobmsg_get_bool(cur))
|
||||
+ return;
|
||||
+
|
||||
+- sprintf(name, "%d", wdev->vlan_idx++);
|
||||
++ sprintf(name, "%d", vif->vlan_idx++);
|
||||
+
|
||||
+- vlan = calloc_a(sizeof(*vlan),
|
||||
+- &name_buf, strlen(name) + 1,
|
||||
+- &vif_buf, strlen(vif) + 1);
|
||||
++ vlan = calloc_a(sizeof(*vlan), &name_buf, strlen(name) + 1);
|
||||
+ vlan->name = strcpy(name_buf, name);
|
||||
+- vlan->vif = strcpy(vif_buf, vif);
|
||||
+- vlan->wdev = wdev;
|
||||
+ vlan->config = data;
|
||||
+ vlan->section = section;
|
||||
+- vlan->isolate = false;
|
||||
+
|
||||
+- vlist_add(&wdev->vlans, &vlan->node, vlan->name);
|
||||
++ vlist_add(&vif->vlans, &vlan->node, vlan->name);
|
||||
+ }
|
||||
+
|
||||
+ /* ubus callback network.wireless.status, runs for every interface, encode the vlan informations */
|
||||
+@@ -1220,6 +1204,12 @@ struct wireless_interface* wireless_inte
|
||||
+ vif->section = section;
|
||||
+ vif->isolate = false;
|
||||
+
|
||||
++ vlist_init(&vif->vlans, avl_strcmp, vlan_update);
|
||||
++ vif->vlans.keep_old = true;
|
||||
++
|
||||
++ vlist_init(&vif->stations, avl_strcmp, station_update);
|
||||
++ vif->stations.keep_old = true;
|
||||
++
|
||||
+ vlist_add(&wdev->interfaces, &vif->node, vif->name);
|
||||
+
|
||||
+ return vlist_find(&wdev->interfaces, name, vif, node);
|
||||
+@@ -1240,14 +1230,12 @@ wireless_interface_status(struct wireles
|
||||
+ blobmsg_add_string(b, "ifname", iface->ifname);
|
||||
+ put_container(b, iface->config, "config");
|
||||
+ j = blobmsg_open_array(b, "vlans");
|
||||
+- vlist_for_each_element(&iface->wdev->vlans, vlan, node)
|
||||
+- if (!strcmp(iface->name, vlan->vif))
|
||||
+- wireless_vlan_status(vlan, b);
|
||||
++ vlist_for_each_element(&iface->vlans, vlan, node)
|
||||
++ wireless_vlan_status(vlan, b);
|
||||
+ blobmsg_close_array(b, j);
|
||||
+ j = blobmsg_open_array(b, "stations");
|
||||
+- vlist_for_each_element(&iface->wdev->stations, sta, node)
|
||||
+- if (!strcmp(iface->name, sta->vif))
|
||||
+- wireless_station_status(sta, b);
|
||||
++ vlist_for_each_element(&iface->stations, sta, node)
|
||||
++ wireless_station_status(sta, b);
|
||||
+ blobmsg_close_array(b, j);
|
||||
+ blobmsg_close_table(b, i);
|
||||
+ }
|
||||
+@@ -1496,7 +1484,9 @@ wireless_device_notify(struct wireless_d
|
||||
+ }
|
||||
+
|
||||
+ if ((cur = tb[NOTIFY_ATTR_VLAN]) != NULL) {
|
||||
+- vlan = vlist_find(&wdev->vlans, blobmsg_data(cur), vlan, node);
|
||||
++ if (!vif)
|
||||
++ return UBUS_STATUS_NOT_FOUND;
|
||||
++ vlan = vlist_find(&vif->vlans, blobmsg_data(cur), vlan, node);
|
||||
+ if (!vlan)
|
||||
+ return UBUS_STATUS_NOT_FOUND;
|
||||
+ }
|
||||
+@@ -1516,19 +1506,19 @@ wireless_device_notify(struct wireless_d
|
||||
+ wireless_device_mark_up(wdev);
|
||||
+ break;
|
||||
+ case NOTIFY_CMD_SET_DATA:
|
||||
+- if (vif)
|
||||
+- pdata = &vif->data;
|
||||
+- else if (vlan)
|
||||
++ if (vlan)
|
||||
+ pdata = &vlan->data;
|
||||
++ else if (vif)
|
||||
++ pdata = &vif->data;
|
||||
+ else
|
||||
+ pdata = &wdev->data;
|
||||
+
|
||||
+ free(*pdata);
|
||||
+ *pdata = blob_memdup(cur);
|
||||
+- if (vif)
|
||||
+- wireless_interface_set_data(vif);
|
||||
+- else if (vlan)
|
||||
++ if (vlan)
|
||||
+ wireless_vlan_set_data(vlan);
|
||||
++ else if (vif)
|
||||
++ wireless_interface_set_data(vif);
|
||||
+ break;
|
||||
+ case NOTIFY_CMD_PROCESS_ADD:
|
||||
+ return wireless_device_add_process(wdev, cur);
|
||||
+--- a/wireless.h
|
||||
++++ b/wireless.h
|
||||
+@@ -44,8 +44,6 @@ struct wireless_device {
|
||||
+
|
||||
+ struct wireless_driver *drv;
|
||||
+ struct vlist_tree interfaces;
|
||||
+- struct vlist_tree vlans;
|
||||
+- struct vlist_tree stations;
|
||||
+ char *name;
|
||||
+
|
||||
+ struct netifd_process script_task;
|
||||
+@@ -73,8 +71,6 @@ struct wireless_device {
|
||||
+ int retry;
|
||||
+
|
||||
+ int vif_idx;
|
||||
+- int vlan_idx;
|
||||
+- int sta_idx;
|
||||
+ };
|
||||
+
|
||||
+ struct wireless_interface {
|
||||
+@@ -82,6 +78,8 @@ struct wireless_interface {
|
||||
+ const char *section;
|
||||
+ char *name;
|
||||
+
|
||||
++ struct vlist_tree vlans;
|
||||
++ struct vlist_tree stations;
|
||||
+ struct wireless_device *wdev;
|
||||
+
|
||||
+ struct blob_attr *config;
|
||||
+@@ -94,6 +92,8 @@ struct wireless_interface {
|
||||
+ bool isolate;
|
||||
+ bool ap_mode;
|
||||
+ int multicast_to_unicast;
|
||||
++ int vlan_idx;
|
||||
++ int sta_idx;
|
||||
+ };
|
||||
+
|
||||
+ struct wireless_vlan {
|
||||
+@@ -101,9 +101,6 @@ struct wireless_vlan {
|
||||
+ const char *section;
|
||||
+ char *name;
|
||||
+
|
||||
+- struct wireless_device *wdev;
|
||||
+- char *vif;
|
||||
+-
|
||||
+ struct blob_attr *config;
|
||||
+ struct blob_attr *data;
|
||||
+
|
||||
+@@ -119,9 +116,6 @@ struct wireless_station {
|
||||
+ const char *section;
|
||||
+ char *name;
|
||||
+
|
||||
+- struct wireless_device *wdev;
|
||||
+- char *vif;
|
||||
+-
|
||||
+ struct blob_attr *config;
|
||||
+ struct blob_attr *data;
|
||||
+ };
|
||||
+@@ -143,8 +137,8 @@ void wireless_device_reconf(struct wirel
|
||||
+ void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b);
|
||||
+ void wireless_device_get_validate(struct wireless_device *wdev, struct blob_buf *b);
|
||||
+ struct wireless_interface* wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section);
|
||||
+-void wireless_vlan_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section);
|
||||
+-void wireless_station_create(struct wireless_device *wdev, char *vif, struct blob_attr *data, const char *section);
|
||||
++void wireless_vlan_create(struct wireless_interface *vif, struct blob_attr *data, const char *section);
|
||||
++void wireless_station_create(struct wireless_interface *vif, struct blob_attr *data, const char *section);
|
||||
+ int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
|
||||
+ struct ubus_request_data *req);
|
||||
+
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 2d00d704033f71d527320aeb9d6f47b2f84647e4 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 8 Jun 2023 15:57:24 +0200
|
||||
Subject: [PATCH] base-files: allow setting the dualboot fw_setenv in the
|
||||
sysupgrade sucess handler
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/base-files/files/lib/upgrade/nand.sh | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
|
||||
index 349d287841..41a2de529c 100644
|
||||
--- a/package/base-files/files/lib/upgrade/nand.sh
|
||||
+++ b/package/base-files/files/lib/upgrade/nand.sh
|
||||
@@ -18,6 +18,9 @@ CI_IPQ807X=0
|
||||
# update BOOTCONFIG partitions (rotate rootfs/rootfs_1)
|
||||
CI_BOOTCFG=0
|
||||
|
||||
+# update uboot-env if upgrade suceeded
|
||||
+CI_FWSETENV=
|
||||
+
|
||||
ubi_mknod() {
|
||||
local dir="$1"
|
||||
local dev="/dev/$(basename $dir)"
|
||||
@@ -244,6 +247,7 @@ nand_do_upgrade_success() {
|
||||
local conf_tar="/tmp/sysupgrade.tgz"
|
||||
sync
|
||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||
+ [ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
||||
echo "sysupgrade successful"
|
||||
umount -a
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
From 1ee6f065f807c392cdd560d3673a296132d6568a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Wed, 30 Aug 2023 16:16:12 +0200
|
||||
Subject: [PATCH] netifd: revert upstream wpa3 cypher fix
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
.../netifd/patches/300-revert-wpa3-fix.patch | 24 +++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
create mode 100644 package/network/config/netifd/patches/300-revert-wpa3-fix.patch
|
||||
|
||||
diff --git a/package/network/config/netifd/patches/300-revert-wpa3-fix.patch b/package/network/config/netifd/patches/300-revert-wpa3-fix.patch
|
||||
new file mode 100644
|
||||
index 0000000000..4a02edd8d0
|
||||
--- /dev/null
|
||||
+++ b/package/network/config/netifd/patches/300-revert-wpa3-fix.patch
|
||||
@@ -0,0 +1,24 @@
|
||||
+Index: netifd-2023-08-17-4711f744/scripts/netifd-wireless.sh
|
||||
+===================================================================
|
||||
+--- netifd-2023-08-17-4711f744.orig/scripts/netifd-wireless.sh
|
||||
++++ netifd-2023-08-17-4711f744/scripts/netifd-wireless.sh
|
||||
+@@ -216,19 +216,10 @@ wireless_vif_parse_encryption() {
|
||||
+ wpa_cipher="CCMP"
|
||||
+ fi
|
||||
+
|
||||
+- # WPA3 enterprise requires the GCMP-256 cipher (technically also CCMP and GCMP are possible
|
||||
+- # but many clients/devices do not support that)
|
||||
+- case "$encryption" in
|
||||
+- wpa3-mixed*) wpa_cipher="${wpa_cipher} GCMP-256";;
|
||||
+- wpa3*) wpa_cipher="GCMP-256";;
|
||||
+- esac
|
||||
+-
|
||||
+ case "$encryption" in
|
||||
+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) wpa_cipher="CCMP TKIP";;
|
||||
+- *ccmp256) wpa_cipher="CCMP-256";;
|
||||
+ *aes|*ccmp) wpa_cipher="CCMP";;
|
||||
+ *tkip) wpa_cipher="TKIP";;
|
||||
+- *gcmp256) wpa_cipher="GCMP-256";;
|
||||
+ *gcmp) wpa_cipher="GCMP";;
|
||||
+ esac
|
||||
+
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user