Bug 184117 - dhclient(8): dhclient does not parse /etc/dhclient.conf correctly
Summary: dhclient(8): dhclient does not parse /etc/dhclient.conf correctly
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Conrad Meyer
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-11-20 12:30 UTC by Tomek CEDRO
Modified: 2016-09-20 19:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomek CEDRO 2013-11-20 12:30:01 UTC
I need to send additional options with dhcp request, so I add "send"
option for an interface in /etc/dhclient.conf, however options are non-
standard and they are not sent in dhcp request. I have noticed that
other options with names known to dhcp-options and other decimal numbers
are sent correctly...

These options work with isc-42-dhcp-client port as they know the string
alias for the option number...

I would expect base dhclient to work with any "option-nnn" decimal value
provided, no matter if the string alias is defined for this option or not
and what is the current IETF document release based upon :-)


Accorging to dhcp-options manual:

     The documentation for the various options mentioned below is taken from
     the IETF draft document on DHCP options, RFC 2132.  Options which are not
     listed by name may be defined by the name option-nnn, where nnn is the
     decimal number of the option code.  These options may be followed either
     by a string, enclosed in quotes, or by a series of octets, expressed as
     two-digit hexadecimal numbers separated by colons.  For example:

           option option-133 "my-option-133-text";
           option option-129 1:54:c9:2b:47;

     Because dhcpd(8) does not know the format of these undefined option
     codes, no checking is done to ensure the correctness of the entered data.

Fix: 

I expect dhclient to work with any "option-nnn" decimal value provided,
no matter if the string alias is defined for this option or not and what
is the current IETF document release based upon, that would make software
more versatile and consistent :-) Thank you :-)
How-To-Repeat: Here is my example /etc/dhclient.conf configuation:

interface "em0"{
 send option-060 "vendor"; <-- does not go out in dhcp request
 send option-077 "user"; <-- does not go out in dhcp request
 send option-123 "blah123"; <-- goes out in dhcp request
 send root-path "blahroot"; <-- goes out in dhcp request
}
Comment 1 Mark Linimon 2013-11-21 06:19:51 UTC
----- Forwarded message from Lowell Gilbert <freebsd-bugs-local@be-well.ilk.org> -----

Date: Wed, 20 Nov 2013 09:57:53 -0500
From: Lowell Gilbert <freebsd-bugs-local@be-well.ilk.org>
To: freebsd-bugs@freebsd.org
Subject: Re: misc/184117: dhclient does not parse /etc/dhclient.conf correctly
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix)

Making all options work with the "option-nnn" syntax would best be done
by importing a newer version of the ISC code. For defined option types,
it's better to use the official names because that way type handling is
enabled as well.

The user-class option is not in the dhcp_option_default_priority_list
array in sbin/dhclient/tables.c. Adding it (DHO_DHCP_USER_CLASS_ID) will
make the user-class option work. I.E.:

--- tables.c.~1~    2013-11-20 09:52:25.521743815 -0500
+++ tables.c        2013-11-20 09:53:33.733663843 -0500
@@ -365,6 +365,7 @@
	DHO_INTERFACE_MTU,
	DHO_ALL_SUBNETS_LOCAL,
	DHO_BROADCAST_ADDRESS,
+        DHO_DHCP_USER_CLASS_ID
	DHO_PERFORM_MASK_DISCOVERY,
	DHO_MASK_SUPPLIER,
	DHO_ROUTER_DISCOVERY,

_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"


----- End forwarded message -----
Comment 2 Conrad Meyer freebsd_committer 2016-09-17 21:06:52 UTC
https://reviews.freebsd.org/D7911
Comment 3 commit-hook freebsd_committer 2016-09-20 19:22:27 UTC
A commit references this bug:

Author: cem
Date: Tue Sep 20 19:21:41 UTC 2016
New revision: 306053
URL: https://svnweb.freebsd.org/changeset/base/306053

Log:
  dhclient(8): Enable numbered user class ID option

  By adding it to the option priorities table.

  PR:		184117
  Submitted by:	Lowell Gilbert <freebsd-bugs-local at be-well.ilk.org>
  Reported by:	Tomek CEDRO <cederom at tlen.pl>
  Reviewed by:	jhb
  Differential Revision:	https://reviews.freebsd.org/D7911

Changes:
  head/sbin/dhclient/tables.c