October 24, 2022

BSD TCP/IP for Kyu - a first peek at the TCP code

First, let's get ctags set up:
cd /u1/BSD/4.4BSD-Lite
ctags -R .
Next I do this:
vi -t tcp_output
This takes me to usr/src/sys/netinet/tcp_output.c We see this big function (500+ lines) along with another small function "tcp_setpersist()".
vi -t tcp_input
This takes me to usr/src/sys/netinet/tcp_input.c (how about that?). This is a big function (over 1000 lines). It shares the file with a few small routines: tcp_reass(), tcp_dooptions(), tcp_pulloutofband() tcp_xmit_timer(), and tcp_mss()

Where are these called from? Using ctags is no help with that. As for tcp_output() it is called in quite a variety of places.

I do a recursive grep as follows and exclude a bunch of hits on relic tags files (I delete all these ASAP) as follows:

cd /u1/BSD/4.4BSD-Lite/usr/src
rgrep tcp_output | grep -v tags
./sys/netns/idp_usrreq.c:		(void) tcp_output(tp);
./sys/netns/spp_usrreq.c:	 * Many comments from tcp_output.c are appropriate here
./sys/netns/spp_usrreq.c:		/*(void) tcp_output(cb);*/
./sys/netiso/tuba_usrreq.c:		error = tcp_output(tp);
./sys/netiso/tuba_usrreq.c:			error = tcp_output(tp);
./sys/conf/files.newconf:file	netinet/tcp_output.c	inet
./sys/conf/files:netinet/tcp_output.c	optional inet

./sys/netinet/tcp_usrreq.c:		error = tcp_output(tp);
./sys/netinet/tcp_usrreq.c:			error = tcp_output(tp);
./sys/netinet/tcp_usrreq.c:		(void) tcp_output(tp);
./sys/netinet/tcp_usrreq.c:		error = tcp_output(tp);
./sys/netinet/tcp_usrreq.c:		error = tcp_output(tp);
./sys/netinet/tcp_usrreq.c:			(void) tcp_output(tp);
./sys/netinet/tcp_var.h:int	 tcp_output __P((struct tcpcb *));
./sys/netinet/tcp_subr.c:		(void) tcp_output(tp);
./sys/netinet/tcp_timer.c:			(void) tcp_output(tp);
./sys/netinet/tcp_timer.c:		(void) tcp_output(tp);
./sys/netinet/tcp_timer.c:		(void) tcp_output(tp);
./sys/netinet/tcp_fsm.h: * Flags used when sending segments in tcp_output.
./sys/netinet/tcp_output.c: *	@(#)tcp_output.c	8.3 (Berkeley) 12/30/93
./sys/netinet/tcp_output.c:tcp_output(tp)
./sys/netinet/tcp_output.c:		panic("tcp_output");
./sys/netinet/tcp_output.c:		panic("tcp_output REXMT");
./sys/netinet/tcp_input.c:				 * are ready to send, let tcp_output
./sys/netinet/tcp_input.c:					(void) tcp_output(tp);
./sys/netinet/tcp_input.c:					(void) tcp_output(tp);
./sys/netinet/tcp_input.c:					(void) tcp_output(tp);
./sys/netinet/tcp_input.c:		(void) tcp_output(tp);
./sys/netinet/tcp_input.c:	(void) tcp_output(tp);

I find only one reference for tcp_input() in in_proto.c It is not a call, it is a reference in a structure "protosw" This is a cute little file that contains only data, namely initializations of key structures.


Have any comments? Questions? Drop me a line!

Kyu / [email protected]