Issues with STUN on 1.2.16

Recently I tried upgrading our test environment from version v1.2.9 to version v1.2.16. With the same configuration on v1.2.16. The server cannot reach out to CPE devices behind NAT using STUN after updating. Reverting back to v1.2.9 corrects the issue.

Anyone know what the cause might be? The only thing I can see off hand is on v1.2.16, the connection request is going out the wrong interface, no matter what binding options I set in the env file.

Make sure to set the value of ManagementServer.STUNEnable to true. v1.2.9 didn’t respect that parameter so that probably explains your situation.

Thanks for looking into this.

The customized firmware we are using on our CPE devices have STUN enabled by default. Would the parameter not explicitly being refreshed in a provision (ie inform) also cause this? If so I imagine adding a declare to keep it refreshed in the inform provision would be enough.

// TESTING ONLY inform

// Device ID as user name
const username = declare("DeviceID.ID", { value: 1 }).value[0];

// Password will be fixed for a given device because Math.random() is seeded with device ID by default.
const password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);

// const informInterval = 3600;
const informInterval = 120; // fast for testing only in dev network

// Refresh values refresh
// const refresh = Date.now(86400000);
const refresh = Date.now(120000); // fast for testing only in dev network

// Unique inform offset per device for better load distribution
// const informTime = refresh % 86400000;
const informTime = '0000-00-00T00:00:00'; // override for testing

// tr069 data model
declare(
    "InternetGatewayDevice.ManagementServer.ConnectionRequestUsername",
    { value: refresh },
    { value: username },
);
declare(
    "InternetGatewayDevice.ManagementServer.ConnectionRequestPassword",
    { value: refresh },
    { value: password },
);
declare(
    "InternetGatewayDevice.ManagementServer.PeriodicInformEnable",
    { value: refresh },
    { value: true },
);
declare(
    "InternetGatewayDevice.ManagementServer.PeriodicInformInterval",
    { value: refresh },
    { value: informInterval },
);
declare(
    "InternetGatewayDevice.ManagementServer.PeriodicInformTime",
    { value: refresh },
    { value: informTime },
);

// add refresh for STUNEnable
declare(
    "InternetGatewayDevice.ManagementServer.STUNEnable",
    { value: refresh }
);

I’ll backup our current config/install and deploy 1.2.16 again with that in mind and report back.

Reporting back with some success.

const interval = Date.now(300000); // 5 minutes for testing

// ...SNIP...

declare("InternetGatewayDevice.ManagementServer.STUNEnable", {
    path: interval,
    value: interval
});

// ...SNIP...

This worked for me. Instead of having it in inform I put it in default. I had to specify both path and value for it to work.