netconfig ipfw show
netconfig pipe show
netconfig -p <port> -d
to show rules, pipe and to delete a rule respectively.
Removed a debug message from the ipfw source.
- printf("need to drop the skbuf\n");
{
cat << EOF
Usage: $prog -p port [-U] [-t timeout[STRING]] ipfw_configuration_parameters \n
{
cat << EOF
Usage: $prog -p port [-U] [-t timeout[STRING]] ipfw_configuration_parameters \n
+ $prog ipfw show \n
+ $prog pipe show \n
+
-h show help \n
-p specify the port to configure \n
-h show help \n
-p specify the port to configure \n
+ -d delete specified rules and pipes \n
-t specify the timeout. STRING can be "1minute" or "4hours" (default 1 hour) \n
ipfw configuration parameters (mandatory) \n
extra-delay <filename> bw <value> delay <value> proto... plr... \n
-t specify the timeout. STRING can be "1minute" or "4hours" (default 1 hour) \n
ipfw configuration parameters (mandatory) \n
extra-delay <filename> bw <value> delay <value> proto... plr... \n
+
+ ipfw show show the ipfw ruleset
+ ipfw pipe show the configured pipes
- while getopts ":hp:t:" opt; do
+ while getopts ":hdp:t:" opt; do
case $opt in
h | \?) help;;
p) PORT=$OPTARG;;
case $opt in
h | \?) help;;
p) PORT=$OPTARG;;
t) TIMEOUT=$OPTARG;;
esac
done
t) TIMEOUT=$OPTARG;;
esac
done
OPT_ARGS=$((${OPT_ARGS}-2))
fi
OPT_ARGS=$((${OPT_ARGS}-2))
fi
+ # check for deletion flag
+ if [ -z ${DELETE} ]; then
+ DELETE=0
+ else
+ # if d is present configuration is not required
+ MAND_ARGS=$((${MAND_ARGS}-2))
+ fi
+
# compute residue argument, we need at least 2
# mandatory arguments (for ipfw), exit on error
# compute residue argument, we need at least 2
# mandatory arguments (for ipfw), exit on error
- #debug "Passed args $# Mandatory ${MAND_ARGS} Optional ${OPT_ARGS} Extra $(($#-${MAND_ARGS}-${OPT_ARGS}))"
+ # debug "Passed args $# Mandatory ${MAND_ARGS} Optional ${OPT_ARGS} Extra $(($#-${MAND_ARGS}-${OPT_ARGS}))"
if [ $(($#-${MAND_ARGS}-${OPT_ARGS})) -lt 2 ]; then
help
fi
}
if [ $(($#-${MAND_ARGS}-${OPT_ARGS})) -lt 2 ]; then
help
fi
}
+# the backend expects lines in the format:
+# ipfw
+# pipe
+# port timeout configuration_string
- # allow ipfw show and ipfw pipe show
+ # allow ipfw show and ipfw pipe show commands
if [ x$1 = x"ipfw" ]; then
echo "received" $1
echo "ipfw" >> ${PIPE_IN}
if [ x$1 = x"ipfw" ]; then
echo "received" $1
echo "ipfw" >> ${PIPE_IN}
# print debug
debug "PORT ${PORT}"
# print debug
debug "PORT ${PORT}"
+ debug "DELETE ${DELETE}"
debug "TIMEOUT ${TIMEOUT}"
debug "PIPE_CONFIGURATION $*"
# format CMD as expected by the backend script
debug "TIMEOUT ${TIMEOUT}"
debug "PIPE_CONFIGURATION $*"
# format CMD as expected by the backend script
- CMD="${PORT} ${TIMEOUT} $*";
+ CMD="${PORT} ${TIMEOUT} ${DELETE} $*";
# send the command
debug "Sending: ${CMD}"
# send the command
debug "Sending: ${CMD}"