Commit 71b75e7a authored by Petr Pudlak's avatar Petr Pudlak

Add a packet number limit to "fping" in master-ip-setup

This fixes issue #630. Apparently there is a bug in fping 3.5 where it
loops forever without "-c" given an unreachable host, even though
"-c 1" should be the default according to the man page.

The "-c" flag works on Squeeze. Checking the man pages on the Internet,
fping supported "-c" at least since 2007. So there should be no backward
compatibility problems.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent 4eef428e
......@@ -23,6 +23,8 @@ set -e -u
USAGE_MSG="Usage: $0 {start|stop}"
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
FPING_PACKET_COUNT=1
# Start the master IP
start() {
case $CLUSTER_IP_VERSION in
......@@ -39,13 +41,13 @@ start() {
esac
# Check if the master IP address is already configured on this machine
if fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
if fping -c $FPING_PACKET_COUNT -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
echo "Master IP address already configured on this machine. Doing nothing."
exit 0
fi
# Check if the master IP address is already configured on another machine
if fping $MASTER_IP >/dev/null 2>&1; then
if fping -c $FPING_PACKET_COUNT $MASTER_IP >/dev/null 2>&1; then
echo "Error: master IP address configured on another machine." >&2
exit 1
fi
......@@ -66,7 +68,7 @@ stop() {
if ! ip addr show dev $MASTER_NETDEV | \
grep -F " $MASTER_IP/$MASTER_NETMASK" >/dev/null 2>&1; then
# Check if the master IP address is configured on a wrong device
if fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
if fping -c $FPING_PACKET_COUNT -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
echo "Error: master IP address configured on wrong device," \
"can't shut it down." >&2
exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment