Bug in gl-ngx-session port parser breaks login when gl.conf uses "listen IP:port;" format (4.9.0, Flint 2)

Firmware: 4.9.0, GL-MT6000 (Flint 2)

Symptom: "Unknown error occurred" on web login. SSH works fine.

logread shows: gl-ngx-session:296: bad argument #2 to 'format' (number expected, got nil)

Root cause: in /usr/sbin/gl-ngx-session, get_nginx_port() uses: local port = conf:match('listen (%d+);') This pattern only matches "listen ;" and returns nil when /etc/nginx/conf.d/gl.conf contains "listen :;" (e.g. "listen 192.168.8.1:80;"). The nil then crashes the string.format('...%d...', port) at line 296, before password validation.

Workaround: edit gl.conf to "listen 80;" / "listen 443 ssl;" (loses interface binding) and restart nginx.

Suggested fix: make the regex capture the port in both formats, e.g. conf:match('listen [%d.:%[%]]*:?(%d+)') so it works whether or not an IP/interface prefix is present.

Hi

Thank you for the feedback.

We have received similar reports in the past. However, we found that making this change would affect the behavior of some other components.

As a result, we have not yet merged the change into the firmware. It will likely require more time to identify the affected components and improve their compatibility with this modification. At the moment, however, this has a relatively low development priority.

We will discuss it further with the development team.

Sure, totally understandable.

Thanks for your reply.

1 Like