#!/bin/sh

##
# VERY simple access control script for leeenux
##

# Note: your PATH is inherited from the gateway process
#

action=$1
mac=$2
ip=$3
class=$4

if [ -z "$action" -o -z "$mac" -o -z "$ip" -o -z "$class" ]; then 
    echo Usage: $0 [permit\|deny] [MAC] [IP] [Class]
    echo Example: $0 permit 00:02:2d:aa:bb:cc 10.0.0.105 member
    exit 1
fi

if [ "$action" = "permit" ]; then
    cmd=-A
elif [ "$action" = "deny" ]; then
    cmd=-D
else
    echo "FATAL: Bad action: $action!"
    exit 1
fi

if [ "$RouteOnly" ]; then
    masq="ACCEPT"
else
    masq="MASQ"
fi

ipchains $cmd NC_Auth -s $ip -j ACCEPT

# for net in $LocalNetwork; do
    ipchains $cmd NC_NAT  -s $ip -j $masq
    ipchains $cmd NC_NAT  -d $ip -j ACCEPT
# done

#
# Ende
#
