Upgrade dialog(1). 1/2
[dragonfly.git] / tools / tools / ath / athctrl.sh
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: src/tools/tools/ath/athctrl.sh,v 1.1 2005/08/30 16:03:15 sam Exp $
8 #
9 DEV=ath0
10 d=0
11
12 usage()
13 {
14         echo "Usage: $0 [-i athX] [-d meters]"
15         exit 2
16 }
17
18 args=`getopt d:i: $*`
19 test $? -ne 0 && usage
20
21 set -- $args
22 for i; do
23         case "$i" in
24         -i)     DEV="$2"; shift; shift;;
25         -d)     d="$2"; shift; shift;;
26         --)     shift; break;
27         esac
28 done
29
30 test $d -eq 0 && usage
31
32 slottime=`expr 9 + \( $d / 300 \)`
33 if expr \( $d % 300 \) != 0 >/dev/null 2>&1; then
34         slottime=`expr $slottime + 1`
35 fi
36 timeout=`expr $slottime \* 2 + 3`
37
38 printf "Setup IFS parameters on interface ${DEV} for %i meter p-2-p link\n" $d
39 ATHN=`echo $DEV | sed 's/ath//'`
40 sysctl dev.ath.$ATHN.slottime=$slottime
41 sysctl dev.ath.$ATHN.acktimeout=$timeout
42 sysctl dev.ath.$ATHN.ctstimeout=$timeout