1#! /bin/sh
2#
3# Set the IFS parameters for an interface configured for
4# point-to-point use at a specific distance.  Based on a
5# program by Gunter Burchardt.
6#
7# $FreeBSD$
8#
9DEV=ath0
10d=0
11
12usage()
13{
14	echo "Usage: $0 [-i athX] [-d meters]"
15	exit 2
16}
17
18args=`getopt d:i: $*`
19test $? -ne 0 && usage
20
21set -- $args
22for i; do
23	case "$i" in
24	-i)	DEV="$2"; shift; shift;;
25	-d)	d="$2"; shift; shift;;
26	--)	shift; break;
27	esac
28done
29
30test $d -eq 0 && usage
31
32slottime=`expr 9 + \( $d / 300 \)`
33if expr \( $d % 300 \) != 0 >/dev/null 2>&1; then
34	slottime=`expr $slottime + 1`
35fi
36timeout=`expr $slottime \* 2 + 3`
37
38printf "Setup IFS parameters on interface ${DEV} for %i meter p-2-p link\n" $d
39ATHN=`echo $DEV | sed 's/ath//'`
40sysctl dev.ath.$ATHN.slottime=$slottime
41sysctl dev.ath.$ATHN.acktimeout=$timeout
42sysctl dev.ath.$ATHN.ctstimeout=$timeout
43