Skip to content

Commit

Permalink
[orchagent]: Add ARP update script to maintain VLAN neighbors (#401)
Browse files Browse the repository at this point in the history
- Extend ARP reachable time to 30min
- Add arping to docker-swss
- Add arp_update script to routinely probe neighbors

Signed-off-by: Shuotian Cheng <shuche@microsoft.com>
  • Loading branch information
Shuotian Cheng committed May 16, 2017
1 parent 910e666 commit 8af03fd
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_filter 0
set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1
set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2
set /files/etc/sysctl.conf/net.ipv4.neigh.default.base_reachable_time_ms 1800000
set /files/etc/sysctl.conf/net.ipv6.conf.default.forwarding 1
set /files/etc/sysctl.conf/net.ipv6.conf.all.forwarding 1
set /files/etc/sysctl.conf/net.ipv6.conf.eth0.forwarding 0
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-orchagent/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

RUN apt-get install -f -y ifupdown libdbus-1-3 libdaemon0 libjansson4
RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4

## Install redis-tools dependencies
## TODO: implicitly install dependencies
Expand All @@ -26,7 +26,7 @@ debs/{{ deb }}{{' '}}
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"]
COPY ["mirror.json.j2", "/usr/share/sonic/templates/"]
Expand Down
17 changes: 17 additions & 0 deletions dockers/docker-orchagent/arp_update
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#
# usage:
# arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh
# the neighbors state.

VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'`
for vlan in $VLAN; do
# generate a list of arping commands:
# arping -q -w 0 -c 1 -i <VLAN interface> <IP 1>;
# arping -q -w 0 -c 1 -i <VLAN interface> <IP 2>;
# ...
arpingcmd="sed -e 's/ / -i /' -e 's/^/arping -q -w 0 -c 1 /' -e 's/$/;/'"
ipcmd="ip -4 neigh show | grep $vlan | cut -d ' ' -f 1,3 | $arpingcmd"

eval `eval $ipcmd`
done
5 changes: 5 additions & 0 deletions dockers/docker-orchagent/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ supervisorctl start neighsyncd

supervisorctl start swssconfig

# Start arp_update when VLAN exists
VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'`
if [ "$VLAN" != "" ]; then
supervisorctl start arp_update
fi
7 changes: 7 additions & 0 deletions dockers/docker-orchagent/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:arp_update]
command=bash -c "/usr/bin/arp_update && sleep 300"
priority=8
autostart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog

0 comments on commit 8af03fd

Please sign in to comment.