Subject: found a bug in dhclient
To: None <current-users@netbsd.org>
From: Laine Stump <lainestump@rcn.com>
List: current-users
Date: 02/16/2001 00:15:41
(I just filed a PR about this but don't know how closely those are
followed on a day-to-day basis by the relevant parties (hi Ted!)...

RCN installed a new DOCSIS-compliant cable modem today, and I started
having to deal with some new DHCP server on their network which was
reliably coredumping the dhclient in -current. I tracked this down to
two causes, both tickled by this new server sending an option 82
"relay-agent-information".

1) relay-agent-information has a "format" field (in
   table.c:dhcp_options[]) of "Eagent.", so
   options.c:parse_encapsulated_suboptions() looks for a universe
   called "agent", which doesn't exist. This function should return 0
   if no universe is found, but unfortunately the variable "universe"
   isn't initialized to 0, so that test always fails.

   I fixed this problem by changing options.c:188 to

        struct universe *universe = 0;

2) Even after (1) is fixed, options.c:pretty_print_option() still
   causes a failure due to this same option. I didn't have time to
   track this down completely, but found that if I just added:

      if (code == 82)
           return "<bad stuff>";

   at the top of pretty_print_option(), dhclient at least begins
   working properly.

BTW, I can provide a packet dump of the dhcp response, or a rear-door
into this machine (I have DSL too) and root access if it would help to
figure out the details of item (2).