Date: Thu, 10 Aug 2023 03:17:25 +0000
From: segaloco
>> TCP/IP, not datakit
All of the files that have timestamps at the top list 83/07/29, except ip_input.c which
has 83/08/16 instead. The V8 version has _device (device driver) and _ld (line
discipline) components that the 4.1cBSD code does not have. Many other files have analogs
between the two. The byte ordering subroutines have been copied into a file, goo.s, from
their home in 4.1cBSD in the C library (/usr/src/lib/libc/net/misc). When this work
originated someone else would need to answer, [...]
As far as I can tell the history of this code line goes back to 1977, when Jack Haverty at
BBN wrote a TCP/IP library (porting earlier work written in PDP-11 assembler) for a
slightly modified 6th Edition Unix. Fighting with 64KB core limits, throughput was
horrific and he concluded that a bigger PDP-11 was needed. Mike Wingfield then did a
re-implementation in C for a PDP-11/70. This worked in early 1979 and is arguably the
first Unix TCP/IP stack that can still interoperate with current IPv4. However, it was
still mostly a proof of concept user mode design (it was funded as a test vehicle for the
later abandoned Autodin-II fork of TCP).
BBN then got a contract to write a kernel mode TCP/IP stack for 4BSD (“VAX TCP” in the old
BBN doc’s). This work was performed by Rob Gurwitz under supervision of Jack Haverty. This
stack - although all new code - still showed its heritage: it was designed as a loosely
bound kernel process providing the NCP-Unix API. Some sources seem to imply that it was
developed first as a user mode process and once working in that context changed into a
kernel process / thread. Beta releases were available in 1981. It worked (and
interoperates with modern IPv4), but in my experiments a few years back it turned out that
it is difficult to get the scheduling for this kernel process right at higher system
loads.
Bill Joy of CSRG concluded that the BBN stack did not perform according to his
expectations. Note that CSRG was focused on usage over (thick) ethernet links, and BBN was
focused on usage over Arpanet and other wide-area networks (with much lower bandwidth, and
higher latency and error rates). He then in 1982 rewrote the stack to match the CSRG
environment, changing the design to use software interrupts instead of a kernel thread and
optimising the code (e.g. checksumming and fast code paths). It was a matter of debate how
new the code was, with the extremes being that it was written from scratch using the spec
versus it being mostly copied. Looking at it with a nearly 50 year distance, it seems in
between: small bits of surviving SCCS suggest CSRG starting with parts of BBN code
followed by rapid, massive modification; the end result is quite different but retained
the ‘mbuf’ core data structure and a BBN bug (off-by-one for OOB TCP segments).
The shift from the NCP-Unix API to sockets is separate from this and was planned. CSRG had
the contract to develop a new API for facilitating distributed systems with Unix and this
gelled into the sockets interface. The first prototypes for this were done in 1981.
Nearly all of the above source is available in the TUHS online Unix Tree (Wingfield,
VAX-TCP and two early versions from CSRG - one in 2.9BSD and one in 4.1cBSD).