November 2, 2022

BSD TCP/IP for Kyu - stubs

It would be nice to run and test stome things without working out every detail of every missing function.

So we add some stubs to kyu_bsd.c in the form:

void in_pcbbind ( void ) {}
After doing this, I can compile and link and even run Kyu with the BSD code in place. Using "telnet 192.168.0.138 22" (any port would do), I see the message "bsd_rcv 60 bytes". I have no idea what the 60 bytes might be, but don't care much at this point. It includes both the IP header and the TCP header.

It turns out that the BSD code expects the IP layer to have byte swapped entries in the IP header:

	NTOHS(ip->ip_len);
        NTOHS(ip->ip_id);
        NTOHS(ip->ip_off);
This takes place in ip_input.c in the ipintr() routine. This would eventually deliver the packet to TCP code via:
    (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);


Have any comments? Questions? Drop me a line!

Kyu / [email protected]