Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650584 - sys-apps/openrc: net-online when host is unreachable ping waits for 3 seconds but only one second is counted
Summary: sys-apps/openrc: net-online when host is unreachable ping waits for 3 seconds...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-15 17:45 UTC by nnnn20430
Modified: 2018-03-15 17:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nnnn20430 2018-03-15 17:45:52 UTC
In init.d/net-online "ping -c 1 $ping_test_host" command waits for 3 seconds when host is unreachable but only 1 second is subtracted from the timeout variable ": $((timeout -= 1))".

It seems to wait for 3 seconds based on value of "mcast_solicit" (/proc/sys/net/ipv4/neigh/$IFNAME/mcast_solicit) which defaults to 3. Instead of assuming it to always be the default we can simply calculate how long the command took:

ping_start="$(date +%s)"
ping -c 1 $ping_test_host > /dev/null 2>&1
rc=$?
ping_end="$(date +%s)"
[ $rc -eq 0 ] && break
: $((timeout -= (ping_end - ping_start)))