svn commit: r234701 - head/contrib/traceroute
Michael Tuexen
tuexen at FreeBSD.org
Thu Apr 26 13:45:18 UTC 2012
Author: tuexen
Date: Thu Apr 26 13:45:17 2012
New Revision: 234701
URL: http://svn.freebsd.org/changeset/base/234701
Log:
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
Modified:
head/contrib/traceroute/traceroute.c
Modified: head/contrib/traceroute/traceroute.c
==============================================================================
--- head/contrib/traceroute/traceroute.c Thu Apr 26 12:59:08 2012 (r234700)
+++ head/contrib/traceroute/traceroute.c Thu Apr 26 13:45:17 2012 (r234701)
@@ -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
More information about the svn-src-all
mailing list