OSDN Git Service

Check on argument of net-route command
authorniwa-hideyuki <niwa.hideyuki@jp.fujitsu.com>
Wed, 11 Feb 2015 05:32:47 +0000 (14:32 +0900)
committerniwa-hideyuki <niwa.hideyuki@jp.fujitsu.com>
Wed, 11 Feb 2015 05:32:47 +0000 (14:32 +0900)
lxcf/lib/lxcf-net-route

index 6e42643..ae12c32 100755 (executable)
@@ -70,6 +70,24 @@ LXCNAME=$1
 NET_ADDR=$2
 LXCGATEWAY=$3
 
+# check NET_ADDR
+if [ x"$NET_ADDR" != x"" ]; then
+       /usr/lib64/lxcf/lxcf-net-ipv4 -i $NET_ADDR
+       if [ $? -ne 0 ]; then
+               echo "error: NET_ADDR $NET_ADDR is invalid"
+               exit -1
+       fi
+fi
+
+# check GATEWAY 
+if [ x"$LXCGATEWAY" != x"" ]; then
+       /usr/lib64/lxcf/lxcf-net-ipv4 -i $LXCGATEWAY
+       if [ $? -ne 0 ]; then
+               echo "error: GATEWAY $LXCGATEWAY is invalid"
+               exit -1
+       fi
+fi
+
 brctl show  |& egrep ${LXCNAME} >& /dev/null
 if [ $? -ne 0 ]; then
        echo "error: can't find" ${LXCNAME}