sonic-buildimage/dockers/docker-dhcp-relay/dhcp-relay.programs.j2
shlomibitton 1ebe52847a
[DHCPv6 relay] [202106] Fix DHCPv6 design to support multiple VLANS (#9163)
- Why I did it
If multiple Vlans are configured to have DHCPv6 relay, only one relay instance is able to capture DHCP packets received from upstream, this is as a result of kernel design to operate this way (SO_REUSEPORT).
DHCPv6 transmit unicast packets to clients, only multicast packets can be captured on multiple application listening on the same UDP port.
This issue causing only one Vlan interface to get packets from servers.

- How I did it
Change the design to neglect Vlan isolation and run only one relay instance serving all Vlans with all configured DHCP servers.

- How to verify it
Run DHCPv6 relay test with 2 Vlans configured do have a DHCP relay.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
2021-11-18 19:40:48 +02:00

23 lines
889 B
Django/Jinja

[group:isc-dhcp-relay]
programs=
{%- set add_preceding_comma = { 'flag': False } %}
{# Append DHCPv4 agents #}
{% if ipv4_num_relays.count > 0 %}
{% for vlan_name in VLAN_INTERFACE %}
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
{% if add_preceding_comma.flag %},{% endif %}
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
isc-dhcpv4-relay-{{ vlan_name }}
{%- endif %}
{% endfor %}
{% endif %}
{# Append DHCPv6 agent #}
{% if ipv6_num_relays.count > 0 %}
{% for vlan_name in VLAN_INTERFACE %}
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
{% set _dummy = v6_vlan_list.append( vlan_name ) %}
{%- endif %}
{% endfor %}
{% if add_preceding_comma.flag %},{% endif %}
isc-dhcpv6-relay-{{ v6_vlan_list|join("-") }}
{% endif %}