OpenBSD Journal

n2k15: krw@ on fdisk, installboot, dhclient, GPT fixes

Contributed by tj on from the tourist-mode-deactivated dept.

The next n2k15 hackathon report comes from Ken Westerback (krw@).

Much like tedu@, the perfidy of the airline industry left me some status miles short of the goal line as the year end approached. There must be a hackathon somewhere ... Hannover!

Other than a brief excursion the wrong way down the street to my hotel the trip was uneventful. The hotel was nice and while the directions to the hackroom seemed odd (go to the end of the alley?) they worked. I pressed my nose up against the window and was admitted to k14. Now what was I going to do. Hmmm.

I first distracted mpi@ from his important network tasks with some USB bugs. This proved less than satisfying since he fixed them without even pausing in his network tasks. I guess I would have to do some actual hacking.

I first fixed a problem in fdisk(8) -i, which was not zapping any GPT remnants on the disk being initialized. Then I added a '-v' flag to fdisk, following a plea from kettenis@ that he needed to see everything on the disk in some circumstances.

Moving on to installboot(8) I added a missing check for the protective MBR before using any GPT information found. This was the 'suspender' part of a "belt & suspender" solution started by the previous paragraph. Now my MBR/GPT tests with softraid were much less confused as I moved from MBR to GPT formatting and back.

Next I whacked the install scripts and hoisted GPT up to the same level as MBR on the choice list for formatting a disk. This was driven largely by the need to occasionally create GPT/EFI install images from a non-EFI machine. It also significantly simplified the logic involved.

While in the install scripts I fixed a problem noticed by kettenis@, where the '(O)penBSD' option in the formatting option list was always accepted even when not offered to the user. Which blew up the install pretty good if you had accidentally typed 'O' at that point. Thanks to rpe@ and halex@ for support in the install scripts even though they could not attend the hackathon!

I fixed the compilation of special/ftp, the version of ftp used in the install images. Though I never figured out how or why it got broken.

Finally I moved on to dhclient(8). Or, mpi@'s revenge. First I removed the continuous routing domain check for the interface being controlled. The network stack now reliably issues an appropriate RTM_IFINFO message when the routing domain changes. This also helped the plan to pledge dhclient. I then committed the pledge diff from Ricardo Mestre.

Then, as the hackathon wrapped up and I thought it was safe to degrade into tourist mode ... mpi@ struck. He reported that his machine would hang during boot when dhclient was run. He tracked it down to having an address already configured on a different interface that was the same as the address dhclient was trying to configure. He suggested that dhclient should exit in this situation so the boot could at least complete. This suggestion produced screams of pain from beck@ and reyk@ and I had to dig into the details.

It turns out that dhclient is supposed to reply to ACK messages from the dhcp server with a DECLINE message when faced with a duplicate address. mpi@ kindly wrote the appropriate routing code dance for dhclient and I tweaked the state machine and lease handling appropriately. We now issue the appropriate DECLINE, making mpi@, beck@ and reyk@ all happy.

It was an excellent hackathon, with great accomodations, food, coffee and even a visit to the Christmas Fair. And for the first time, hackathon mugs! Many thanks to reyk@ and friends for everything.

Thanks as always for the report, Ken.

(Comments are closed)


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 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.]