From 081201cd2f7b671b16042eb977dbea98d5a03cc2 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 9 Nov 2020 17:23:20 -0800 Subject: [PATCH] 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. --- lib/api-functions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/api-functions.ts b/lib/api-functions.ts index 7ba8350..d41b1a1 100644 --- a/lib/api-functions.ts +++ b/lib/api-functions.ts @@ -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,