net.c: Fix IPv4/IPv6 selection in outgoing UDP messages