blob: 0b9deb93ee3f9a42532c35cef289d0c3730f1e75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
#echo "run $@" 1>&2
#set -x
# $1 command
# $2 rulename
# $3 protocol
# $4 address
# $5 mask
# $6 port
# $7 id
case "$1" in
add)
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
;;
flush)
exec /sbin/npfctl rule $2 flush
;;
*)
echo "$0: Unknown command '$1'" 1>&2
exit 1
;;
esac
|