GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

port: Don't ignore ports of a different family

Commit c3a0f757 added this feature for ORPort
that we ignore any port that is not the family of our default address when
parsing the port. So if port_parse_config() was called with an IPv4 default
address, all IPv6 address would be ignored.

That makes sense for ORPort since we call twice port_parse_config() for
0.0.0.0 and [::] but for the rest of the ports, it is not good since a
perfectly valid configuration can be:

  SocksPort 9050
  SocksPort [::1]:9050

Any non-ORPort only binds by default to an IPv4 except the ORPort that binds
to both IPv4 and IPv6 by default.

The fix here is to always parse all ports within port_parse_config() and then,
specifically for ORPort, remove the duplicates or superseding ones. The
warning is only emitted when a port supersedes another.

A unit tests is added to make sure SocksPort of different family always exists
together.

Fixes #40183

Signed-off-by: David Goulet <dgoulet@torproject.org>
9 jobs for ticket40183_045_01 in 132 minutes and 12 seconds (queued for 175 minutes and 3 seconds)
latest
Status Job ID Name Coverage
  Test
failed #5413
debian-disable-dirauth

00:06:00

failed #5414
debian-disable-relay

00:09:59

failed #5409
debian-distcheck

00:11:06

passed #5410
debian-docs

00:24:50

failed #5408
debian-hardened

00:18:14

passed #5411
debian-integration

00:28:15

failed #5407
debian-minimal

00:10:27

failed #5415
debian-nss

00:10:10

failed #5412
debian-tracing

00:13:05

 
Name Stage Failure
failed
debian-nss Test
FAIL src/test/unittest_part3.sh (exit status: 1)

FATAL ERROR: Failed tests: check
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 2 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5415 responseStatus=201 Created token=GxGskz2F
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-disable-relay Test
SKIP src/test/test_include.sh (exit status: 77)

FATAL ERROR: Failed tests: check
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 2 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5414 responseStatus=201 Created token=ZwPyniob
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-disable-dirauth Test
FAIL src/test/unittest_part3.sh (exit status: 1)

FATAL ERROR: Failed tests: check
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 2 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5413 responseStatus=201 Created token=6GBVwFMw
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-tracing Test
make: *** [Makefile:25705: show-distdir-core] Error 127
ERROR: command 'make show-distdir-core' has failed.
FATAL ERROR: Unable to continue.
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 1 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5412 responseStatus=201 Created token=jsyiTzr1
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-distcheck Test
make: *** [Makefile:25705: show-distdir-core] Error 127
ERROR: command 'make show-distdir-core' has failed.
FATAL ERROR: Unable to continue.
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 1 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5409 responseStatus=201 Created token=sym51t3h
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-hardened Test
FAIL src/test/unittest_part3.sh (exit status: 1)

FATAL ERROR: Failed tests: check
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 2 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5408 responseStatus=201 Created token=YNaTJzze
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
debian-minimal Test
FAIL src/test/unittest_part3.sh (exit status: 1)

FATAL ERROR: Failed tests: check
Uploading artifacts for failed job
Uploading artifacts...
artifacts/: found 2 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=5407 responseStatus=201 Created token=ZH-L_a7E
Cleaning up file based variables
ERROR: Job failed: exit code 1