mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-27 15:31:17 +01:00
Merge pull request #18885 from benpicco/tapsetup-loss
tapsetup: add --loss & --delay option
This commit is contained in:
commit
edf30e051c
23
dist/tools/tapsetup/tapsetup
vendored
23
dist/tools/tapsetup/tapsetup
vendored
@ -45,6 +45,10 @@ usage() {
|
||||
echo " (ignored on OSX and FreeBSD)" >&2
|
||||
echo " -u, --uplink: Optional uplink interface" >&2
|
||||
echo " (ignored on OSX and FreeBSD)" >&2
|
||||
echo " --loss <loss>%: Optional loss %" >&2
|
||||
echo " (ignored on OSX and FreeBSD)" >&2
|
||||
echo " --delay <delay>ms: Optional delay ms" >&2
|
||||
echo " (ignored on OSX and FreeBSD)" >&2
|
||||
echo " -h, --help: Prints this text" >&2
|
||||
}
|
||||
|
||||
@ -320,6 +324,7 @@ create_iface() {
|
||||
if [ -z "${TUNNAME}" ]; then
|
||||
ip link set dev ${NAME}${N} master ${BRNAME} || exit 1
|
||||
fi
|
||||
tc qdisc add dev ${NAME}${N} root netem ${DELAY} ${LOSS}
|
||||
ip link set ${NAME}${N} up || exit 1 ;;
|
||||
OSX)
|
||||
chown ${SUDO_USER} /dev/${NAME}${N} || exit 1
|
||||
@ -476,6 +481,24 @@ while true ; do
|
||||
UPLINK="$2"
|
||||
shift 2 ;;
|
||||
esac ;;
|
||||
--loss)
|
||||
case "$2" in
|
||||
"")
|
||||
usage
|
||||
exit 2 ;;
|
||||
*)
|
||||
LOSS="loss random $2"
|
||||
shift 2 ;;
|
||||
esac ;;
|
||||
--delay)
|
||||
case "$2" in
|
||||
"")
|
||||
usage
|
||||
exit 2 ;;
|
||||
*)
|
||||
DELAY="delay $2"
|
||||
shift 2 ;;
|
||||
esac ;;
|
||||
-t|--tap)
|
||||
case "$2" in
|
||||
"")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user