mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 10:57:47 +00:00
cloud_discovery: add option 138 support
Fixes: WIFI-14694 Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -144,7 +144,7 @@ function set_state(set) {
|
|||||||
function discover_dhcp() {
|
function discover_dhcp() {
|
||||||
let dhcp = readjsonfile('/tmp/cloud.json');
|
let dhcp = readjsonfile('/tmp/cloud.json');
|
||||||
if (dhcp?.dhcp_server && dhcp?.dhcp_port) {
|
if (dhcp?.dhcp_server && dhcp?.dhcp_port) {
|
||||||
if (gateway_write({ server: dhcp.dhcp_server, port:dhcp.dhcp_port, valid: false })) {
|
if (gateway_write({ server: dhcp.dhcp_server, port:dhcp.dhcp_port, valid: false, hostname_validate: !dhcp.no_validation })) {
|
||||||
ulog(LOG_INFO, `Discovered cloud via DHCP ${dhcp.dhcp_server}:${dhcp.dhcp_port}\n`);
|
ulog(LOG_INFO, `Discovered cloud via DHCP ${dhcp.dhcp_server}:${dhcp.dhcp_port}\n`);
|
||||||
client_start();
|
client_start();
|
||||||
set_state(VALIDATING);
|
set_state(VALIDATING);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import * as fs from 'fs';
|
|||||||
|
|
||||||
let cmd = ARGV[0];
|
let cmd = ARGV[0];
|
||||||
let ifname = getenv("interface");
|
let ifname = getenv("interface");
|
||||||
|
let opt224 = getenv("opt138");
|
||||||
let opt224 = getenv("opt224");
|
let opt224 = getenv("opt224");
|
||||||
|
|
||||||
if (cmd != 'bound' && cmd != 'renew')
|
if (cmd != 'bound' && cmd != 'renew')
|
||||||
@@ -21,6 +22,13 @@ if (file.server && file.port && file.valid)
|
|||||||
let cloud = {
|
let cloud = {
|
||||||
lease: true,
|
lease: true,
|
||||||
};
|
};
|
||||||
|
if (opt138) {
|
||||||
|
let dhcp = hexdec(opt138);
|
||||||
|
dhcp = split(dhcp, ':');
|
||||||
|
cloud.dhcp_server = dhcp[0];
|
||||||
|
cloud.dhcp_port = dhcp[1] ?? 15002;
|
||||||
|
cloud.no_validation = true;
|
||||||
|
}
|
||||||
if (opt224) {
|
if (opt224) {
|
||||||
let dhcp = hexdec(opt224);
|
let dhcp = hexdec(opt224);
|
||||||
dhcp = split(dhcp, ':');
|
dhcp = split(dhcp, ':');
|
||||||
@@ -29,7 +37,7 @@ if (opt224) {
|
|||||||
}
|
}
|
||||||
fs.writefile('/tmp/cloud.json', cloud);
|
fs.writefile('/tmp/cloud.json', cloud);
|
||||||
|
|
||||||
if (opt224 && cmd == 'renew') {
|
if ((opt138 || opt224) && cmd == 'renew') {
|
||||||
let ubus = libubus.connect();
|
let ubus = libubus.connect();
|
||||||
ubus.call('cloud', 'renew');
|
ubus.call('cloud', 'renew');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user