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

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