summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-08-30 16:03:15 +0000
committersam <sam@FreeBSD.org>2005-08-30 16:03:15 +0000
commit003ac31f45b29833f4850e4c537df4e45bdb414a (patch)
tree1c31a393c5b49f403eadf3c46a869e7a84599e4c /tools
parent94cff4b92ff40c7cb2dd7dc57b2e4247176c5544 (diff)
downloadFreeBSD-src-003ac31f45b29833f4850e4c537df4e45bdb414a.zip
FreeBSD-src-003ac31f45b29833f4850e4c537df4e45bdb414a.tar.gz
script to set ifs parameters based on distance; derived from program
of the same name by Gunter Burchardt MFC after: 3 days
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/ath/athctrl.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/tools/ath/athctrl.sh b/tools/tools/ath/athctrl.sh
new file mode 100644
index 0000000..5adee1c
--- /dev/null
+++ b/tools/tools/ath/athctrl.sh
@@ -0,0 +1,42 @@
+#! /bin/sh
+#
+# Set the IFS parameters for an interface configured for
+# point-to-point use at a specific distance. Based on a
+# program by Gunter Burchardt.
+#
+# $FreeBSD$
+#
+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
OpenPOWER on IntegriCloud