wireless: update prev_config on SET_DATA notify
authorFelix Fietkau <nbd@nbd.name>
Tue, 19 Sep 2023 09:44:34 +0000 (11:44 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 19 Sep 2023 09:44:38 +0000 (11:44 +0200)
Fixes passing phy name from setup to teardown

Signed-off-by: Felix Fietkau <nbd@nbd.name>
wireless.c

index a21bf54d6f5dbfe20bf2686f3e9f72445bdac5c3..7ad2fcf0aa484f97fc25d47177f0db3850b8d388 100644 (file)
@@ -692,6 +692,14 @@ wdev_set_config_state(struct wireless_device *wdev, enum interface_config_state
                __wireless_device_set_down(wdev);
 }
 
+static void
+wdev_prepare_prev_config(struct wireless_device *wdev)
+{
+       prepare_config(wdev, &b, false);
+       free(wdev->prev_config);
+       wdev->prev_config = blob_memdup(b.head);
+}
+
 static void
 wdev_change_config(struct wireless_device *wdev, struct wireless_device *wd_new)
 {
@@ -1511,6 +1519,7 @@ wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
                        wireless_vlan_set_data(vlan);
                else if (vif)
                        wireless_interface_set_data(vif);
+               wdev_prepare_prev_config(wdev);
                break;
        case NOTIFY_CMD_PROCESS_ADD:
                return wireless_device_add_process(wdev, cur);