Skip to content

[DHCP_RELAY] Updated wait_for_intf.sh to wait for ipv6 global and link local addr #35

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions dockers/docker-dhcp-relay/wait_for_intf.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ function wait_until_iface_ready
echo "Interface ${IFACE_NAME} is ready!"
}

function check_for_ipv6_link_local
{
IFACE_NAME=$1
echo "Waiting until interface ${IFACE_NAME} has a link-local ipv6 address configured...."

# Status of link local address is not populated in STATE_DB
while true; do
HAS_LL=$(ip -6 addr show ${IFACE_NAME} scope link 2> /dev/null)
RC=$?
if [[ ${RC} == "0" ]] && [[ ! -z ${HAS_LL} ]]; then
break
fi

sleep 1
done

echo "Link-Local address is configured on ${IFACE_NAME}"
}

# Wait for all interfaces with IPv4 addresses to be up and ready
{% for (name, prefix) in INTERFACE|pfx_filter %}
Expand All @@ -32,6 +50,14 @@ wait_until_iface_ready {{ name }} {{ prefix }}
{% if prefix | ipv4 %}
wait_until_iface_ready {{ name }} {{ prefix }}
{% endif %}
{% if prefix | ipv6 %}
{% if DHCP_RELAY and name in DHCP_RELAY %}
# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces
# Thus check if they are ready before launching dhcp6relay
wait_until_iface_ready {{ name }} {{ prefix }}
check_for_ipv6_link_local {{ name }}
{% endif %}
{% endif %}
{% endfor %}
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
{% if prefix | ipv4 %}
Expand Down