summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-11-20 16:42:34 +0100
committerChristian Poessinger <christian@poessinger.com>2022-11-20 16:42:47 +0100
commitd34240d218998b81d5ff7fbfb4afbec39bf620e9 (patch)
tree965a1506dd859d151f6a0c4641686aa61a4a610f
parentb7e203d168d5549b2e5c7d0f7168317744c1d71e (diff)
downloadvyos-1x-d34240d218998b81d5ff7fbfb4afbec39bf620e9.tar.gz
vyos-1x-d34240d218998b81d5ff7fbfb4afbec39bf620e9.zip
macvlan: pseudo-ethernet: T2104: _create() should place interface in A/D state
-rw-r--r--python/vyos/ifconfig/macvlan.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/macvlan.py b/python/vyos/ifconfig/macvlan.py
index 776014bc3..2266879ec 100644
--- a/python/vyos/ifconfig/macvlan.py
+++ b/python/vyos/ifconfig/macvlan.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 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
@@ -30,10 +30,17 @@ class MACVLANIf(Interface):
}
def _create(self):
+ """
+ Create MACvlan interface in OS kernel. Interface is administrative
+ down by default.
+ """
# please do not change the order when assembling the command
cmd = 'ip link add {ifname} link {source_interface} type {type} mode {mode}'
self._cmd(cmd.format(**self.config))
+ # interface is always A/D down. It needs to be enabled explicitly
+ self.set_admin_state('down')
+
def set_mode(self, mode):
ifname = self.config['ifname']
cmd = f'ip link set dev {ifname} type macvlan mode {mode}'