I have an ipv4 server that only accepts connections over localhost (using INADDR_LOOPBACK). I'd like to convert this server to be dual-stack ipv6/ipv4. However, using in6addr_loopback only accepts connections to ::1.
I've found that I can accept ipv4 and ipv6 connections simultaneously using in6addr_any, but as this also allows connections from anywhere it's not useful for my particular case.
Is it possible to bind to ipv6 localhost (::1) and ipv4 localhost (127.0.0.1) simultaneously?