athctrl 833 Bytes
Newer Older
1
#! /bin/sh
Ad Schellevis's avatar
Ad Schellevis committed
2 3 4 5 6
#
# Set the IFS parameters for an interface configured for
# point-to-point use at a specific distance.  Based on a
# program by Gunter Burchardt.
#
7 8
# $FreeBSD$
#
Ad Schellevis's avatar
Ad Schellevis committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
DEV=ath0
d=0

usage()
{
	echo "Usage: $0 [-i athX] [-d meters]"
	exit 2
}

args=`getopt d:i: $*`
test $? -ne 0 && usage

set -- $args
for i; do
	case "$i" in
	-i)	DEV="$2"; shift; shift;;
	-d)	d="$2"; shift; shift;;
	--)	shift; break;
	esac
done

test $d -eq 0 && usage

slottime=`expr 9 + \( $d / 300 \)`
if expr \( $d % 300 \) != 0 >/dev/null 2>&1; then
	slottime=`expr $slottime + 1`
fi
timeout=`expr $slottime \* 2 + 3`

printf "Setup IFS parameters on interface ${DEV} for %i meter p-2-p link\n" $d
ATHN=`echo $DEV | sed 's/ath//'`
sysctl dev.ath.$ATHN.slottime=$slottime
sysctl dev.ath.$ATHN.acktimeout=$timeout
sysctl dev.ath.$ATHN.ctstimeout=$timeout