1 Only in clink.1.0a: .collect.c.swp
2 Only in clink.1.0a: clink
3 diff -ru clink.1.0/collect.c clink.1.0a/collect.c
4 --- clink.1.0/collect.c Sat Aug 14 22:47:04 1999
5 +++ clink.1.0a/collect.c Sat Jun 24 16:50:19 2000
7 the header of the packet that caused the error */
9 hip = (struct ip *) (recvbuf + hlen1 + 8);
10 - if (hip->ip_p != IPPROTO_UDP) return 0;
11 + if (hip->ip_p != IPPROTO_UDP) {
12 + if (verbose) printf("Wrong protocol %d != %d\n", hip->ip_p, IPPROTO_UDP);
16 hlen2 = hip->ip_hl << 2;
17 udp = (struct udphdr *) (recvbuf + hlen1 + 8 + hlen2);
19 - if (udp->source != htons (sport)) return 0;
20 - if (udp->dest != htons (dport)) return 0;
21 + if (udp->source != htons (sport)) {
22 + if (verbose) printf("Wrong source port %d != %d\n", ntohs(udp->source), (sport));
25 + if (udp->dest != htons (dport)) {
26 + if (verbose) printf("Wrong destination port %d != %d\n", ntohs(udp->dest), (dport));
30 /* now we know it's an ICMP packet caused by a UDP
31 datagram sent by us and sent to the port we happen to
35 if (icmp->icmp_type == ICMP_DEST_UNREACH) {
36 - if (icmp->icmp_code == ICMP_PORT_UNREACH) {
37 + if ( (icmp->icmp_code == ICMP_PORT_UNREACH) || (icmp->icmp_code == ICMP_PKT_FILTERED) ) {
42 fill in the timestamps. I am assuming that they don't have
45 -void clink_init (char *host, int tos)
46 +void clink_init (char *host, int sport0, int tos)
49 struct addrinfo *ai = NULL;
52 sabind->sa_family = sasend->sa_family;
53 sport = (getpid() & 0xffff) | 0x8000; /* source UDP port # */
54 +if (sport>=61000) sport -= 10000;
55 + if (sport0>0) sport = sport0;
56 sock_set_port (sabind, salen, htons(sport));
57 Bind (sendfd, sabind, salen);
59 Only in clink.1.0a: collect.o
60 diff -ru clink.1.0/process.c clink.1.0a/process.c
61 --- clink.1.0/process.c Sat Aug 14 22:47:04 1999
62 +++ clink.1.0a/process.c Thu Jun 22 19:21:52 2000
64 int wait_time = 2; /* how many seconds to wait before timeout */
65 int dns_resolve = 1; /* flag: should we use DNS to resolve addrs? */
66 int verbose = 0; /* flag: should we print verbose output */
67 +int quiet = 0; /* flag: no messages for each packet */
68 +int sport0 = 0; /* source port */
69 /* how long should we wait between probes */
70 double inter_sample_ratio = 10.0; /* a multiple of the previous rtt? */
71 double inter_sample_time = 0.0; /* or a fixed interval in microsecs */
72 @@ -1073,11 +1075,15 @@
73 printf ("ttl=%d\t%s\tsize= %4d B\trtt= %.3lf ms\n",
74 ttl, Sock_ntop_host (datum->addr, salen), size, datum->rtt);
77 - printf ("n=%5d\t%s\tsize= %4d B\trtt= %.3lf ms\r",
78 - probe_count, Sock_ntop_host (datum->addr, salen), size, datum->rtt);
81 + printf ("n=%5d\t%s\tsize= %4d B\trtt= %.3lf ms\r",
82 + probe_count, Sock_ntop_host (datum->addr, salen), size, datum->rtt);
90 add_datum (ttl, size, datum);
93 tos = IPTOS_LOWDELAY | IPTOS_THROUGHPUT | IPTOS_MINCOST;
96 - clink_init (host, tos);
97 + clink_init (host, sport0, tos);
99 sizes = make_sizes (low, high, step);
101 @@ -1325,7 +1331,7 @@
105 - while ( (c = getopt (argc, argv, "knvMD:I:f:h:i:l:m:q:r:s:t:w:")) != -1) {
106 + while ( (c = getopt (argc, argv, "knvMD:I:f:h:i:l:m:p:q:Qr:s:t:w:")) != -1) {
109 kernel_timestamps = 1;
110 @@ -1396,6 +1402,15 @@
112 if ( (num_probes = atoi(optarg)) < 2) {
113 err_quit ("invalid -q value (num_probes); must be at least 2");
120 + sport0 = atoi(optarg);
121 + if ( (sport0<= 0) || (sport0>=65536) ) {
122 + err_quit ("invalid -p (source port); must be in 1..65535 range");
126 Only in clink.1.0a: process.o
127 Only in clink.1.0a: util.o