fixed 64 bit issue
[strongswan.git] / src / ipsec / ipsec.in
index 6fd5777..a962e13 100755 (executable)
@@ -96,6 +96,11 @@ case "$1" in
        ;;
 down)
        shift
+       if [ "$#" -ne 1 ]
+       then
+           echo "Usage: ipsec down <connection name>"
+           exit 1
+       fi
        if test -e $IPSEC_PLUTO_PID
        then
                $IPSEC_WHACK --name "$1" --terminate
@@ -106,20 +111,21 @@ down)
        fi
        exit 0
        ;;
-listalgs|listpubkeys|listcacerts|listaacerts|\
+listalgs|listpubkeys|listaacerts|\
 listocspcerts|listacerts|listgroups|\
-listcainfos|listcrls|listocsp|listcards|\
+listcainfos|listocsp|listcards|\
 purgeocsp|rereadsecrets|rereadgroups|\
-rereadcacerts|rereadaacerts|rereadocspcerts|\
-rereadacerts|rereadcrls|rereadall)
+rereadaacerts|rereadocspcerts|rereadacerts)
        op="$1"
        shift
        if test -e $IPSEC_PLUTO_PID
        then
                $IPSEC_WHACK "$@" "--$op"
        fi
+       exit 0
        ;;
-listcerts|listall)
+listcerts|listcacerts|listcrls|listall|\
+rereadcacerts|rereadcrls|rereadall)
        op="$1"
        shift
        if test -e $IPSEC_PLUTO_PID
@@ -128,7 +134,7 @@ listcerts|listall)
        fi
        if test -e $IPSEC_CHARON_PID
        then
-               $IPSEC_STROKE "$op"
+               $IPSEC_STROKE "$op" "$@"
        fi
        exit 0
        ;;
@@ -160,10 +166,19 @@ restart)
 route|unroute)
        op="$1"
        shift
+       if [ "$#" -ne 1 ]
+       then
+           echo "Usage: ipsec $op <connection name>"
+           exit 1
+       fi
        if test -e $IPSEC_PLUTO_PID
        then
                $IPSEC_WHACK --name "$1" "--$op"
        fi
+       if test -e $IPSEC_CHARON_PID
+       then
+               $IPSEC_STROKE "$op" "$1"
+       fi
        exit 0
        ;;
 scencrypt|scdecrypt)
@@ -223,6 +238,11 @@ stop)
        ;;
 up)
        shift
+       if [ "$#" -ne 1 ]
+       then
+           echo "Usage: ipsec up <connection name>"
+           exit 1
+       fi
        if test -e $IPSEC_PLUTO_PID
        then
                $IPSEC_WHACK --name "$1" --initiate