From: Marta Carbone <marta@prova.iet.unipi.it>
Date: Mon, 6 Jul 2009 19:14:19 +0000 (+0000)
Subject: Added `ipfw show' and `ipfw pipe show' commands. Minor fix.
X-Git-Tag: vsys-scripts-0.95-5~2
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=1611aba0b564e195cc0befde917035b9fac2a994;p=vsys-scripts.git

Added `ipfw show' and `ipfw pipe show' commands. Minor fix.
---

diff --git a/exec/ipfw-be b/exec/ipfw-be
index 7e22a7c..be4b0c2 100755
--- a/exec/ipfw-be
+++ b/exec/ipfw-be
@@ -64,9 +64,9 @@ add_rules() { # $1 timeout value
         EXPIRE=`date --date="${TIMEOUT}" +%s`
         [ x"${EXPIRE}" = x"" ] && abort "Date format $1 not valid"
 
-	# prepend the profile name with the vserver directory
-	echo ${CONFIG_STRING} | ${SED} -e "s/ profile \(.[^ ]\)/ profile \/vservers\/${SLICE}\/\1/g"
-	#
+	# move in the slice root dir
+	cd /vservers/${SLICE}/root
+	#echo ${CONFIG_STRING} | ${SED} -e "s/ profile \(.[^ ]\)/ profile \/vservers\/${SLICE}\/\1/g"
 
         # check syntax, if ok execute
         # add rules
@@ -127,6 +127,19 @@ process()
 
 	debug "Received from the input pipe: $1"
 
+	# allow netconfig ipfw show
+	# allow netconfig pipe show
+
+	CMD=`echo $1 | cut -d\  -f 1`
+	if [ x${CMD} == x"ipfw" ]; then
+		ipfw show
+		return 0
+	else if [ x${CMD} == x"pipe" ]; then
+		ipfw pipe show
+		return 0
+	fi
+	fi
+
 	ARGS=`echo $1 | wc -w`
 	if [ $ARGS -le 3 ]; then
 		abort "One or more input parameter is missing"
@@ -151,7 +164,6 @@ process()
 	PIPE_N=${PORT}
 	RULE_N=${PORT}
 
-	return 0
 	# check if the link is already configured
 	ipfw list ${PORT} 2>&1
 
@@ -182,7 +194,6 @@ process()
 	for i in `/usr/bin/seq 0 $((${#requests[*]} - 1))`
 	do
 		process "${requests[$i]}"
-		add_rules
 	done
 
 	# delete the lock