Blame SOURCES/python-ethtool-0.6-make-pifconfig-output-all-ipv4-addresses-for-interface.patch

1c5055
--- python-ethtool-0.6/pifconfig.py.orig	2013-08-07 17:11:51.483883885 +0200
1c5055
+++ python-ethtool-0.6/pifconfig.py	2013-08-07 17:20:31.004075388 +0200
1c5055
@@ -14,7 +14,7 @@
1c5055
 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1c5055
 #   General Public License for more details.
1c5055
 
1c5055
-import getopt, ethtool, sys
1c5055
+import getopt, ethtool, socket, struct, sys
1c5055
 from optparse import OptionParser
1c5055
 
1c5055
 def flags2str(flags):
1c5055
@@ -54,18 +54,23 @@
1c5055
 
1c5055
 	return string.strip()
1c5055
 
1c5055
+def bits2netmask(bits):
1c5055
+	mask = (1<<32) - (1<<32>>bits)
1c5055
+	return socket.inet_ntoa(struct.pack(">L", mask))
1c5055
+
1c5055
 def show_config(device):
1c5055
-	ipaddr = ethtool.get_ipaddr(device)
1c5055
-	netmask = ethtool.get_netmask(device)
1c5055
+	info = ethtool.get_interfaces_info(device)[0]
1c5055
 	flags = ethtool.get_flags(device)
1c5055
 	print '%-9.9s' % device,
1c5055
 	if not (flags & ethtool.IFF_LOOPBACK):
1c5055
-		print "HWaddr %s" % ethtool.get_hwaddr(device),
1c5055
-	print '''
1c5055
-          inet addr:%s''' % ipaddr,
1c5055
-	if not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
1c5055
-		print "Bcast:%s" % ethtool.get_broadcast(device),
1c5055
-	print '  Mask:%s' % netmask
1c5055
+		print "HWaddr %s" % ethtool.get_hwaddr(device)
1c5055
+	else:
1c5055
+		print
1c5055
+	for addr in info.get_ipv4_addresses():
1c5055
+		print '          inet addr:%s' % addr.address,
1c5055
+		if not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
1c5055
+			print "Bcast:%s" % ethtool.get_broadcast(device),
1c5055
+		print '  Mask:%s' % bits2netmask(addr.netmask)
1c5055
 	for info in ethtool.get_interfaces_info(device):
1c5055
 		for addr in info.get_ipv6_addresses():
1c5055
 			print ("	  inet6 addr: %s/%s Scope: %s"