make the ipv4 subnet matching code work like the ipv6 code, fixes bug in subnet matching on tun interfaces (cherry picked from commit 07d2354a) (cherry picked from commit b3bad8d2)