Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions python/vyos/vpp/control_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from subprocess import run
from time import sleep

from pyroute2 import IPRoute

from vyos.vpp.utils import EthtoolGDrvinfo


Expand Down Expand Up @@ -361,3 +363,13 @@ def set_status(iface_name: str, status: str) -> None:
status (str): status - "up" or "down"
"""
run(['ip', 'link', 'set', iface_name, status])


def flush_ip(iface_name: str) -> None:
"""Flush IP addresses from an interface

Args:
iface_name (str): name of an interface
"""
iproute = IPRoute()
iproute.flush_addr(label=iface_name)
2 changes: 2 additions & 0 deletions src/conf_mode/vpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,15 @@ def apply(config):
if 'promisc' in iface_config['xdp_options']:
control_host.set_promisc(f'defunct_{iface}', 'on')
control_host.set_status(f'defunct_{iface}', 'up')
control_host.flush_ip(f'defunct_{iface}')
# Rename Mellanox interfaces to hide them and create LCP properly
if (
iface in Section.interfaces()
and control_host.get_eth_driver(iface) == 'mlx5_core'
):
control_host.rename_iface(iface, f'defunct_{iface}')
control_host.set_status(f'defunct_{iface}', 'up')
control_host.flush_ip(f'defunct_{iface}')
# Create lcp
if iface not in Section.interfaces():
vpp_control.lcp_pair_add(iface, iface)
Expand Down