I have an IPv4-only UDP application listening on port 624. I created an IPv6/IPv4 front-end with socat, listening on port 625. I can now use the server's IPv4 or IPv6 address to access the IPv4-only app. Cool, so far!
socat UDP6-LISTEN:625,fork,su=nobody UDP4:localhost:624 &
After sending just one UDP message, IPv4 in the example below, I see two new long-lived processes created, one for each side of the gateway..
# lsof -i:624 -i:625 -n -P -i:625 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME myap 4296 root 4u IPv4 7845 0t64 UDP *:624 socat 28597 nobody 3u IPv6 67603 0t64 UDP 192.168.93.90:625->192.168.90.121:34091 socat 28597 nobody 4u IPv4 67882 0t64 UDP 127.0.0.1:53648->127.0.0.1:624
As you can imagine, for a busy server, the number of long-lived processes grows quickly.
How can I use socat to provide the gateway feature and have it cleanup these long-lived UDP processes?