summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-30 22:46:41 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-30 22:47:11 +0200
commitf8aab22927274ab6ba210be946b368f27ee75582 (patch)
treef8af96a1b4334a52eaf9a100213011b76f7bcceb /python
parentff05e2a90edf8af5d7b8ad5c69cae2dd40af2c8d (diff)
downloadvyos-1x-f8aab22927274ab6ba210be946b368f27ee75582.tar.gz
vyos-1x-f8aab22927274ab6ba210be946b368f27ee75582.zip
Python/ifconfig: remove ipv4/ipv6 handling, iproute2 autodetects addr family
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 5f28125af..987f0b13e 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -326,12 +326,7 @@ class Interface:
raise ValueError('No IP address specified')
if not is_intf_addr_assigned(self._ifname, addr):
- cmd = ''
- if is_ipv4(addr):
- cmd = 'sudo ip -4 addr add "{}" broadcast + dev "{}"'.format(addr, self._ifname)
- elif is_ipv6(addr):
- cmd = 'sudo ip -6 addr add "{}" dev "{}"'.format(addr, self._ifname)
-
+ cmd = 'sudo ip addr add "{}" dev "{}"'.format(addr, self._ifname)
self._cmd(cmd)
@@ -355,12 +350,7 @@ class Interface:
raise ValueError('No IP address specified')
if is_intf_addr_assigned(self._ifname, addr):
- cmd = ''
- if is_ipv4(addr):
- cmd = 'ip -4 addr del "{}" dev "{}"'.format(addr, self._ifname)
- elif is_ipv6(addr):
- cmd = 'ip -6 addr del "{}" dev "{}"'.format(addr, self._ifname)
-
+ cmd = 'ip addr del "{}" dev "{}"'.format(addr, self._ifname)
self._cmd(cmd)