From 91b7258643933f71646c1376e8acecb334dfb3d2 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Sun, 31 May 2015 18:44:46 +0200 Subject: [PATCH] get_net_start IP agnostic --- salt/utils/network.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/salt/utils/network.py b/salt/utils/network.py index c07701d9d1..a7a73ceadb 100644 --- a/salt/utils/network.py +++ b/salt/utils/network.py @@ -756,11 +756,11 @@ def interfaces(): def get_net_start(ipaddr, netmask): - ipaddr_octets = ipaddr.split('.') - netmask_octets = netmask.split('.') - net_start_octets = [str(int(ipaddr_octets[x]) & int(netmask_octets[x])) - for x in range(0, 4)] - return '.'.join(net_start_octets) + ''' + Return the address of the network + ''' + net = ipaddress.ip_network('{0}/{1}'.format(ipaddr, netmask), strict=False) + return str(net.network_address) def get_net_size(mask):