Blame SOURCES/0001-Fix-issue-when-interface-has-no-IPv4-address-assigne.patch

bf5d2c
From d51756af3dafa2d09ed8f351a48431333318ba31 Mon Sep 17 00:00:00 2001
bf5d2c
From: Lumir Balhar <lbalhar@redhat.com>
bf5d2c
Date: Wed, 7 Nov 2018 11:54:43 +0100
bf5d2c
Subject: [PATCH] Fix issue when interface has no IPv4 address assigned.
bf5d2c
bf5d2c
---
bf5d2c
 scripts/pifconfig | 19 +++++++++++++------
bf5d2c
 1 file changed, 13 insertions(+), 6 deletions(-)
bf5d2c
 mode change 100755 => 100644 scripts/pifconfig
bf5d2c
bf5d2c
diff --git a/scripts/pifconfig b/scripts/pifconfig
bf5d2c
old mode 100755
bf5d2c
new mode 100644
bf5d2c
index d1bcdb4..f2b0707
bf5d2c
--- a/scripts/pifconfig
bf5d2c
+++ b/scripts/pifconfig
bf5d2c
@@ -60,16 +60,23 @@ def flags2str(flags):
bf5d2c
 
bf5d2c
 
bf5d2c
 def show_config(device):
bf5d2c
-    ipaddr = ethtool.get_ipaddr(device)
bf5d2c
-    netmask = ethtool.get_netmask(device)
bf5d2c
+    try:
bf5d2c
+        ipaddr = ethtool.get_ipaddr(device)
bf5d2c
+        netmask = ethtool.get_netmask(device)
bf5d2c
+        broadcast = ethtool.get_broadcast(device)
bf5d2c
+    except (IOError, OSError):
bf5d2c
+        ipaddr, netmask, broadcast = None, None, None
bf5d2c
     flags = ethtool.get_flags(device)
bf5d2c
     print('%s' % device)
bf5d2c
     if not (flags & ethtool.IFF_LOOPBACK):
bf5d2c
         print('\tHWaddr %s' % ethtool.get_hwaddr(device))
bf5d2c
-    print('\tinet addr:%s' % ipaddr)
bf5d2c
-    if not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
bf5d2c
-        print('\tBcast:%s' % ethtool.get_broadcast(device))
bf5d2c
-    print('\tMask:%s' % netmask)
bf5d2c
+    if ipaddr is not None:
bf5d2c
+        print('\tinet addr:%s' % ipaddr)
bf5d2c
+    if broadcast is not None and \
bf5d2c
+       not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
bf5d2c
+        print('\tBcast:%s' % broadcast)
bf5d2c
+    if netmask is not None:
bf5d2c
+        print('\tMask:%s' % netmask)
bf5d2c
     for info in ethtool.get_interfaces_info(device):
bf5d2c
         for addr in info.get_ipv6_addresses():
bf5d2c
             print('\tinet6 addr: %s/%s Scope: %s'
bf5d2c
-- 
bf5d2c
2.19.1
bf5d2c