mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 10:57:47 +00:00
Compare commits
1 Commits
uci_defaul
...
WIFI-14966
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff398c7b28 |
@@ -15,9 +15,14 @@ const ONLINE = 2;
|
|||||||
const OFFLINE = 3;
|
const OFFLINE = 3;
|
||||||
const ORPHAN = 4;
|
const ORPHAN = 4;
|
||||||
|
|
||||||
|
const DISCOVER_DHCP = "DHCP";
|
||||||
|
const DISCOVER_FLASH = "FLASH";
|
||||||
|
const DISCOVER_LOOKUP = "OpenLAN";
|
||||||
|
|
||||||
let ubus = libubus.connect();
|
let ubus = libubus.connect();
|
||||||
let uci = libuci.cursor();
|
let uci = libuci.cursor();
|
||||||
let state = DISCOVER;
|
let state = DISCOVER;
|
||||||
|
let discovery_method = "";
|
||||||
let validate_time;
|
let validate_time;
|
||||||
let offline_time;
|
let offline_time;
|
||||||
let orphan_time;
|
let orphan_time;
|
||||||
@@ -78,6 +83,14 @@ function gateway_load() {
|
|||||||
return readjsonfile('/etc/ucentral/gateway.json');
|
return readjsonfile('/etc/ucentral/gateway.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function discovery_state_write() {
|
||||||
|
let discovery_state = {
|
||||||
|
"type": discovery_method,
|
||||||
|
"updated": time()
|
||||||
|
};
|
||||||
|
fs.writefile('/etc/ucentral/discovery.state.json', discovery_state);
|
||||||
|
}
|
||||||
|
|
||||||
function gateway_write(data) {
|
function gateway_write(data) {
|
||||||
let gateway = gateway_load();
|
let gateway = gateway_load();
|
||||||
gateway ??= {};
|
gateway ??= {};
|
||||||
@@ -130,6 +143,7 @@ function set_state(set) {
|
|||||||
if (prev == VALIDATING) {
|
if (prev == VALIDATING) {
|
||||||
ulog(LOG_INFO, 'Setting cloud controller to validated\n');
|
ulog(LOG_INFO, 'Setting cloud controller to validated\n');
|
||||||
gateway_write({ valid: true });
|
gateway_write({ valid: true });
|
||||||
|
discovery_state_write();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -227,15 +241,18 @@ function interval_handler() {
|
|||||||
if (!time_is_valid())
|
if (!time_is_valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
discovery_method = DISCOVER_DHCP;
|
||||||
if (discover_dhcp())
|
if (discover_dhcp())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (system('/usr/bin/est_client enroll'))
|
if (system('/usr/bin/est_client enroll'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
discovery_method = DISCOVER_FLASH;
|
||||||
if (!discover_flash())
|
if (!discover_flash())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
discovery_method = DISCOVER_LOOKUP;
|
||||||
redirector_lookup();
|
redirector_lookup();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
From 309a419087da906a2f3b0f39763f021e9729dd85 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Paul White <paul@shasta.cloud>
|
|
||||||
Date: Mon, 4 Aug 2025 04:14:23 +0000
|
|
||||||
Subject: [PATCH] base-files: boot: add sync after uci-defaults
|
|
||||||
|
|
||||||
A scenario was seen where UCI config was not flushed to disk before
|
|
||||||
an AP power-cycle after uci-defaults was completed. Since these
|
|
||||||
scripts are deleted after being ran once, there is no way to recover
|
|
||||||
without a factory reset.
|
|
||||||
|
|
||||||
Adding this sync operation proved to help avoid this situation from
|
|
||||||
happening
|
|
||||||
|
|
||||||
Signed-off-by: Paul White <paul@shasta.cloud>
|
|
||||||
---
|
|
||||||
package/base-files/files/etc/init.d/boot | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
|
|
||||||
index 15756669a9..c8a803e32c 100755
|
|
||||||
--- a/package/base-files/files/etc/init.d/boot
|
|
||||||
+++ b/package/base-files/files/etc/init.d/boot
|
|
||||||
@@ -15,6 +15,7 @@ uci_apply_defaults() {
|
|
||||||
( . "./$(basename $file)" ) && rm -f "$file"
|
|
||||||
done
|
|
||||||
uci commit
|
|
||||||
+ sync
|
|
||||||
}
|
|
||||||
|
|
||||||
boot() {
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user