Improved logic for determining local network interface address