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

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