Socket Enhancer
- For end-user documentation on Socket Enhancer, see Help:Socket Enhancer.
Socket Enhancer is an LD_PRELOAD library that intercepts the bind
and connect
system calls. This library can be used for various purposes, including connecting to IPv6 link-local addresses without client support, setting the source IP for individual applications, and enabling IP_FREEBIND (for use with the AnyIP trick, as described in Snippets:Nginx geo local server address).
To do list
- Transparent proxying in conjunction with Universal Relay
- NAT64 CLAT
- The connect hook seems to actually be called when getaddrinfo() is called to connect to the DNS server. By changing the address that the call connects to, this could be used as a means to override /etc/resolv.conf. (For simplicity, we can assume that a connection is for a DNS request if and only if the socket is TCP or UDP and an attempt is made to connect to port 53 on any IP address. So don't use this feature on your recursive DNS resolver.)
- Connections to Unix domain sockets
- Improvements to the "universal link-local address mode" (e.g. changing the fixed prefix, selecting the device via other means e.g. using a dictionary or static map)
- Randomizing source IP for "ip route add local" of a /64 (or other prefix length)
- BSD-style format (fe80:x::y:y:y:y) for universal link-local mode