Skip to content

Commit

Permalink
[dhcp_relay]:filter out the ipv6 address of dhcp server for dhcp rela… (
Browse files Browse the repository at this point in the history
#3397)

* [dhcp_relay]:filter out the ipv6 address of dhcp server for dhcp relay(v4) config file.

Signed-off-by: wangshengjun <wangshengjun@asterfusion.com>
  • Loading branch information
wangshengjun authored and lguohan committed Sep 6, 2019
1 parent ca43dad commit 9fdc6bd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ isc-dhcp-relay-{{ vlan_name }}


{# Create a program entry for each DHCP relay agent instance #}
{% set relay_for_ipv4 = { 'flag': False } %}
{% for vlan_name in VLAN %}
{% if VLAN[vlan_name]['dhcp_servers'] %}
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
{% if dhcp_server | ipv4 %}
{% set _dummy = relay_for_ipv4.update({'flag': True}) %}
{% endif %}
{% endfor %}
{% if relay_for_ipv4.flag %}
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
[program:isc-dhcp-relay-{{ vlan_name }}]
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }}
Expand All @@ -58,14 +66,17 @@ command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /t
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
{% endfor %}
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %}
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
{%- if dhcp_server | ipv4 %} {{ dhcp_server }}{% endif -%}
{% endfor %}

priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Expand Down

0 comments on commit 9fdc6bd

Please sign in to comment.