opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.28k stars 727 forks source link

DHCP6 fails on hostname 'code' #6428

Closed noci2012 closed 1 year ago

noci2012 commented 1 year ago

Important notices

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

Describe the bug

OPNsense fails to accept a hostname of 'code' After entering the name, the service fails with the error:

/status_services.php: The command '/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot /var/dhcpd -cf /etc/dhcpdv6.conf -pf /var/run/dhcpdv6.pid vlan013 vlan010 vlan012 vlan011 vlan014' returned exit code '1', the output was 'Internet Systems Consortium DHCP Server 4.4.3-P1 Copyright 2004-2022 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ /etc/dhcpdv6.conf line 75: option definitions may not be scoped. option host-name code; ^ Configuration file errors encountered -- exiting If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging. exiting.'

A clear and concise description of what the bug is, including last known working version (if any). This is a config copied from an existing configuration where ISC dhcp was already in use. There the hostnames are in " pairs... like: host-name "code";

Steps to reproduce the behavior:

  1. Go to Service DHCP6
  2. Create a host reservation for some Address
  3. use code as the hostnamemA clear and concise description of what you expected to happen.
  4. restart DHCP6 service .... and observe the logs.

Expected behavior

The hostname "code" is perfectly acceptable as a hostname.

Describe alternatives you considered Adding " to the hostname in the frontend..., which fails as " or ' are not acceptable for a hostname.

Relevant log files

General log entry shown above

Additional context

Add any other context about the problem here.

N.A.

Software version used and hardware type if relevant, e.g.: OPNsense 23.1.3_4-amd64

noci2012 commented 1 year ago

I guess ISC DHCP will fail on any hostname that looks like a keyword... (not checked).

swhite2 commented 1 year ago

Hi, could you try opnsense-patch 55dacd0f8 (https://github.com/opnsense/core/commit/55dacd0f84b9912970eba34d3e8c309984b6f769)?

With the way it was written to the conf file, it seems dhcpd considered it a reserved keyword.

fichtner commented 1 year ago

Shipping in 23.1.6 tomorrow. Thanks for the find @swhite2!

noci2012 commented 1 year ago

Solution probably works, not sure how to test such a change. (sorry for te delay). as double quote enclosed hostnames do work in my original (non OpnSense setup).