diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 0622fe3b6e5..3969efafc1a 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -341,6 +341,7 @@ EOD; if ($sm['hostname']) { $dhhostname = str_replace(" ", "_", $sm['hostname']); + $dhhostname = str_replace(".", "_", $dhhostname); $dhcpdconf .= " option host-name {$dhhostname};\n"; } diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index 1124e8fe3fc..e6870821ccd 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -109,8 +109,14 @@ function staticmaps_sort($ifgui) { /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); - if (($_POST['hostname'] && !is_hostname($_POST['hostname']))) { - $input_errors[] = "A valid host name must be specified."; + if ($_POST['hostname']) { + if (!is_hostname($_POST['hostname'])) { + $input_errors[] = "A valid host name must be specified."; + } else { + if (strpos($_POST['hostname'],'.')) { + $input_errors[] = "A valid hostname is specified, but the domain name part should be omitted"; + } + } } if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified.";