"." in hostname creates invalid dhcpd.conf
Creating a reservation with a FQDN results in an invalid dhcpd.conf.
php: /services_dhcp.php: The command '/usr/local/sbin/dhcpd
user dhcpd -group _dhcp -chroot /var/dhcpd -cf /var/dhcpd/etc/dhcpd.conf em1' returned exit code '1', the output was 'Internet Systems Consortium DHCP Server V3.0.7 Copyright 2004-2008 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ /var/dhcpd/etc/dhcpd.conf line 30: semicolon expected. option host-name blah. ^ Configuration file errors encountered - exiting'
The dhcpd.conf line is:
option host-name blah.blah.com;
That's an incorrect configuration, but 1.2.x accepts it and does work fine with such a configuration, so this will break some installs on upgrade.
#2 Updated by Chris Buechler over 10 years ago
The first part is good.
On the second, I would prefer to avoid changing people's configuration. If they already have a FQDN in the config, assuming it's the periods that are hosing dhcpd, just strip the periods before writing out that field in dhcpd.conf. i.e. if they have blah.blah.com in there just make it blahblahcom. Then the input validation would prevent them from saving any changes to that reservation on 2.0, which is fine.
One reason being there's no telling what some people may have in their configuration. If someone has host.example.com, host.example.net, and host.example.org, if you strip the domain you're left with three with just 'host'.
#3 Updated by Pierre POMES over 10 years ago
My cloned repo is updated with the first part. For the second one, you are right, I will follow your advices, and request a merge once it will be ok.
There is another issue in services_dhcp_edit.php, affecting all pfsense versions: the host name verification is done on $_POST['host'], however the field name in the HTML form is 'hostname'. This means you can easily break the dhcp server config because the hostname is not verified at all. I guess this needs to be fixed en RELENG_1_2 ?
#6 Updated by Pierre POMES over 10 years ago
why does the config need to be upgraded?
As you mentionned in earlier post of this tickets, the '.' in static mappings should be removed when upgrading from 1.2 to 2.0 (blah.blah.com should me rewritten to blahblahcom). Otherwise, dhcp server won't start after the upgrade. That's why I propose to wrote an upgrade function.
#7 Updated by Chris Buechler over 10 years ago
Oh, I didn't mean changing the actual entries in the config.xml. Just when they're written out from the config.xml to the dhcpd.conf, strip them then. We prefer to avoid changing configurations as much as possible since that can potentially introduce serious bugs.