OpenBSD Journal

n2k15: vgross@ on deep surgery in TCP/IP stack code

Contributed by pitrh on from the recast my broadcast dept.

Just in, this report from Vincent Gross (vgross@) on the recent n2k15 hackathon:

First of all, I would like to thank reyk@ for hosting the hackathon and mpi@ for inviting me. This hackathon was my first and I had a great time in Hannover.
I started with a diff I submitted before and had to be reworked, about ifa_ifwithaddr(). As mpi@ explained to me, this function was used in two ways: the first one was to select an interface based on its address, the second one was to check whether we are recipient for a datagram. The trick is that in IPv4 you are also recipient for broadcast addresses, and you can have differents interfaces with different addresses on the same subnet with the same broadcast address, so you end up with ambiguous lookups and extra code to check for broadcast matching. So broadcast matching was removed from ifa_ifwithaddr, and in_broadcast introduced in the few places broadcast matching was needed.

Then I went back on in_pcbbind and in6_pcbbind cleanup. Both use the same loop to pick a port number when unspecified, so I factored it out in a single function. I then had a better view on in_pcbbind and in6_pcbbind differences and similarities, so I drafted a diff to split the byte-shuffling from the proper sockaddr authorization checks. There is still some review and testing to be done for it to hit the tree, but once there, it will be very easy to implement IP_SENDSRCADDR.

Finally, I took a ride in the CVS time machine to understand why we had different IPv6 route lookups for unicast and multicast addresses. This was actually a leftover from a 15 years old commit that made sure we did not get RTM_MISSes storms when looking up multicast addresses. But times change, and RTM_MISS is no more. Thus the mysterious "if (IN6_IS_ADDR_MULTICAST(dst))"'s life came to an end, and people rejoiced and celebrated with songs and hot drinks from the Christmas market.

Thanks for the report, Vincent! The work looks promising indeed!

(Comments are closed)


Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]