summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig.py
diff options
context:
space:
mode:
authorRunar Borge <runar@borge.nu>2020-02-13 22:54:11 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-14 05:06:38 +0100
commitdbc186526c4c470e1639dc6484cc697f16a91328 (patch)
treefc54d2ffceda5e995b0d4526368063b1cab99325 /python/vyos/ifconfig.py
parent6ec5e8cf0b7596c96be0eecea2c3c4e4b20212ca (diff)
downloadvyos-1x-dbc186526c4c470e1639dc6484cc697f16a91328.tar.gz
vyos-1x-dbc186526c4c470e1639dc6484cc697f16a91328.zip
T2034: Disallow removal of default loopback addresses
The removal of interfaces loopback lo results in all address being removed from the loopback interface. (also not cli controlled addresses) In this process 127.0.0.1/8 and ::1/128 are also removed witch results in error for services that are dependent on these adresses, this includes eg. snmp and ssh Removal of these addresses needs to be disallowed by the config backend and removal of the whole config block interfaces loopback lo needs to result in removal of all non-default addresses only.
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r--python/vyos/ifconfig.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 52eab5717..e5f50130f 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -826,6 +826,9 @@ class LoopbackIf(Interface):
"""
# remove all assigned IP addresses from interface
for addr in self.get_addr():
+ if addr in ["127.0.0.1/8", "::1/128"]:
+ # Do not allow deletion of the default loopback addresses
+ continue
self.del_addr(addr)
# question: do we also delerte the loopback address? 127.0.0.1/8