diff --git a/feeds/tip/cloud_discovery/files/usr/bin/cloud_discovery b/feeds/tip/cloud_discovery/files/usr/bin/cloud_discovery index e0cc01b2b..7745d4f0b 100755 --- a/feeds/tip/cloud_discovery/files/usr/bin/cloud_discovery +++ b/feeds/tip/cloud_discovery/files/usr/bin/cloud_discovery @@ -144,7 +144,7 @@ function set_state(set) { function discover_dhcp() { let dhcp = readjsonfile('/tmp/cloud.json'); 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`); client_start(); set_state(VALIDATING); diff --git a/feeds/tip/cloud_discovery/files/usr/share/ucentral/cloud_discovery.uc b/feeds/tip/cloud_discovery/files/usr/share/ucentral/cloud_discovery.uc index ecbdab2ce..85769cbe4 100755 --- a/feeds/tip/cloud_discovery/files/usr/share/ucentral/cloud_discovery.uc +++ b/feeds/tip/cloud_discovery/files/usr/share/ucentral/cloud_discovery.uc @@ -5,6 +5,7 @@ import * as fs from 'fs'; let cmd = ARGV[0]; let ifname = getenv("interface"); +let opt224 = getenv("opt138"); let opt224 = getenv("opt224"); if (cmd != 'bound' && cmd != 'renew') @@ -21,6 +22,13 @@ if (file.server && file.port && file.valid) let cloud = { 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) { let dhcp = hexdec(opt224); dhcp = split(dhcp, ':'); @@ -29,7 +37,7 @@ if (opt224) { } fs.writefile('/tmp/cloud.json', cloud); -if (opt224 && cmd == 'renew') { +if ((opt138 || opt224) && cmd == 'renew') { let ubus = libubus.connect(); ubus.call('cloud', 'renew'); }