summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2026-07-09 14:21:05 +0100
committerGitHub <noreply@github.com>2026-07-09 14:21:05 +0100
commitc5e0d76021bf0cd08b2866928c4b171cbe5983e0 (patch)
tree76c3c5323820fc1f34dcec531b152629fa6e31d6
parenta56d9ff03bafa60fd1ab35213d66809468b3e740 (diff)
parentadf91e3731f0a34b5a28add2da7a5912af2161b7 (diff)
downloadvyos-1x-c5e0d76021bf0cd08b2866928c4b171cbe5983e0.tar.gz
vyos-1x-c5e0d76021bf0cd08b2866928c4b171cbe5983e0.zip
Merge pull request #5317 from natali-rs1985/T9062
vpp: T9062: Enable DHCP/DHCPv6 client detection on VLAN sub-interfaces
-rwxr-xr-xsmoketest/scripts/cli/test_vpp.py53
-rwxr-xr-xsrc/conf_mode/interfaces_ethernet.py40
2 files changed, 79 insertions, 14 deletions
diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py
index 7813dfdf5..35150a74a 100755
--- a/smoketest/scripts/cli/test_vpp.py
+++ b/smoketest/scripts/cli/test_vpp.py
@@ -210,6 +210,59 @@ class TestVPP(VyOSUnitTestSHIM.TestCase):
)
self.assertTrue(icmpv6_ra_punt_feature.is_enabled)
+ # DHCP/DHCPv6 must also work on VLAN sub-interfaces
+ vlan = '10'
+ vif_interface = f'{interface}.{vlan}'
+ self.cli_set(
+ ['interfaces', 'ethernet', interface, 'vif', vlan, 'address', 'dhcp']
+ )
+ self.cli_set(
+ ['interfaces', 'ethernet', interface, 'vif', vlan, 'address', 'dhcpv6']
+ )
+ self.cli_commit()
+
+ # check 'ip4-dhcp-client-detect' feature is enabled
+ vif_client_detect_feature = vpp.api.feature_is_enabled(
+ sw_if_index=vpp.get_sw_if_index(vif_interface),
+ feature_name='ip4-dhcp-client-detect',
+ arc_name='ip4-unicast',
+ )
+ self.assertTrue(vif_client_detect_feature.is_enabled)
+
+ # check 'ip6-icmp-ra-punt' feature is enabled
+ # for ip6-unicast and ip6-multicast arcs
+ for arc_name in ['ip6-unicast', 'ip6-multicast']:
+ vif_icmpv6_ra_punt_feature = vpp.api.feature_is_enabled(
+ sw_if_index=vpp.get_sw_if_index(vif_interface),
+ feature_name='ip6-icmp-ra-punt',
+ arc_name=arc_name,
+ )
+ self.assertTrue(vif_icmpv6_ra_punt_feature.is_enabled)
+
+ # remove DHCP/DHCPv6 from the VLAN sub-interface
+ self.cli_delete(['interfaces', 'ethernet', interface, 'vif', vlan, 'address'])
+ self.cli_commit()
+
+ # check 'ip4-dhcp-client-detect' feature is disabled
+ vif_client_detect_feature = vpp.api.feature_is_enabled(
+ sw_if_index=vpp.get_sw_if_index(vif_interface),
+ feature_name='ip4-dhcp-client-detect',
+ arc_name='ip4-unicast',
+ )
+ self.assertFalse(vif_client_detect_feature.is_enabled)
+
+ # check 'ip6-icmp-ra-punt' feature is disabled
+ for arc_name in ['ip6-unicast', 'ip6-multicast']:
+ vif_icmpv6_ra_punt_feature = vpp.api.feature_is_enabled(
+ sw_if_index=vpp.get_sw_if_index(vif_interface),
+ feature_name='ip6-icmp-ra-punt',
+ arc_name=arc_name,
+ )
+ self.assertFalse(vif_icmpv6_ra_punt_feature.is_enabled)
+
+ # cleanup: delete the VLAN sub-interface
+ self.cli_delete(['interfaces', 'ethernet', interface, 'vif', vlan])
+
def test_02_vpp_vxlan(self):
vxlan_path = interfaces_path + ['vxlan']
vni = '23'
diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py
index 1368f2c6e..40b7843be 100755
--- a/src/conf_mode/interfaces_ethernet.py
+++ b/src/conf_mode/interfaces_ethernet.py
@@ -455,20 +455,32 @@ def apply(ethernet):
if vpp_iface_config is not None and is_systemd_service_running('vpp.service'):
vpp_api = VPPControl()
- # Enable ip4-dhcp-client-detect feature for DHCP-configured interfaces.
- # This feature is required for VPP to process DHCP packets and assign addresses.
- if 'dhcp' in ethernet.get('address', []):
- vpp_api.enable_dhcp_client(ifname)
- else:
- vpp_api.disable_dhcp_client(ifname)
-
- # Enable ip6-icmp-ra-punt feature for DHCPv6-configured interfaces.
- if 'dhcpv6' in ethernet.get('address', []) or (
- 'autoconf' in ethernet.get('ipv6', {}).get('address', {})
- ):
- vpp_api.enable_icmpv6_ra_punt(ifname)
- else:
- vpp_api.disable_icmpv6_ra_punt(ifname)
+ # Enable ip4-dhcp-client-detect/ip6-icmp-ra-punt features for
+ # DHCP/DHCPv6/autoconf-configured interfaces. These features are
+ # required for VPP to process DHCP(v6) packets and assign addresses.
+ # Applies to the interface itself and its VLAN sub-interfaces
+ # (vif, vif_s).vif-c (Q-in-Q) is intentionally excluded, as it is
+ # not currently functional under VPP.
+ dhcp_targets = [(ifname, ethernet)]
+ dhcp_targets += [
+ (vif['ifname'], vif) for vif in ethernet.get('vif', {}).values()
+ ]
+ dhcp_targets += [
+ (vif_s['ifname'], vif_s) for vif_s in ethernet.get('vif_s', {}).values()
+ ]
+
+ for dhcp_ifname, dhcp_config in dhcp_targets:
+ if 'dhcp' in dhcp_config.get('address', []):
+ vpp_api.enable_dhcp_client(dhcp_ifname)
+ else:
+ vpp_api.disable_dhcp_client(dhcp_ifname)
+
+ if 'dhcpv6' in dhcp_config.get('address', []) or (
+ 'autoconf' in dhcp_config.get('ipv6', {}).get('address', {})
+ ):
+ vpp_api.enable_icmpv6_ra_punt(dhcp_ifname)
+ else:
+ vpp_api.disable_icmpv6_ra_punt(dhcp_ifname)
# If the interface is managed by the VPP DPDK driver, synchronize runtime
# parameters between Linux and the corresponding VPP LCP interface