blob: a704bb720d88a741ebc284c2ef82cc831d1435eb [file] [log] [blame]
developer15a43312022-04-12 11:23:23 +08001diff --git a/src/lib/target/inc/target_internal.h b/src/lib/target/inc/target_internal.h
2index 1608b03..c520ad2 100644
3--- a/src/lib/target/inc/target_internal.h
4+++ b/src/lib/target/inc/target_internal.h
5@@ -171,6 +171,9 @@ bool maclearn_update(maclearn_type_t type,
6 bool radio_cloud_mode_set(radio_cloud_mode_t mode);
7 radio_cloud_mode_t radio_cloud_mode_get(void);
8 bool radio_rops_vstate(struct schema_Wifi_VIF_State *vstate);
9+#if defined(_PLATFORM_TURRIS_)
10+bool radio_rops_vconfig(struct schema_Wifi_VIF_Config *vconfig,const char *ifname);
11+#endif
12 void radio_trigger_resync(void);
13
14 void clients_connection(INT apIndex,
15diff --git a/src/lib/target/src/radio.c b/src/lib/target/src/radio.c
16index 9bedd00..b0cbe33 100644
17--- a/src/lib/target/src/radio.c
18+++ b/src/lib/target/src/radio.c
19@@ -786,6 +786,20 @@ void radio_trigger_resync()
20 }
21 }
22
23+#if defined(_PLATFORM_TURRIS_)
24+bool radio_rops_vconfig(struct schema_Wifi_VIF_Config *vconfig , const char *ifname)
25+{
26+ if (!g_rops.op_vconf)
27+ {
28+ LOGE("%s: op_vconfig not set", __func__);
29+ return false;
30+ }
31+
32+ g_rops.op_vconf(vconfig, ifname);
33+ return true;
34+}
35+#endif
36+
37 bool radio_rops_vstate(struct schema_Wifi_VIF_State *vstate)
38 {
39 if (!g_rops.op_vstate)
40diff --git a/src/lib/target/src/vif.c b/src/lib/target/src/vif.c
41index aaecbf9..4e6b4ed 100644
42--- a/src/lib/target/src/vif.c
43+++ b/src/lib/target/src/vif.c
44@@ -1071,7 +1071,17 @@ bool vif_state_update(INT ssidIndex)
45 LOGE("%s: cannot update VIF state for SSID index %d", __func__, ssidIndex);
46 return false;
47 }
48+#if defined(_PLATFORM_TURRIS_)
49+ /* After setting Wifi_VIF_State, updating Wifi_VIF_Config table also in order to avoid overwritting content from Wifi_VIF_Config */
50
51+ struct schema_Wifi_VIF_Config vconfig;
52+
53+ if (vif_copy_to_config(ssidIndex, &vstate, &vconfig))
54+ {
55+ LOGE("%s: copying VIF state to config for SSID index %d", __func__, ssidIndex);
56+ radio_rops_vconfig(&vconfig, vconfig.if_name);
57+ }
58+#endif
59 LOGN("Updating VIF state for SSID index %d", ssidIndex);
60 return radio_rops_vstate(&vstate);
61 }
62