diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-03-30 17:52:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 17:52:45 +0200 |
commit | adda3d86080bb3b8fe26424c7d829e40eb9e2b23 (patch) | |
tree | 519a6d51418f546cbfdf45fd1d8c0bea388f0c9a /python/vyos/ifconfig/loopback.py | |
parent | 43a3300afed5d4b4bee203d2abc741954a865ba3 (diff) | |
parent | 059095962f0a076a53f43ef24222e4afd9c9be81 (diff) | |
download | vyos-1x-adda3d86080bb3b8fe26424c7d829e40eb9e2b23.tar.gz vyos-1x-adda3d86080bb3b8fe26424c7d829e40eb9e2b23.zip |
Merge pull request #1257 from dmbaturin/T4319-lo
T4319: do not try to add ::1/128 to lo when IPv6 is disabled
Diffstat (limited to 'python/vyos/ifconfig/loopback.py')
-rw-r--r-- | python/vyos/ifconfig/loopback.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/loopback.py b/python/vyos/ifconfig/loopback.py index 768d1eaf0..de554ef44 100644 --- a/python/vyos/ifconfig/loopback.py +++ b/python/vyos/ifconfig/loopback.py @@ -1,4 +1,4 @@ -# Copyright 2019 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,6 +13,8 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see <http://www.gnu.org/licenses/>. +import vyos.util + from vyos.ifconfig.interface import Interface @Interface.register @@ -61,7 +63,10 @@ class LoopbackIf(Interface): addr = config.get('address', []) # We must ensure that the loopback addresses are never deleted from the system - addr += self._persistent_addresses + addr += ['127.0.0.1/8'] + + if (vyos.util.sysctl_read('net.ipv6.conf.all.disable_ipv6') == '0'): + addr += ['::1/128'] # Update IP address entry in our dictionary config.update({'address' : addr}) |