Skip to content

Commit

Permalink
[dhcp_relay] Remove wait LLA in wait_for_intf.sh in dhcp_relay contai…
Browse files Browse the repository at this point in the history
…ner (#21182)

Why I did it
There is wait in wait_for_intf.sh inside dhcp_relay container to wait all vlans' ipv6 link local address to be ready. Only after that, related dhcp relay processes could be started (i.e. dhcrelay, dhcp6relay, dhcpmon)
If ipv6 link local address for one vlan is not ready, it would block all vlans' dhcpv4 and dhcpv6 relay, which is unexpected.

Work item tracking
Microsoft ADO (number only): 30491632

How I did it
With current PR, remove wait LLA logic in this script.
Add wait LLA in dhcp6relay process sonic-net/sonic-dhcp-relay#52 (PR has been merged)

How to verify it
Install image and confirm
  • Loading branch information
yaqiangz authored Jan 3, 2025
1 parent 79efb0b commit cb85ddb
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 60 deletions.
20 changes: 0 additions & 20 deletions dockers/docker-dhcp-relay/wait_for_intf.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@ 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
# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces
# Thus check if they are ready before launching dhcp6relay
Expand All @@ -55,7 +36,6 @@ wait_until_iface_ready {{ name }} {{ prefix }}
{% if prefix | ipv6 %}
{% if DHCP_RELAY and name in DHCP_RELAY %}
wait_until_iface_ready {{ name }} {{ prefix }}
check_for_ipv6_link_local {{ name }}
{% endif %}
{% endif %}
{% endfor %}
Expand Down
20 changes: 0 additions & 20 deletions src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ 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
# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces
# Thus check if they are ready before launching dhcp6relay
wait_until_iface_ready Vlan2000 192.168.200.1/27
wait_until_iface_ready Vlan1000 192.168.0.1/27
wait_until_iface_ready Vlan1000 fc02:2000::2/24
check_for_ipv6_link_local Vlan1000
wait_until_iface_ready PortChannel02 10.0.0.58/31
wait_until_iface_ready PortChannel03 10.0.0.60/31
wait_until_iface_ready PortChannel04 10.0.0.62/31
Expand Down
20 changes: 0 additions & 20 deletions src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,10 @@ 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
# dhcp6relay binds to ipv6 addresses configured on these vlan ifaces
# Thus check if they are ready before launching dhcp6relay
wait_until_iface_ready Vlan1000 fc02:2000::2/24
check_for_ipv6_link_local Vlan1000
wait_until_iface_ready Vlan1000 192.168.0.1/27
wait_until_iface_ready Vlan2000 192.168.200.1/27
wait_until_iface_ready PortChannel01 10.0.0.56/31
Expand Down

0 comments on commit cb85ddb

Please sign in to comment.