summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorl0crian1 <ryan.claridge13@gmail.com>2025-04-20 21:19:56 -0400
committerl0crian1 <ryan.claridge13@gmail.com>2025-04-20 21:19:56 -0400
commitf4c85539882ddb8410cca57255685b31c5be5812 (patch)
tree3b16b7753db81ee9be2c1e88bdfccca76bc3254a /src
parente4ff4b60cde75bd1f76dc2a1c05d956a7531e5a5 (diff)
downloadvyos-1x-f4c85539882ddb8410cca57255685b31c5be5812.tar.gz
vyos-1x-f4c85539882ddb8410cca57255685b31c5be5812.zip
t7268: Add op-mode command for show all interfaces on system
lo address was an edge case and needed to be handled.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/interfaces.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/op_mode/interfaces.py b/src/op_mode/interfaces.py
index 9963a9651..23ec27d5b 100755
--- a/src/op_mode/interfaces.py
+++ b/src/op_mode/interfaces.py
@@ -346,12 +346,13 @@ def _format_kernel_data(data, detail):
has_global = False
for ip in interface['addr_info']:
- if ip.get('scope') == 'global':
+ if ip.get('scope') in ('global', 'host'):
has_global = True
local = ip.get('local', '-')
prefixlen = ip.get('prefixlen', '')
ip_list.append(f"{local}/{prefixlen}")
+
# If no global IP address, add '-'; indicates no IP address on interface
if not has_global:
ip_list.append('-')