Author: tuexen
Date: Thu May  3 09:47:22 2012
New Revision: 234948
URL: http://svn.freebsd.org/changeset/base/234948

Log:
  MFC r234701:
  
  Fix a bug in the TCP tracerouting which resulted in not accepting any
  incoming packets. So all packets seemed to be lost.

Modified:
  stable/9/contrib/traceroute/traceroute.c
Directory Properties:
  stable/9/contrib/traceroute/   (props changed)

Modified: stable/9/contrib/traceroute/traceroute.c
==============================================================================
--- stable/9/contrib/traceroute/traceroute.c    Thu May  3 09:17:31 2012        
(r234947)
+++ stable/9/contrib/traceroute/traceroute.c    Thu May  3 09:47:22 2012        
(r234948)
@@ -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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "[email protected]"

Reply via email to