Only send UDP con req if STUNEnable is true

Because even when STUN is not enabled, the param UDPConnectionRequestAddress
will still hold IP of the listening interface which we can't reach.
This commit is contained in:
Zaid Abdulla committed 2020-12-08 02:08:25 -08:00
1 parent 0e0380917f
commit 081201cd2f
1 file changed
+7 -1
+7 -1
View File
@@ -50,6 +50,7 @@ export async function connectionRequest(
let connectionRequestUrl,
udpConnectionRequestAddress,
stunEnable,
connReqJabberId,
username,
password;
@@ -63,6 +64,9 @@ export async function connectionRequest(
"InternetGatewayDevice.ManagementServer.UDPConnectionRequestAddress"
] || {}
).value || [""])[0];
stunEnable = ((
device["InternetGatewayDevice.ManagementServer.STUNEnable"] || {}
).value || [""])[0];
connReqJabberId = ((
device["InternetGatewayDevice.ManagementServer.ConnReqJabberID"] || {}
).value || [""])[0];
@@ -83,6 +87,8 @@ export async function connectionRequest(
udpConnectionRequestAddress = ((
device["Device.ManagementServer.UDPConnectionRequestAddress"] || {}
).value || [""])[0];
stunEnable = ((device["Device.ManagementServer.STUNEnable"] || {})
.value || [""])[0];
connReqJabberId = ((device["Device.ManagementServer.ConnReqJabberID"] || {})
.value || [""])[0];
username = ((
@@ -159,7 +165,7 @@ export async function connectionRequest(
const debug = !!getConfig(snapshot, "cwmp.debug", {}, now, evalCallback);
let udpProm;
if (udpConnectionRequestAddress) {
if (udpConnectionRequestAddress && +stunEnable) {
udpProm = udpConnectionRequest(
udpConnectionRequestAddress,
authExp,