Dear all,
As some of you may be aware, in the last year-and-then-some, I have been working on a major overhaul of the MINIX 3 network stack, for which I presented the plan at MINIXcon 2016 [1]. I am proud to announce that this networking project has now been finished and, barring any unexpected problems or serious objections, will be merged on short notice. The project effectively replaces the entire MINIX 3 network stack, all the way from the system call interface to the network driver API. Most notably, it provides a new implementation of the TCP/IP and UNIX Domain Sockets (UDS) system services.
The project had the following three main goals:
1) relieve the maintenance burden of the core TCP/IP implementation, of which the current incarnation has become unmaintainable;
2) establish compatibility with NetBSD networking userland, including low-level network administration utilities;
3) add support for IPv6.
All of these goals have been met. The first point is achieved by replacing the previous TCP/IP service (INET) with a completely new TCP/IP service (LWIP) which is based on the lwIP stack [2]: an actively maintained, BSD-licensed TCP/IP implementation. All factors considered, I believe the lwIP stack is currently the best option for us.
The second point is achieved with a considerable amount of code in the LWIP service that bridges the gap between the NetBSD socket and networking API on one side, and the core of the lwIP stack on the other side. As part of that, the networking project introduces a large number of BSD sockets and networking APIs and features and BSD-like behaviors that were previously absent. As a result, the project unlocks much more of the standard NetBSD libc/libutil/etc functionality, and replaces the set of traditional MINIX networking utilities with a set of (largely unchanged!) NetBSD networking utilities.
The lwIP stack also provides IPv6 support--the third point. As part of this project, I have invested substantial effort into improving lwIP's IPv6 support (among other things). I have been able to upstream all my changes to the lwIP project, of which we are now using an almost unchanged import. The plan is to continue updating to the latest lwIP source code on a regular basis, so that we get all the benefits from improvements made on their side.
Replacing the UNIX Domain Sockets (UDS) service was more a side effect of the project. While the previous UDS implementation mostly worked fine, the new version is much more POSIX compliant, is much closer to NetBSD in terms of behavior, and now also shares a fair amount of code with the LWIP service. As a practical outcome, we can also drop some previously necessary MINIX-only userland changes there (e.g. from tmux(1)).
As also listed in the corresponding pull request [3], the main overall highlights of the networking project include:
* first-class VFS support for socket-type file objects instead of a series of libc kludges;
* a socket driver library (libsockdriver) and a socket event dispatching library (libsockevent);
* a new, POSIX-compliant implementation of the UNIX Domain Sockets service (UDS);
* a new TCP/IP service (LWIP), built upon the core of the lwIP project;
* proper support for the BSD socket API and the BSD network management API;
* full-blown support for IPv6;
* replacement of old MINIX networking userland with modern NetBSD networking userland;
* network driver protocol extensions, from reporting link status to checksum offloading;
* auto-starting of plug-and-play network drivers;
* NetBSD-style rc-script based network initialization;
* about 18 KLoC worth of new tests (test90-94).
More detailed information about all the improvements can be found in the commit messages of various commits that are part of the pull request.
Practically speaking, the project comes with many user-visible changes. Not only are we switching to NetBSD networking utilities like ifconfig(8) and route(8) which work completely differently from before, but also the NetBSD networking system initialization (rc) scripts. In general, NetBSD documentation on networking (e.g., [4]) now applies to MINIX 3 too, although we do of course support only a subset of the full NetBSD functionality at this point.
On that point: in the next few days to weeks, I hope to compose a list of features that are expected and not expected to work. As an example of what works: MINIX 3 can be configured at run time to be an IPv4 router, and even a basic (functional but not strictly RFC-compliant) IPv6 router. As an example of what does not work: the functionality of the arp(8) and ndp(8) utilities is rather restricted because of current limitations in lwIP, and not all non-standard netstat(1) views are supported. In some cases, these limitations should be resolved in the future; in other cases, they are inherent to having a different TCP/IP stack implementation.
Perhaps most importantly right now, the way to configure networking has changed completely. As also mentioned in a docs/UPDATING entry, upgrading MINIX 3 users will have to reapply their network settings. In essence, network drivers are now automatically started whenever possible, and so netconf(8) is no longer concerned with selecting a network driver to start. Instead, it is now a front-end to NetBSD-style network configuration.
In any case, it is my strong belief that with this new network stack, one of the more important current obstacles to moving forward with MINIX 3 - in terms of both NetBSD userland compatibility and overall functionality - is out of the way, putting us on a healthy course when it comes to networking. We can now start looking into more advanced networking features such as support for a firewall, tunneling, wireless networking, etcetera.
As always, progress of our automatic testing process can be followed on the gerrit server [5]. Once the code has been merged, of course, please report any problems, bugs, questions/concerns (etc), either in the form of GitHub issues [6] (for concrete problems) or on this group (for questions and more open-ended issues). Given that this project involves a substantial amount of completely new code (a little over 50 KLoC in total), there are bound to be bugs, and I'd like to hear about them.
Finally, with this project formally coming to a close, I would like to express my gratitude to Andy Tanenbaum, in the role of the head of the MINIX Foundation, for sponsoring part of this project. Also, thanks go out to Lionel Sambuc for his testing and debugging, which among other things helped iron out a few major bugs.
Regards,
David
[1]
http://www.minix3.org/conference/2016/program.html (first talk)
[2]
https://savannah.nongnu.org/projects/lwip/[3]
https://github.com/Stichting-MINIX-Research-Foundation/minix/pull/213[4]
https://www.netbsd.org/docs/network/[5]
http://gerrit.minix3.org/[6]
https://github.com/Stichting-MINIX-Research-Foundation/minix/issues