Check whitelists before checking DNS

This change is a slight performance improvement, as well as a bug
fix for the case where an IP address is in the whitelist.  Basically,
the whitelist should always be checked before any run of DNS queries.