blob: c7d377047cdc09e273df9812666f4b849594b714 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#!/bin/sh
#
# Copyright (c) 2008 Dmitry Butskoy
# <dmitry@butskoy.name>
# License: GPL v2 or any later
#
# See COPYING for the status of this software.
#
#
# Shell wrapper providing tracepath(1) or tracepath6(1) command line interface.
#
# The original implementation of tracepath/tracepath6 can be obtained
# from the iputils package, available at http://www.skbuff.net/iputils/
#
opts="-q1 --mtu --back"
port=44444
prgname=$0
length=""
usage () {
echo "Usage: $prgname [-nbh] [ -l pktlen ] host[/port]" >&2
}
PARSED=`getopt -- 'hnbl:' "$@"`
[ $? != 0 ] && exit 2
eval set -- "$PARSED"
while [ $# -gt 0 ]
do
case "$1" in
-n) opts="$opts $1"; shift ;;
-b) shift ;;
-l) length=$2; shift 2 ;;
-h) usage ; exit 0 ;;
--) shift; break ;;
*) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
esac
done
[ $# -eq 0 ] && {
usage
exit 2
}
host=$1
case "$host" in
*/*) port=${host##*/}
host=${host%/*}
;;
esac
case "$prgname" in
*6) opts="$opts -6" ;;
esac
exec traceroute $opts -p $port $host $length
|