Test fix in 637f317c6d9c, verifying that when ports run out, we get
an EADDRNOTAVAIL error from bind() rather than an EADDRINUSE error
from connect(). Use small port range to exhaust ports and see which
error happens.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Nit: it may be worth considering using some of the https://cgit.freebsd.org/src/tree/tests/sys/net/routing/test_rtsock_lladdr.c infra, which spawns/destroys VNET jail on per-test basis.
This approach avoids all sysctl side effects and removes the need to save/restore sysctl variables.
Thanks for pointing out the jail support for routing tests. If I were starting from scratch, I would certainly consider it. However, having already gotten this working with sysctl save/restore, I'm not sure there is much win in switching. The jail (and interface) setup is much heavier-weight, and I'd be concerned about what else is pulled in. As it was, tcp_connect_port_test.c was a good model for what I wanted to do.
tests/sys/netinet/Makefile | ||
---|---|---|
18–19 | Since you decided not go to with VNETs and modify global sysctls, you should add: TEST_METADATA.tcp6_v4mapped_bind_test+= is_exclusive="true" Otherwise later some other test may start to fail randomly in massive testing runs and it is going to be hard to figure our why. |
tests/sys/netinet/Makefile | ||
---|---|---|
18–19 | Thanks, I didn't know about is_exclusive. |