Student: Ambarisha Bhatlapenumarthi
Mentors: Tomas Hruby, Dirk Vogt
git repository: minix-lwipgsoc
The project aims to complete LwIP integration into MINIX 3. Basic support has already been added but it isn't complete and hasn't been tested properly yet. This project will be about completing that work and then adding new features like IP routing, forwarding, IPv6 support, NPF support. There are also some secondary goals like developing core LwIP for the benefit of both MINIX 3 and LwIP communities.
|☑||Complete lwIP integration||95%||Testing named remains|
|☑||Improve routing in lwIP, IP Forwarding||100%|
|☐||Improve IPv6 functionality||80%||Testing IPv6 connections and support for raw ip sockets remain|
|☐||Add support for NPF||0%|
Imported LwIP-trunk codebase. LwIP is currently in 1.4.1rc1. LwIP-trunk contains alot of major IPv6 patches which will be coming out in 1.5.0.
After a few changes to the Makefiles everything compiles.
Noticed a couple of random glitches after installing LwIP-trunk. Otherwise lwip server runs fine.
Looked into DHCP client. Need to consider ISC's dhclient vs Roy Marvels' dhcpcd(being used by netbsd).
I worked on porting ISC's dhclient to MINIX. dhclient comes with bind which is a DNS software. Support for IPv6 is also available. So once it works, most of the basic functionality will be available. For now all the code compiles. I still need to fix a few things(mentioned below) and then test the client. I defined a couple of dummy functions to make the IPv6 code compile. Once IPv6 module is completed these dummy functions can be replaced.
bind maintains a journal file for IXFR zone transfers. It uses utimes() for timestamping each time it accesses this journal file. utimes() is not available in MINIX, so instead of using the utimes we maintain a timestamp variable for the journal file.
There are three Network API available. BPF, LPF and raw sockets. For raw sockets, they are trying to use a handcrafted IP header by setting the IP_HDRINCL socket option. But IP_HDRINCL isn't available in /usr/include. Also I am not sure why handcrafted IP header is necessary. For BPF, LPF it has to handcrafted anyway. So, probably this is so for reusing that code.
dhclient requires SO_BROADCAST which is a socket option for broadcasting. But SO_BROADCAST isn't available in MINIX.
This week I first fixed the problems from last week:
I got the NetBSD's dhclient-script and modified it to work with MINIX as our ifconfig command is very restricted. Also typecasts between struct sockaddr_in and struct sockaddr aren't working as expected. Currently working on fixing this. (Edit: It was just because of a mistake, I was including the wrong file)
This week I worked DNS and IP forwarding.
I have been working on integrating dhclient and bind into minix src tree. I also successfully tested IP forwarding.
I laid out the makefiles and modified them for minix. I found out that bind has 2 sets of libraries BIND9 libraries and bind export libraries. Bind export libraries separate code which is closely tied to bind binaries (especially named). Since we are porting both dhclient and named, I figured we could merge both libraries. After building everything and running, I learnt that the libraries are not compatible with each other internally. I got this confirmed on bind-workers mailing list. So, now we have two sets of bind libraries which are somewhat different. I have placed the export libraries under libbindexport in src/lib. I am finally finished with integrating dhclient into minix src tree. Though there still seems to be a problem with broadcast receive messages. I am now working to fix this.
I have also setup IPv6 lan with my host for starting work on IPv6. I looked at liblwip, lwip server from IPv6 perspective. liblwip has a LWIP_IPV6 option which turns on IPv6 in lwip. We first turn that on, then modify lwip server to handle ioctls on ipv6 sockets. Perhaps this might become more clear after discussing with Tomas and Dirk today.
Last week I couldn't get much work done except implementing NWIOGIP6CONF ioctl and IPv6 changes at IP layer because I had problems with setting up a serial console and implemented NWIOSIP6CONF the wrong way(fixed now). Here are the changes from this week :
I have pushed most of the changes to the repository. Any remaining changes will appear by tommorrow.
These last couple of weeks, I continued the work on IPv6:
LwIP is not yet a complete substitute for inet. It has to be improved and tested before it can replace inet.Firstly, DHCP has to be fixed. dhcpd currently doesn't work so well with lwIP. There are two approaches to fix this:
The interface between lwIP and VFS also requires some polishing. The socket interface is provided with the help of VFS. It seems there are some problems with the raw socket functionality. Also, lwIP has to be tested further. Sometimes, I experience the system going into infinite loop with ftp listings and such. There are other little things like displaying error messages about ioctl when an ftp port command fails. These need to be put down formally, reproduced and then patched. All that testing will be included in this module.
Currently lwIP doesn't support extensive routing or IP forwarding. Looking at ip_route() in liblwip/src/core/ipv4/ip.c, we see that, as of now, a packet is checked for match on the subnets of all the available network interfaces . If it doesn't match the packet is sent on a default interface. This needs to be improved. The state information required to decide the route has to be acquired and the route calculated. I have also looked through inet codebase. Perhaps, src/servers/inet/ipr.c could be a starting point.
[EDIT : Confirmed that improving routing support in lwip is out of the scope of the project. It seems, the lwIP community is also not so interested bringing in extensive routing in “lw”IP ]
lwIP has IPv6 support, but it is not at all complete. A lot of patches were added after the 1.4.0 release according to lwIP mailing list discussion and they haven't been tested thoroughly as yet. Testing IPv6 would also be a major task of this module. LwIP currently supports the dual stack. I have a decent understanding of IPv6. But it is not profound. I will have to study this a little more. So, this module is perhaps the largest.
This would involve adding hooks to let NPF know when a packet arrives and passing the packet to NPF after stripping the datalink headers.
There are also some secondary goals like adding features to LwIP and upstreamed.