X-Git-Url: http://lab.mitty.jp/git/?a=blobdiff_plain;f=iproute%2Fsetroute.sh;h=668fc591d49622e5b3f790bc75bae88defeeffef;hb=84c2881946d389e9ef241cfbf7434d7dca598196;hp=f4939012373ec79a6e5144a060c915e755375f82;hpb=8c804d83125c275fd3c5ef8e32b002e2f785a6b3;p=lab.git diff --git a/iproute/setroute.sh b/iproute/setroute.sh index f493901..668fc59 100644 --- a/iproute/setroute.sh +++ b/iproute/setroute.sh @@ -28,6 +28,11 @@ fi # get IP address, network mask, default gateway info IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1` +if [ -z ${IPADDR} ]; then + # fail to bind IP address to device + echo "${IFACE} has no IP address." + exit +fi NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | cut -d ' ' -f 1` if [ -z "${GATEWAY}" ]; then