diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-07-08 16:20:29 +0300 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-07-09 12:26:19 +0300 |
| commit | adf91e3731f0a34b5a28add2da7a5912af2161b7 (patch) | |
| tree | 481aefa83253541a031467a14872c42740f8f4fe /src | |
| parent | 6f2b5a12e29deb46c9a724f8405d9b4f67e6420f (diff) | |
| download | vyos-1x-adf91e3731f0a34b5a28add2da7a5912af2161b7.tar.gz vyos-1x-adf91e3731f0a34b5a28add2da7a5912af2161b7.zip | |
vpp: T9062: Enable DHCP/DHCPv6 client detection on VLAN sub-interfaces
The 'ip4-dhcp-client-detect' and 'ip6-icmp-ra-punt' VPP features were only
ever enabled on the base ethernet interface, so DHCP and DHCPv6 clients
never worked on VLAN sub-interfaces (vif/vif-s) of a VPP-managed interface.
Apply the same feature toggles to each vif/vif-s using its own address
configuration. vif-c is intentionally excluded, as Q-in-Q sub-interfaces
are not currently functional under VPP.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/interfaces_ethernet.py | 40 |
1 files changed, 26 insertions, 14 deletions
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 |
