Skip to content

fix(ns2): give the mod server a routable address and quote parameters - #5247

Merged
dgibbs64 merged 1 commit into
developfrom
fix/ns2-modserveraddress
Nov 20, 2026
Merged

dgibbs64 merged 1 commit into
developfrom
fix/ns2-modserveraddress

Conversation

@dgibbs64

Copy link
Copy Markdown
Member

Description

Natural Selection 2 build 345 refuses to start the mod web server on 0.0.0.0 ("Mod web server needs a routable address, not 0.0.0.0 - set -modserveraddress to the address clients reach this server on"). Develop already passes -modserveraddress ${httpip}, which works on a host with one IP address. On a host with more than one address and no ip set, check_ip.sh leaves httpip at 0.0.0.0, so the mod server still fails to start.

This PR adds a pre-start fix, fix_ns2.sh. When httpip is 0.0.0.0, the fix replaces it with the source address of the default route (ip -o -4 route get 1.1.1.1). A user-set ip is not changed.

Build 345 also requires quotes around command-line values that contain -, + or ;. The -webdomain, -webuser, -modserveraddress and -map values are now quoted, to match the parameters that were already quoted. The defaults are not affected. Before this change, a custom map or web user name containing a hyphen would have broken the launch.

Known limit: details still shows 0.0.0.0 in the start parameters on multi-address hosts, because the fix only runs on start.

Related to #5241

Affected servers: ns2

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Chore (CI, workflows, tooling or other maintenance).
  • Comment update (typo, spelling, explanation, examples, etc).

Testing

  • Commands/tests run: fresh ns2server install, start, monitor and stop. First with develop on a single-address host. Then with this branch on a host given a second IPv4 address (ip addr add).
  • Result:
    • Develop, one address: the mod server and web admin start on the container address.
    • This branch, two addresses: the fix logged "web admin and mod server address 172.17.0.60". The server launched with the quoted values, and both "File Web server running at 172.17.0.60:27031" and "Web server running at 172.17.0.60:8080" appeared.
    • Both runs: monitor did not restart the server, and stop was graceful on the first CTRL+c.
    • Without this fix: on build 345, a server whose address resolves to 0.0.0.0 logs the "needs a routable address" error and the mod server port is not opened.
  • Environment used (distro/version): Ubuntu 26.04 container on a test server.

Risk and rollback

  • Risk level: low. The fix only applies to ns2server, and only when httpip is 0.0.0.0. The quoting only adds quotes.
  • Rollback plan: revert the commit.

Breaking changes

  • No breaking changes.
  • Breaking changes included (describe below).

Documentation

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue ("Fixes", or "Related to" for a partial fix).
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have provided a detailed enough description of this PR.

Thank you for your Pull Request!

Build 345 refuses to start the mod web server on 0.0.0.0. On hosts with
more than one IP address and no ip set, check_ip.sh leaves httpip at
0.0.0.0, so -modserveraddress and -webdomain get 0.0.0.0. A pre-start fix
now replaces it with the source address of the default route.

Build 345 also requires values containing -, + or ; to be quoted, so
-webdomain, -webuser, -modserveraddress and -map are now quoted.
@dgibbs64 dgibbs64 added this to the v26.7.0 milestone Nov 20, 2026
@dgibbs64 dgibbs64 self-assigned this Nov 20, 2026
@github-actions github-actions Bot added engine: spark Issues related to spark engine type: bugfix Pull request that fixes a bug game: Natural Selection 2 Issues related to Natural Selection 2 labels Nov 20, 2026
@dgibbs64
dgibbs64 merged commit c702ab3 into develop Nov 20, 2026
56 of 57 checks passed
@dgibbs64
dgibbs64 deleted the fix/ns2-modserveraddress branch November 20, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine: spark Issues related to spark engine game: Natural Selection 2 Issues related to Natural Selection 2 type: bugfix Pull request that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant