-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker-router-advertiser to support IPv6 router advertisements #1103
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
518e773
Initial commit of router advertiser docker files
jleveque 5c80686
Add radvd.conf.j2 template; Run radvd in foreground; Rename superviso…
jleveque 59b0e78
Add MTU length to router advertisement message
jleveque de01a4e
Shorten docker container name to 'radv'
jleveque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply similiar rule as this commit?
a69b353
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the referenced commit, the MTU is specified in the ConfigDB on a port-by-port basis, and is looked up in the PORT table by port name. However, we do not currently store the MTU length for VLAN interfaces in the ConfigDB. If we decide to store this value at a later point in time, we can modify this accordingly.