sonic-buildimage/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2

39 lines
1.5 KiB
Plaintext
Raw Normal View History

{# Append DHCPv6 agent #}
{% set relay_for_ipv6 = { 'flag': False } %}
[program:isc-dhcpv6-relay-{{ v6_vlan_list|join("-") }}]
command=/usr/sbin/dhcrelay -d -6 --name-alias-map-file /tmp/port-name-alias-map.txt
{#- We get all DHCPv6 servers only once #}
{%- set dhcpv6_server_list = [] %}
{%- for vlan_name in v6_vlan_list %}
{%- for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %}
{%- if dhcpv6_server | ipv6 and dhcpv6_server not in dhcpv6_server_list %}
{%- set _dummy = dhcpv6_server_list.append( dhcpv6_server ) %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{#- We treat each VLAN as a downstream interface (-l), as we only want to listen for requests #}
{%- for vlan_name in v6_vlan_list %} -l {{ vlan_name }}{% endfor -%}
{#- We treat all other interfaces as upstream interfaces (-u), as we only want to listen for replies #}
{%- for dhcpv6_server in dhcpv6_server_list %}
{%- if dhcpv6_server | ipv6 %}
{%- for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
{%- if prefix | ipv6 and name not in v6_vlan_list%} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
{% endfor %}
{% for (name, prefix) in INTERFACE|pfx_filter %}
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
{% endfor %}
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
{% endfor %}
{% endif %}
{% endfor %}
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=start:exited