Have been running socat in previous FreeBSD versions as: /usr/local/bin/socat TCP-LISTEN:12345,reuseaddr,fork - On FreeBSD 14 (currently 14.0-p2), this process still starts (it's in the process list), but the defined port no longer has an open listener, confirmed by sockstat and by telnet.
I've noticed the following entry in the socat 1.8.0.0 release notes (http://www.dest-unreach.org/socat/CHANGES): configure option --enable-default-ipv allows to specify at build time if IPv4, IPv6, or none of these is the preferred default; this is related to environment variables SOCAT_PREFERRED_RESOLVE_IP and SOCAT_DEFAULT_LISTEN_IP, and to Socat option -4, -6. Furthermore, mechanism of IPv4 vs.IPv6 selection has been reworked. When no IP version is preferred by these mechanism, passive Socat addresses (LISTEN, RECV, RECVFROM) default to IPv6 because it might support both versions (but checkout option ipv6-v6only). For client addresses, when one of these mechanisms applies and name resolution gives addresses of both IP versions, the addresses of the preferred versions are tried first. Sure enough by default socat now binds to IPv6: Running $ /usr/local/bin/socat TCP-LISTEN:12345,reuseaddr,fork - Different terminal shows: $ sockstat -46l | grep 12345 root socat 15152 5 tcp6 *:12345 *:* Sending data: $ echo foo | nc -6 -v -w2 ::1 12345 Connection to ::1 12345 port [tcp/*] succeeded! You can specify -4 to explicitly listen to IPv4: $ /usr/local/bin/socat -4 TCP-LISTEN:12345,reuseaddr,fork - ... $ sockstat -46l | grep 12345 root socat 17447 5 tcp4 *:12345 *:* $ echo foo | nc -4 -v -w2 0 12345 Connection to 0 12345 port [tcp/*] succeeded! This seems like a POLA violation to me. I am going patch the port.
Ah yes, good one. Both machines are indeed dual stack, but I specifically use socat on the IPv4 address, and would have expected socat to simply bind to both stacks, which it either did by default on FreeBSD 13, or it stopped doing because of the version upgrade in socat itself.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4c6bb66915d405ad49d3d843c6fdd2857e9371c8 commit 4c6bb66915d405ad49d3d843c6fdd2857e9371c8 Author: Emanuel Haupt <ehaupt@FreeBSD.org> AuthorDate: 2023-12-09 11:48:40 +0000 Commit: Emanuel Haupt <ehaupt@FreeBSD.org> CommitDate: 2023-12-09 11:48:44 +0000 net/socat: Add configurable IPv4/IPv6 preference option In socat version 1.8.0.0, a new feature was introduced allowing users to configure the default IP version preference at build time using the `--enable-default-ipv` option. This change resulted in a default preference for IPv6, which led to unexpected behavior for some users. To address this, a new option has been added to the FreeBSD port of socat. By default, the port restores the previous behavior where IPv4 is preferred. However, users now have the option to explicitly specify a preference for IPv6 if desired. This change aims to align with the Principle of Least Astonishment (POLA) and provide users with flexibility in choosing their preferred IP version. PR: 275653 (based on) net/socat/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Thanks, Emanuel!
Thanks for the PR!
*** Bug 277343 has been marked as a duplicate of this bug. ***