Fix IP/CIDR matching in Pillar

These commits collectively fix #5059 by using the **ipv4** grain to get the minion's IP addresses.

Additionally, they consolidate several functions from salt/modules/network.py (the Linux/UNIX/BSD **network** module), so that the code can be re-used to add these missing functions to salt/modules/win_network.py and enable IP/CIDR matching on Windows minions.