make proto and port optional

This commit is contained in:
christos 2015-06-02 14:02:39 +00:00
parent 67f3bc6379
commit 6eb87c72ac

View File

@ -11,7 +11,13 @@
case "$1" in
add)
exec /sbin/npfctl rule $2 add block in final proto $3 from $4/$5 to any port $6
if [ -n "$3" ]; then
proto="proto $3"
fi
if [ -n "$6" ]; then
port="port $6"
fi
exec /sbin/npfctl rule $2 add block in final $proto from $4/$5 to any $port
;;
rem)
exec /sbin/npfctl rule $2 rem-id $7