#!/bin/sh

fwcmd="/sbin/ipfw"
usernum=$2 ; address=$3

case $1 in
+)
	action=add
	if ! $fwcmd show $count_startnum >/dev/null 2>&1 ; then
		$fwcmd $action $count_startnum allow ip from me to any
	fi

	if ! $fwcmd show $usernum 2>/dev/null | grep -q $address
	then
		$fwcmd $action $usernum count ip from any to $address
	fi
	;;
-)
	action=delete
	$fwcmd $action $usernum count ip from any to $address
	;;
*)
	exit 1
	;;
esac
