ipfilter: Avoid a null if-then-else blocks
When WITHOUT_INET6 is selected we generate a null if-then-else blocks
due to incorrect placment of #if statments. Move the #if statements
reducing unnecessary runtime comparisons WITHOUT_INET6.
(cherry picked from commit 73db3b64f167972db3ee3f780cecb439b09492b1)