code and comments disagreeing (4.[23]BSD TCP code)

Guy Harris guy at sun.uucp
Sun Feb 23 21:10:37 AEST 1986


> Found in our kernel code:
> 
> /* this should be SEQ_LT; is SEQ_LEQ for BBN vax TCP only */
> 		    (SEQ_LT(ti->ti_ack, tp->iss) ||

You'll be happy to know this is fixed in 4.3beta; the comment is gone (and
the code uses SEQ_LEQ).  However, while looking up "iss", I found a worse
bug; "netinet/tcp_var.h" refers you to RFC783, which is the TFTP RFC, NOT
the TCP RFC, which is RFC793.  The copy of RFC793 we have is dated September
1981, not December 1981, and the sequence variables are defined on page 19,
not page 21.  This demonstrates how useful comments are.  (From my quick
reading of the code and the RFC, SEQ_LEQ seems to be correct; "tp->iss" is
the sequence number on the "SYN" sent out, and the other side should ACK
that SYN with the next sequence number it expects to see, which must be
greater than the one it just saw.)

> (gee, I wonder now, should I worry about posting "secret" code? :-)

This code is not AT&T code, it's Berkeley code (and may be descended from
BBN code).  I don't know whether there are any trade secret restrictions on
Berkeley's or BBN's TCP implementation, although since the US Federal
Gummint paid for the Berkeley work (and maybe the BBN work) I tend to doubt
it.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.arpa	(yes, really)



More information about the Comp.lang.c mailing list