config: Do not compare for duplicate ORPorts with different addresses
commitdfcb050bbf424b6e72acb1bccd2dd99e8c96cb8c
authorDavid Goulet <dgoulet@torproject.org>
Thu, 11 Feb 2021 21:14:56 +0000 (11 16:14 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Fri, 12 Feb 2021 18:13:43 +0000 (12 13:13 -0500)
treef04f0978024f7358999fbfda68fc80ad039c92ec
parent80b33ae1ca148753558afa7bc8b43ba3df6d7948
config: Do not compare for duplicate ORPorts with different addresses

We were just looking at the family which is not correct because it is possible
to have two explicit ORPort for the same family but different addresses. One
example is:

  ORPort 127.0.0.1:9001 NoAdvertise
  ORPort 1.2.3.4:9001 NoListen

Thus, this patch now ignores ports that have different addresses iff they are
both explicits. That is, if we have this example, also two different
addresses:

  ORPort 9001
  ORPort 127.0.0.1:9001 NoAdvertise

The first one is implicit and second one is explicit and thus we have to
consider them for removal which in this case would remove the "ORPort 9001" in
favor of the second port.

Fixes #40289

Signe-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40289 [new file with mode: 0644]
src/feature/relay/relay_config.c