diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-03 11:57:29 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-02-03 11:57:29 +0200 |
| commit | 5299c50f2e85c9e4c3cbf28ac9cf31cd7d10a896 (patch) | |
| tree | 591bf531e42520490457af7c00db81e243214478 | |
| parent | e31c302a024720da060889ea98eaf8d4069613fd (diff) | |
| download | vyos-1x-5299c50f2e85c9e4c3cbf28ac9cf31cd7d10a896.tar.gz vyos-1x-5299c50f2e85c9e4c3cbf28ac9cf31cd7d10a896.zip | |
vpp: T8207: Enable ip6-icmp-ra-punt feature on interfaces with DHCPv6 address configured
| -rw-r--r-- | python/vyos/vpp/control_vpp.py | 41 | ||||
| -rwxr-xr-x | smoketest/scripts/cli/test_vpp.py | 24 | ||||
| -rwxr-xr-x | src/conf_mode/interfaces_ethernet.py | 8 |
3 files changed, 71 insertions, 2 deletions
diff --git a/python/vyos/vpp/control_vpp.py b/python/vyos/vpp/control_vpp.py index 18ec349bc..91b682360 100644 --- a/python/vyos/vpp/control_vpp.py +++ b/python/vyos/vpp/control_vpp.py @@ -525,3 +525,44 @@ class VPPControl: sw_if_index=self.get_sw_if_index(ifname), enable=False, ) + + @_Decorators.api_call + def enable_icmpv6_ra_punt(self, ifname: str) -> None: + """Enable ip6-icmp-ra-punt feature on a given interface for both ip6-unicast and ip6-multicast arcs. + + This ensures that IPv6 ICMP Router Advertisements (RA) are punted to the host, which is typically required + for features such as DHCPv6 client operation. + + Args: + ifname (str): name of an interface in kernel + """ + iface_index = self.get_sw_if_index(ifname) + for arc_name in ['ip6-unicast', 'ip6-multicast']: + feature_is_enabled = self.__vpp_api_client.api.feature_is_enabled( + sw_if_index=iface_index, + feature_name='ip6-icmp-ra-punt', + arc_name=arc_name, + ) + + if not feature_is_enabled.is_enabled: + self.__vpp_api_client.api.feature_enable_disable( + sw_if_index=iface_index, + enable=True, + arc_name=arc_name, + feature_name='ip6-icmp-ra-punt', + ) + + @_Decorators.api_call + def disable_icmpv6_ra_punt(self, ifname: str) -> None: + """Disable ip6-icmp-ra-punt feature on a given interface + + Args: + ifname (str): name of an interface in kernel + """ + for arc_name in ['ip6-unicast', 'ip6-multicast']: + self.__vpp_api_client.api.feature_enable_disable( + sw_if_index=self.get_sw_if_index(ifname), + enable=False, + arc_name=arc_name, + feature_name='ip6-icmp-ra-punt', + ) diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index 8923b8f2c..6166b427a 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -180,9 +180,29 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.cli_set(['interfaces', 'ethernet', interface, 'address', 'dhcp']) self.cli_commit() + vpp = VPPControl() + # check 'ip4-dhcp-client-detect' feature is enabled on interface - _, out = rc_cmd(f'sudo vppctl show interface features {interface}') - self.assertIn(f'ip4-dhcp-client-detect', out) + client_detect_feature = vpp.api.feature_is_enabled( + sw_if_index=vpp.get_sw_if_index(interface), + feature_name='ip4-dhcp-client-detect', + arc_name='ip4-unicast', + ) + self.assertTrue(client_detect_feature.is_enabled) + + # set interface address as dhcpv6 + self.cli_set(['interfaces', 'ethernet', interface, 'address', 'dhcpv6']) + self.cli_commit() + + # check 'ip6-icmp-ra-punt' feature is enabled on interface + # for ip6-unicast and ip6-multicast arcs + for arc_name in ['ip6-unicast', 'ip6-multicast']: + icmpv6_ra_punt_feature = vpp.api.feature_is_enabled( + sw_if_index=vpp.get_sw_if_index(interface), + feature_name='ip6-icmp-ra-punt', + arc_name=arc_name, + ) + self.assertTrue(icmpv6_ra_punt_feature.is_enabled) def test_02_vpp_vxlan(self): vni = '23' diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py index f01de48a1..554f0fa41 100755 --- a/src/conf_mode/interfaces_ethernet.py +++ b/src/conf_mode/interfaces_ethernet.py @@ -458,6 +458,14 @@ def apply(ethernet): 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) + # If the interface is managed by the VPP DPDK driver, synchronize runtime # parameters between Linux and the corresponding VPP LCP interface # Find LCP pair |
