Debian Codegraph @

wrappers/traceroute-nanog

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Dmitry K. Butskoy
4 # <[email protected]>
5 # License: GPL v2 or any later
6 #
7 # See COPYING for the status of this software.
8 #
9
10 #
11 # Shell wrapper providing traceroute-nanog(8) command line interface.
12 #
13 # The original implementation of traceroute-nanog(8) can be obtained
14 # from ftp://ftp.login.com/pub/software/traceroute/
15 #
16
17
18 prgname=$0
19 opts=""
20 spray=""
21
22
23 usage () {
24 echo "Usage: $prgname [-adnruvAMOPQU$] [-w wait] [-S start_ttl]
25 [-m max_ttl] [-p port] [-q nqueries] [-g gateway] [-t tos]
26 [-s src_addr] [-I proto] host [data_size]" >&2
27 }
28
29 warning () {
30 echo "$prgname: Option '$1' is not implemented in this wrapper" >&2
31 }
32
33
34 PARSED=`getopt -- 'adnruvAMOPQU$w:S:m:p:q:g:t:s:I:f:T:' "$@"`
35 [ $? != 0 ] && {
36 usage
37 exit 2
38 }
39
40 eval set -- "$PARSED"
41
42 while [ $# -gt 0 ]
43 do
44 case "$1" in
45 -[Adrn]) opts="$opts $1"; shift ;;
46 -[gmpqstw]) opts="$opts $1 $2"; shift 2 ;;
47 -I) case "$2" in
48 icmp) opts="$opts -I" ;;
49 tcp) opts="$opts -T" ;;
50 udp) ;;
51 udplite) opts="$opts -UL" ;;
52 *) opts="$opts -P $2" ;;
53 esac
54 shift 2 ;;
55 -S) opts="$opts -f $2"; shift 2 ;;
56 -P) spray=1; shift ;;
57 -f) opts="$opts --sport=$2"; shift 2 ;;
58 -u) ;;
59 -$) opts="-f 64 -m 64 -q 1"; shift ;;
60 -M) opts="$opts --mtu"; shift ;;
61 -[aUOvQ]) warning $1; shift ;;
62 -T) warning $1; shift 2 ;;
63 --) shift; break ;;
64 *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
65 esac
66 done
67
68 [ $# -eq 0 ] && {
69 usage
70 exit 2
71 }
72
73 [ -z "$spray" ] && opts="$opts -N 1"
74
75 exec traceroute $opts $1 $2
76