Fix bug where lookup_subnet_ipv4() could go into an infinite loop.