Commit bd29d862 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

dhcpd, add interface-mtu option, for https://github.com/opnsense/core/issues/1565

(cherry picked from commit 025021b8)
parent 163c9d1c
......@@ -676,6 +676,11 @@ EOPP;
&& (empty($dhcpifconf['maxleasetime']) || $poolconf['maxleasetime'] != $dhcpifconf['maxleasetime'])) {
$dhcpdconf .= " max-lease-time {$poolconf['maxleasetime']};\n";
}
// interface MTU
if (!empty($poolconf['interface_mtu'])
&& (empty($dhcpifconf['interface_mtu']) || $poolconf['interface_mtu'] != $dhcpifconf['interface_mtu'])) {
$dhcpdconf .= " option interface-mtu {$poolconf['interface_mtu']};\n";
}
// netbios-name*
if (!empty($poolconf['winsserver'][0])
......@@ -742,6 +747,10 @@ EOD;
if (!empty($dhcpifconf['maxleasetime'])) {
$dhcpdconf .= " max-lease-time {$dhcpifconf['maxleasetime']};\n";
}
// interface MTU
if (!empty($dhcpifconf['interface_mtu'])) {
$dhcpdconf .= " option interface-mtu {$dhcpifconf['interface_mtu']};\n";
}
// netbios-name*
if (!empty($dhcpifconf['winsserver'][0])) {
......
......@@ -97,7 +97,8 @@ function reconfigure_dhcpd()
$config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'dhcpleaseinlocaltime','descr',
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain',
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsupdate', 'mac_allow', 'mac_deny', 'tftp', 'ldap',
'netboot', 'nextserver', 'filename', 'filename32', 'filename64', 'rootpath', 'netmask', 'numberoptions');
'netboot', 'nextserver', 'filename', 'filename32', 'filename64', 'rootpath', 'netmask', 'numberoptions',
'interface_mtu');
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// handle identifiers and action
......@@ -322,6 +323,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['staticarp']) && $noip) {
$input_errors[] = gettext("Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.");
}
if (!empty($pconfig['interface_mtu']) && (
(string)((int)$pconfig['interface_mtu']) != $pconfig['interface_mtu'] || $pconfig['interface_mtu'] < 68)
) {
$input_errors[] = gettext("A valid MTU value must be specified.");
}
if(is_array($pconfig['numberoptions']['item'])) {
foreach ($pconfig['numberoptions']['item'] as $numberoption) {
......@@ -852,6 +858,15 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_interface_mtu" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Interface MTU");?></td>
<td>
<input name="interface_mtu" type="text" value="<?=$pconfig['interface_mtu']?>" />
<div class="hidden" for="help_for_interface_mtu">
<?=gettext('This option specifies the MTU to use on this interface. The minimum legal value for the MTU is 68.');?>
</div>
</td>
</tr>
<?php
if (!isset($pool) && !($act == "newpool")): ?>
<tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment