#!/bin/sh
#
#
echo "SCRIPT $0 [ip address] "
echo "TEST Set a limited bandwidth."
echo ""

ADDRESS="127.0.0.1"

if [ ${1} ]; then
    ADDRESS=${1}
    echo "Address set. Using $ADDRESS"
 else
    echo "No Address given. Using $ADDRESS"
fi

ipfw delete pipe 1
ipfw delete pipe 2
ipfw delete set 11
ipfw delete set 12

ipfw pipe 1 config bw 80kbits/s delay 0 queue 100 noerror
ipfw pipe 2 config bw 80kbits/s delay 0 queue 100 noerror

ipfw add 11 set 11 pipe 1 src-ip $ADDRESS proto udp in
ipfw add 12 set 12 pipe 2 src-ip $ADDRESS proto udp out

ipfw set enable 11
ipfw set enable 12
ipfw enable firewall one_pass

