diff options
| author | Daniil Baturin <daniil@vyos.io> | 2026-07-23 15:34:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-23 15:34:03 +0100 |
| commit | b4595ff5601732610fe48ecbe8850eccb88187f5 (patch) | |
| tree | d8a0a097b8a721bfc42d67a212c52c5fec625019 /python | |
| parent | 3668d1eec819d545ec29bd56a98e22ce4775156e (diff) | |
| parent | e72de7eb3e4a6ef67a6836367f43ef363bf77e40 (diff) | |
| download | vyos-1x-b4595ff5601732610fe48ecbe8850eccb88187f5.tar.gz vyos-1x-b4595ff5601732610fe48ecbe8850eccb88187f5.zip | |
Merge pull request #5335 from natali-rs1985/T8367
vpp: T8367: Fix identical default MAC on bridged loopback interfaces
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/vpp/loopback.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/vpp/loopback.py b/python/vyos/ifconfig/vpp/loopback.py index 4d3325820..9f87781c0 100644 --- a/python/vyos/ifconfig/vpp/loopback.py +++ b/python/vyos/ifconfig/vpp/loopback.py @@ -18,6 +18,8 @@ from vyos.ifconfig import Interface from vyos.ifconfig.vpp.interface import VPPInterface +from vyos.utils.network import gen_mac +from vyos.utils.network import get_host_identity class VPPLoopbackInterface(Interface, VPPInterface): @@ -34,6 +36,7 @@ class VPPLoopbackInterface(Interface, VPPInterface): self.index = self.vpp.get_sw_if_index(self.vpp_ifname) self.state = 'up' if 'disable' not in config else 'down' + self.mac = config.get('mac') def _create(self): pass @@ -49,6 +52,13 @@ class VPPLoopbackInterface(Interface, VPPInterface): self.vpp.api.create_loopback_instance( is_specified=True, user_instance=self.instance ) + # VPP's default loopback MAC is based only on the instance + # number (de:ad:00:00:00:<instance>), so two nodes configuring the + # same instance always conflict. Otherwise, use a host-unique MAC + # so bridging a loopback as a BVI across nodes never conflicts. + if not self.mac: + self.mac = gen_mac(self.ifname, '', get_host_identity()) + self.vpp.set_iface_mac(self.vpp_ifname, self.mac) # Add LCP pair (kernel) interface self.kernel_add() # Set interface state |
