--- traceroute.c.orig Fri Aug 21 15:15:23 1998 +++ traceroute.c Sun Aug 23 18:58:08 1998 @@ -289,6 +289,7 @@ int nprobes = 3; int max_ttl = 30; int first_ttl = 1; +int static_port = 0; u_short ident; u_short port = 32768 + 666; /* start udp dest port # for probe packets */ @@ -352,7 +353,7 @@ prog = argv[0]; opterr = 0; - while ((op = getopt(argc, argv, "dFInrvxf:g:i:m:p:q:s:t:w:")) != EOF) + while ((op = getopt(argc, argv, "dFInrvxf:g:i:m:p:q:Ss:t:w:")) != EOF) switch (op) { case 'd': @@ -406,6 +407,13 @@ options |= SO_DONTROUTE; break; + case 'S': + /* + * Tell traceroute to not increment the destination + * port, useful for bypassing some packet filters. + * Useless without the -p option. + static_port = 1; + break; case 's': /* * set the ip source address of the outbound @@ -744,7 +752,7 @@ register struct ip *ip; (void)gettimeofday(&t1, &tz); - send_probe(++seq, ttl, &t1); + send_probe(static_port ? seq : ++seq, ttl, &t1); while ((cc = wait_for_reply(s, from, &t1)) != 0) { (void)gettimeofday(&t2, &tz); i = packet_ok(packet, cc, from, seq); @@ -1300,9 +1308,9 @@ extern char version[]; Fprintf(stderr, "Version %s\n", version); - Fprintf(stderr, "Usage: %s [-dFInrvx] [-g gateway] [-i iface] \ -[-f first_ttl] [-m max_ttl]\n\t[ -p port] [-q nqueries] [-s src_addr] [-t tos] \ -[-w waittime]\n\thost [packetlen]\n", + Fprintf(stderr, "Usage: %s [-dFInrSvx] [-g gateway] [-i iface] \ +[-f first_ttl]\n\t[-m max_ttl] [ -p port] [-q nqueries] [-s src_addr] \ +[-t tos]\n\t[-w waittime] host [packetlen]\n", prog); exit(1); }