summaryrefslogtreecommitdiff
path: root/contrib/traceroute
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2012-04-26 13:45:17 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2012-04-26 13:45:17 +0000
commit7a7a6331a9951c62c0328b9d41a6647b40855396 (patch)
treeac3d8b9bc7d1f80307023dd36bd733da29c53db8 /contrib/traceroute
parentfaf6e9484fea15e748c9a8408531802da59f5cc4 (diff)
downloadsrc-test-7a7a6331a9951c62c0328b9d41a6647b40855396.tar.gz
src-test-7a7a6331a9951c62c0328b9d41a6647b40855396.zip
Fix a bug in the TCP tracerouting which resulted in not accepting any
incoming packets. So all packets seemed to be lost. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=234701
Diffstat (limited to 'contrib/traceroute')
-rw-r--r--contrib/traceroute/traceroute.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c
index 1c98262bacf2f..63cefa1c42104 100644
--- a/contrib/traceroute/traceroute.c
+++ b/contrib/traceroute/traceroute.c
@@ -1406,8 +1406,7 @@ tcp_prep(struct outdata *outdata)
tcp->th_sport = htons(ident);
tcp->th_dport = htons(port + (fixedPort ? 0 : outdata->seq));
- tcp->th_seq = (tcp->th_sport << 16) | (tcp->th_dport +
- (fixedPort ? outdata->seq : 0));
+ tcp->th_seq = (tcp->th_sport << 16) | tcp->th_dport;
tcp->th_ack = 0;
tcp->th_off = 5;
tcp->th_flags = TH_SYN;
@@ -1425,8 +1424,8 @@ tcp_check(const u_char *data, int seq)
struct tcphdr *const tcp = (struct tcphdr *) data;
return (ntohs(tcp->th_sport) == ident
- && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq))
- && tcp->th_seq == (((tcp_seq)ident << 16) | (port + seq));
+ && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq)
+ && tcp->th_seq == (tcp_seq)((tcp->th_sport << 16) | tcp->th_dport));
}
void