diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-03-30 19:16:52 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-03-30 19:16:52 +0200 |
commit | bafb1973d906707cb571385e994a949d0d90b645 (patch) | |
tree | 4fc8d570ffda4d743c14d24e9ed1a4643b7a5bd8 /python/vyos/ifconfig/interface.py | |
parent | c82db71fa2ce0aa0b1768c51b78e790ee291836f (diff) | |
download | vyos-1x-bafb1973d906707cb571385e994a949d0d90b645.tar.gz vyos-1x-bafb1973d906707cb571385e994a949d0d90b645.zip |
vyos.ifconfig: make add_addr() method more reader firendly
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rwxr-xr-x | python/vyos/ifconfig/interface.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 8ce851cdb..4fda1c0a9 100755 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1089,8 +1089,11 @@ class Interface(Control): elif addr == 'dhcpv6': self.set_dhcpv6(True) elif not is_intf_addr_assigned(self.ifname, addr): - self._cmd(f'ip addr add "{addr}" ' - f'{"brd + " if addr_is_v4 else ""}dev "{self.ifname}"') + tmp = f'ip addr add {addr} dev {self.ifname}' + # Add broadcast address for IPv4 + if is_ipv4(addr): tmp += ' brd +' + + self._cmd(tmp) else: return False |