diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 7f57ade4fa..1d5a9acc43 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -25,7 +25,7 @@ RUN apt-get clean -y && \ rm -rf /debs COPY ["docker-init.sh", "/usr/bin/"] -COPY ["radvd.conf.j2", "wait_for_intf.sh.j2", "docker-router-advertiser.supervisord.conf.j2", "/usr/share/sonic/templates/"] +COPY ["radvd.conf.j2", "wait_for_link.sh.j2", "docker-router-advertiser.supervisord.conf.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] diff --git a/dockers/docker-router-advertiser/docker-init.sh b/dockers/docker-router-advertiser/docker-init.sh index a38988186a..a3f373f438 100755 --- a/dockers/docker-router-advertiser/docker-init.sh +++ b/dockers/docker-router-advertiser/docker-init.sh @@ -8,10 +8,10 @@ CFGGEN_PARAMS=" \ -d \ -t /usr/share/sonic/templates/docker-router-advertiser.supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \ -t /usr/share/sonic/templates/radvd.conf.j2,/etc/radvd.conf \ - -t /usr/share/sonic/templates/wait_for_intf.sh.j2,/usr/bin/wait_for_intf.sh \ + -t /usr/share/sonic/templates/wait_for_link.sh.j2,/usr/bin/wait_for_link.sh \ " sonic-cfggen $CFGGEN_PARAMS -chmod +x /usr/bin/wait_for_intf.sh +chmod +x /usr/bin/wait_for_link.sh exec /usr/bin/supervisord diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 index 146e7c1b67..9bfc8d9220 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -26,20 +26,21 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true -{# Router advertiser should only run on ToR (T0) devices #} -{% if DEVICE_METADATA.localhost.type == "ToRRouter" %} - - {% if VLAN_INTERFACE %} - {% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} +{# Router advertiser should only run on ToR (T0) devices which have #} +{# at least one VLAN interface which has an IPv6 address asigned #} +{%- set vlan_v6 = namespace(count=0) -%} +{%- if DEVICE_METADATA.localhost.type == "ToRRouter" -%} + {%- if VLAN_INTERFACE -%} + {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} {# If this VLAN has an IPv6 address... #} - {% if prefix | ipv6 %} - {% set ipv6_found = true %} - {% endif %} - {% endfor %} - {% endif %} + {%- if prefix | ipv6 -%} + {%- set vlan_v6.count = vlan_v6.count + 1 -%} + {%- endif -%} + {%- endfor -%} + {%- endif -%} +{%- endif -%} - {# Enusre at least one ipv6 vlan interface #} - {% if ipv6_found == true %} +{%- if vlan_v6.count > 0 %} [program:wait_for_link] command=/usr/bin/wait_for_link.sh priority=3 @@ -60,6 +61,4 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=wait_for_link:exited - {% endif %} - -{% endif %} +{% endif -%} diff --git a/dockers/docker-router-advertiser/wait_for_intf.sh.j2 b/dockers/docker-router-advertiser/wait_for_link.sh.j2 similarity index 100% rename from dockers/docker-router-advertiser/wait_for_intf.sh.j2 rename to dockers/docker-router-advertiser/wait_for_link.sh.j2