-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker-router-advertiser to support IPv6 router advertisements (#…
- Loading branch information
Showing
7 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM docker-config-engine | ||
|
||
# Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Update apt's cache of available packages | ||
RUN apt-get update | ||
|
||
# Install radvd Debian package | ||
RUN apt-get -y install radvd | ||
|
||
{% if docker_router_advertiser_debs.strip() -%} | ||
# Copy built Debian packages | ||
{%- for deb in docker_router_advertiser_debs.split(' ') %} | ||
COPY debs/{{ deb }} debs/ | ||
{%- endfor %} | ||
|
||
# Install built Debian packages and implicitly install their dependencies | ||
{%- for deb in docker_router_advertiser_debs.split(' ') %} | ||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} | ||
{%- endfor %} | ||
{%- endif %} | ||
|
||
# Clean up | ||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
COPY ["start.sh", "/usr/bin/"] | ||
COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] | ||
COPY ["radvd.conf.j2", "/usr/share/sonic/templates/"] | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord"] |
28 changes: 28 additions & 0 deletions
28
dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[program:start.sh] | ||
command=/usr/bin/start.sh | ||
priority=1 | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:radvd] | ||
command=/usr/sbin/radvd -n | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% block banner %} | ||
# =========== Managed by sonic-cfggen -- DO NOT edit manually! ==================== | ||
# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data | ||
# File: /etc/radvd.conf | ||
# | ||
{% endblock banner %} | ||
# Config file for radvd, the router advertisement daemon | ||
# See man page for radvd.conf for descriptions of all available options | ||
# | ||
|
||
{# If our configuration has VLAN interfaces... #} | ||
{% if VLAN_INTERFACE %} | ||
{% for (name, prefix) in VLAN_INTERFACE %} | ||
{# If this VLAN has an IPv6 address... #} | ||
{% if prefix | ipv6 %} | ||
interface {{ name }} | ||
{ | ||
IgnoreIfMissing on; | ||
AdvSendAdvert on; | ||
MinRtrAdvInterval 200; | ||
MaxRtrAdvInterval 600; | ||
AdvManagedFlag on; | ||
AdvOtherConfigFlag off; | ||
AdvLinkMTU 9100; | ||
AdvHomeAgentFlag off; | ||
prefix {{ prefix | network }}/{{ prefix | prefixlen }} { | ||
AdvOnLink on; | ||
AdvAutonomous off; | ||
AdvRouterAddr off; | ||
AdvValidLifetime infinity; | ||
AdvPreferredLifetime infinity; | ||
}; | ||
}; | ||
|
||
{% endif %} | ||
{% endfor %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/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 | ||
|
||
# Start the router advertiser | ||
supervisorctl start radvd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Router advertiser container | ||
Requires=docker.service | ||
After=swss.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start | ||
ExecStart=/usr/bin/{{ docker_container_name }}.sh attach | ||
ExecStop=/usr/bin/{{ docker_container_name }}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Docker image for router advertiser | ||
|
||
DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz | ||
$(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser | ||
$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) | ||
SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) | ||
|
||
|
||
$(DOCKER_ROUTER_ADVERTISER)_CONTAINER_NAME = radv | ||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += --net=host --privileged -t | ||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro |