opnsense / src

OPNsense operating system on top of FreeBSD
https://opnsense.org/
Other
356 stars 151 forks source link

dhclient keeps complaining about unknown DHCP option #219

Open mvglasow opened 2 weeks ago

mvglasow commented 2 weeks ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

I keep getting the following error message in the log every time the IP config on the external interface is renewed (15 minutes with my ISP):

Error:dhclient:unknown dhcp option value 0x7d

To Reproduce

Steps to reproduce the behavior:

  1. Set up a network with a DHCP server.
  2. Configure the DHCP server to send an unknown DHCP option (0x7d is known to work)
  3. Configure a short timeout (under an hour) for DHCP leases.
  4. Configure OPNsense with DHCP on one interface, and connect it to the network with DHCP server configured in the previous steps.
  5. Observe the log

Expected behavior

I would expect dhclient to silently ignore any options it does not understand (standard parser behavior). If it does log a message at all, the log level should be Debug or Information at most, not Error.

Describe alternatives you considered

Reconfigure the DNS server to not set any obscure options OPNsense does not need or understand. However, the DNS server is beyond my control (I probably won’t get my ISP to configure their DHCP server the way I think it should be), and since lease times are such that renewals happen every 15 minutes, this really clutters up the logs. There may certainly be legit use cases why a DHCP server would specify DHCP options which OPNsense does not understand.

Screenshots

If applicable, add screenshots to help explain your problem.

Relevant log files

See above – it is really just one line.

Additional context

I’ve verified DHCP traffic with a packet capture tool, and the DHCP offer indeed does have the unsupported option in it.

The log entry has been around for a few versions and might have been present ever since I started using OPNsense on that particular ISP.

Should this not be the right place to file an issue against dhclient in OPNsense, feel free to move it or let me know where to report this.

Environment

OPNsense 24.7.3_1-amd64

fichtner commented 2 weeks ago

Feel free to take this to FreeBSD, this is a minor annoyance at best.

mvglasow commented 2 weeks ago

Done, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281361.

mvglasow commented 3 days ago

A patch has been suggested for FreeBSD, which silences warnings for this specific DHCP option; the same has been done for other DHCP options before. Once this gets merged (if it does, see below), receiving this particular DHCP option will not cause any more error messages in the log.

There seems to be some discussion among the FreeBSD folks regarding this approach, as the list of options to ignore is likely to grow further.

The workaround for this kind of behavior is to add

ignore option-125;

in the dhclient.conf file. On OPNsense, I understand, this would go into /var/etc/dhclient.{$IFNAME}.conf. However, this change does not take effect immediately, and when I bring the interface down and up again, the config file gets recreated (and this kind of under-the-hood tinkering probably wasn’t a good idea to begin with, for a number of reasons).

I just took a look at the GUI (Interfaces > [{$IFNAME}] > DHCP client configuration), and even in Advanced mode, the GUI does not offer an option for this – I would have to use Config File Override and supply an entire config file from scratch.

Should the fix get rejected in FreeBSD, I would suggest exposing the ignore DHCP client option in the advanced GUI – or being able to add custom options to an otherwise autogenerated config. Even with the fix for 0x7d merged into FreeBSD, having one of these configuration options would be useful, as I might not be the last user to have this issue and this particular DHCP option might not be the only one to trigger it.