core/usr/local/sbin/athctrl
Franco Fichtner 7ef4a24979 sbin: remove system directory from repo
* Shift athctrl to /usr/local, and lose the ".sh" prefix as the
  common practice is to not use a suffix for those utilities.  Also
  sync the file with src.git/tools/tools/ath/athctrl.sh, even
  though the changes are only cosmetic.

* /sbin/dhclient-script already exists and was overwritten.  Worse
  still, /usr/local/sbin/dhclient-script also exists.  To "clean"
  this up, rename the modified file to dhclient-script.ext.  Our
  management system picks up the correct file anyway.
2014-11-30 12:34:26 +01:00

43 lines
833 B
Bash
Executable File

#! /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