Bug 15622 - Cannot connect to ipv6 socket from Legacy IP
Summary: Cannot connect to ipv6 socket from Legacy IP
Status: NEW
Alias: None
Product: cwrap
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-05 19:29 UTC by David Woodhouse
Modified: 2024-04-05 19:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Woodhouse 2024-04-05 19:29:35 UTC
This works...

 $ socat -dd tcp-listen:4444 stdio

 $ socat -dd stdio tcp-connect:127.0.0.1:4444

The first socat listens on [::] and because the IPV6_V6ONLY sockopt isn't set, accepts the Legacy IP connection from the second socat.

This *doesn't* work (libsocket_wrapper 1.4.0-3.fc39 x86_64): 

 $ mkdir -p /tmp/sw
 $ export SOCKET_WRAPPER_DIR=/tmp/sw
 $ export SOCKET_WRAPPER_DEFAULT_IFACE=2

 $ LD_PRELOAD=/usr/lib64/libsocket_wrapper.so socat -dd tcp-listen:4444 stdio
2024/04/05 20:23:46 socat[2070554] N listening on AF=10 [0000:0000:0000:0000:0000:0000:0000:0000]:4444

 $ LD_PRELOAD=/usr/lib64/libsocket_wrapper.so socat -dd stdio tcp-connect:127.0.0.2:4444


Adding '-4' to the listening socat to make it go back to before 1995, or telling the second socat to connect to [fd00:5357:5f02], both work. But that's not the point. v4-mapped connections ought to work.

This broke openconnect unit testing in an IPv6-only environment, because the client couldn't connect to the server. It also broke when socat finally joined us in the 21st century and started to listen on IPv6 by default instead of Legacy IP.

https://gitlab.com/openconnect/openconnect/-/issues/721