Skip to content
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

[Multi-asic] Fixed IPv6 Default Route to be BGP Learned #5548

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions dockers/docker-fpm-frr/docker_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,34 @@ CFGGEN_PARAMS=" \
"
CONFIG_TYPE=$(sonic-cfggen $CFGGEN_PARAMS)

if [[ ! -z "$NAMESPACE_ID" ]]; then
update_default_gw()
{
IP_VER=${1}
# FRR is not running in host namespace so we need to delete
# default gw kernel route added by docker network via eth0 and add it back
# with higher administrative distance so that default route learnt
# by FRR becomes best route if/when available
GATEWAY_IP=$(ip route show 0.0.0.0/0 dev eth0 | awk '{print $3}')
GATEWAY_IP=$(ip -${IP_VER} route show default dev eth0 | awk '{print $3}')
#Check if docker default route is there
if [[ ! -z "$GATEWAY_IP" ]]; then
ip route del 0.0.0.0/0 dev eth0
ip -${IP_VER} route del default dev eth0
#Make sure route is deleted
CHECK_GATEWAY_IP=$(ip route show 0.0.0.0/0 dev eth0 | awk '{print $3}')
CHECK_GATEWAY_IP=$(ip -${IP_VER} route show default dev eth0 | awk '{print $3}')
if [[ -z "$CHECK_GATEWAY_IP" ]]; then
# Ref: http://docs.frrouting.org/en/latest/zebra.html#zebra-vrf
# Zebra does treat Kernel routes as special case for the purposes of Admin Distance. \
# Upon learning about a route that is not originated by FRR we read the metric value as a uint32_t.
# The top byte of the value is interpreted as the Administrative Distance and
# the low three bytes are read in as the metric.
# so here we are programming administrative distance of 210 (210 << 24) > 200 (for routes learnt via IBGP)
ip route add 0.0.0.0/0 via $GATEWAY_IP dev eth0 metric 3523215360
ip -${IP_VER} route add default via $GATEWAY_IP dev eth0 metric 3523215360
fi
fi
}

if [[ ! -z "$NAMESPACE_ID" ]]; then
update_default_gw 4
update_default_gw 6
fi

if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then
Expand Down