mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tapsetup: add --loss option
This commit is contained in:
parent
dc52965369
commit
0eaa6edffd
14
dist/tools/tapsetup/tapsetup
vendored
14
dist/tools/tapsetup/tapsetup
vendored
@ -45,6 +45,8 @@ usage() {
|
|||||||
echo " (ignored on OSX and FreeBSD)" >&2
|
echo " (ignored on OSX and FreeBSD)" >&2
|
||||||
echo " -u, --uplink: Optional uplink interface" >&2
|
echo " -u, --uplink: Optional uplink interface" >&2
|
||||||
echo " (ignored on OSX and FreeBSD)" >&2
|
echo " (ignored on OSX and FreeBSD)" >&2
|
||||||
|
echo " --loss: Optional loss %" >&2
|
||||||
|
echo " (ignored on OSX and FreeBSD)" >&2
|
||||||
echo " -h, --help: Prints this text" >&2
|
echo " -h, --help: Prints this text" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,6 +322,9 @@ create_iface() {
|
|||||||
if [ -z "${TUNNAME}" ]; then
|
if [ -z "${TUNNAME}" ]; then
|
||||||
ip link set dev ${NAME}${N} master ${BRNAME} || exit 1
|
ip link set dev ${NAME}${N} master ${BRNAME} || exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${LOSS}" ]; then
|
||||||
|
tc qdisc add dev ${NAME}${N} root netem loss ${LOSS}
|
||||||
|
fi
|
||||||
ip link set ${NAME}${N} up || exit 1 ;;
|
ip link set ${NAME}${N} up || exit 1 ;;
|
||||||
OSX)
|
OSX)
|
||||||
chown ${SUDO_USER} /dev/${NAME}${N} || exit 1
|
chown ${SUDO_USER} /dev/${NAME}${N} || exit 1
|
||||||
@ -476,6 +481,15 @@ while true ; do
|
|||||||
UPLINK="$2"
|
UPLINK="$2"
|
||||||
shift 2 ;;
|
shift 2 ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
--loss)
|
||||||
|
case "$2" in
|
||||||
|
"")
|
||||||
|
usage
|
||||||
|
exit 2 ;;
|
||||||
|
*)
|
||||||
|
LOSS="$2"
|
||||||
|
shift 2 ;;
|
||||||
|
esac ;;
|
||||||
-t|--tap)
|
-t|--tap)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"")
|
"")
|
||||||
|
Loading…
Reference in New Issue
Block a user