mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-16 17:01:37 +00:00
wifi-2512 APC state gets stuck in WT mode on bootup
Sometimes the APC_State mode gets stuck in WT mode on bootup. Sometimes the APC State gets updated at the same time as disabling the APC (SIGTERM puts it in NC mode) So it may get updated to WT just after SIGTERM handler puts it in NC mode. Fix this by setting APC_State in NC mode again after disabling the APC from opensync (wm). Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
This commit is contained in:
parent
1c5a8940e4
commit
8b07342d9d
@ -814,13 +814,38 @@ static int conn_since = 0;
|
||||
|
||||
static void apc_enable(bool flag) {
|
||||
|
||||
SCHEMA_SET_INT(apc_conf.enabled, flag);
|
||||
if (!ovsdb_table_update(&table_APC_Config, &apc_conf)) {
|
||||
LOG(ERR, "%s:APC_Config: failed to update", __func__);
|
||||
return;
|
||||
}
|
||||
struct schema_APC_State apc_state;
|
||||
json_t *where;
|
||||
|
||||
LOGI("APC %s: %s APC", __func__, flag?"enable":"disable");
|
||||
if (flag == false) {
|
||||
where = ovsdb_table_where(&table_APC_State, &apc_state);
|
||||
if (false == ovsdb_table_select_one_where(&table_APC_State,
|
||||
where, &apc_state)) {
|
||||
LOG(ERR, "%s: APC_State read failed", __func__);
|
||||
apc_state.enabled = true;
|
||||
}
|
||||
|
||||
if (apc_state.enabled == true) {
|
||||
SCHEMA_SET_INT(apc_conf.enabled, flag);
|
||||
if (!ovsdb_table_update(&table_APC_Config, &apc_conf)) {
|
||||
LOG(ERR, "%s:APC_Config: failed to update", __func__);
|
||||
return;
|
||||
}
|
||||
SCHEMA_SET_STR(apc_state.mode, "NC");
|
||||
SCHEMA_SET_STR(apc_state.dr_addr, "0.0.0.0");
|
||||
SCHEMA_SET_STR(apc_state.bdr_addr, "0.0.0.0");
|
||||
SCHEMA_SET_INT(apc_state.enabled, false);
|
||||
if (!ovsdb_table_update(&table_APC_State, &apc_state))
|
||||
LOG(ERR, "APC_state: failed to update");
|
||||
}
|
||||
} else {
|
||||
SCHEMA_SET_INT(apc_conf.enabled, flag);
|
||||
if (!ovsdb_table_update(&table_APC_Config, &apc_conf)) {
|
||||
LOG(ERR, "%s:APC_Config: failed to update", __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -844,9 +869,9 @@ apc_cld_mon_cb(struct schema_Manager *mgr)
|
||||
/*Checks if wan ethernet port is down and disables apc*/
|
||||
ret = system("/bin/check_wan_link.sh");
|
||||
if (WIFEXITED(ret)) {
|
||||
LOGI("The return value: %d\n", WEXITSTATUS(ret));
|
||||
link = WEXITSTATUS(ret);
|
||||
if (link == 0) {
|
||||
LOGD("APC link down");
|
||||
apc_enable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user