From 30466b27c1b096998d2e30c72f49adfb48d662e3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 6 Apr 2018 19:24:18 -0700 Subject: [PATCH] [router advertiser] Only start radvd process if device role is 'ToRRouter' (#1569) --- .../docker-router-advertiser.supervisord.conf | 1 + dockers/docker-router-advertiser/start.sh | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf index 08a3e0a948..f0bb4d5b3b 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf @@ -8,6 +8,7 @@ command=/usr/bin/start.sh priority=1 autostart=true autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index cbd5ec383b..7fcaf65a79 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -1,11 +1,18 @@ #!/usr/bin/env bash -# Generate /etc/radvd.conf config file -sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf - rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd +# Router advertiser should only run on ToR (T0) devices +DEVICE_ROLE=$(sonic-cfggen -d -v "DEVICE_METADATA.localhost.type") +if [ "$DEVICE_ROLE" != "ToRRouter" ]; then + echo "Device role is not ToRRouter. Not starting router advertiser process." + exit 0 +fi + +# Generate /etc/radvd.conf config file +sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf + # Start the router advertiser supervisorctl start radvd