]> git.ipfire.org Git - thirdparty/bind9.git/commit
Make sure the unit test listening and connecting ports are different
authorOndřej Surý <ondrej@isc.org>
Tue, 11 Oct 2022 10:03:17 +0000 (12:03 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 12 Oct 2022 13:36:25 +0000 (15:36 +0200)
commitaf257140e69d5fc2d517f67eb503a8efa19823b4
tree6969cfc856d0f291cb18f97c26996f0c9b718d03
parentb6b7a6886a8ac66bc3932158740998a3bf2da014
Make sure the unit test listening and connecting ports are different

In rare circumstances, the UDP port for the listening socket and the UDP
port for the connecting socket might be the same.  Because we use the
"reuse" port socket option, this isn't caught when binding the socket,
and thus the connected client socket could send a datagram to itself,
completely bypassing the server.  This doesn't happen under normal
operation mode because `named` is listening on a privileged port (53),
and even if not, it doesn't usually talk to itself as the tests do.

Pick an arbitrary port for listening (9153-9156) that is outside the
ephemeral port range for the network manager related unit tests (except
the `doh_test).
tests/isc/netmgr_common.c
tests/isc/netmgr_common.h
tests/isc/tcp_test.c
tests/isc/tcpdns_test.c
tests/isc/tls_test.c
tests/isc/tlsdns_test.c
tests/isc/udp_test.c