Commit e9edf729 authored by Franco Fichtner's avatar Franco Fichtner

dhcp: static v6 entries with domain support

parent be63780c
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("services.inc"); require_once("services.inc");
...@@ -36,7 +37,6 @@ function staticmapcmp($a, $b) ...@@ -36,7 +37,6 @@ function staticmapcmp($a, $b)
return ipcmp($a['ipaddrv6'], $b['ipaddrv6']); return ipcmp($a['ipaddrv6'], $b['ipaddrv6']);
} }
if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// handle identifiers and action // handle identifiers and action
if (!empty($_GET['if']) && !empty($config['interfaces'][$_GET['if']])) { if (!empty($_GET['if']) && !empty($config['interfaces'][$_GET['if']])) {
...@@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// read form data // read form data
$pconfig = array(); $pconfig = array();
$config_copy_fieldnames = array('duid', 'hostname', 'ipaddrv6', 'filename' ,'rootpath' ,'descr'); $config_copy_fieldnames = array('duid', 'hostname', 'ipaddrv6', 'filename' ,'rootpath' ,'descr', 'domain');
foreach ($config_copy_fieldnames as $fieldname) { foreach ($config_copy_fieldnames as $fieldname) {
if (isset($if) && isset($id) && isset($config['dhcpdv6'][$if]['staticmap'][$id][$fieldname])) { if (isset($if) && isset($id) && isset($config['dhcpdv6'][$if]['staticmap'][$id][$fieldname])) {
$pconfig[$fieldname] = $config['dhcpdv6'][$if]['staticmap'][$id][$fieldname]; $pconfig[$fieldname] = $config['dhcpdv6'][$if]['staticmap'][$id][$fieldname];
...@@ -61,7 +61,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -61,7 +61,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig[$fieldname] = null; $pconfig[$fieldname] = null;
} }
} }
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input_errors = array(); $input_errors = array();
$pconfig = $_POST; $pconfig = $_POST;
...@@ -118,7 +117,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -118,7 +117,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
if (count($input_errors) == 0) { if (count($input_errors) == 0) {
$mapent = array(); $mapent = array();
$config_copy_fieldnames = array('duid', 'ipaddrv6', 'hostname', 'descr', 'filename', 'rootpath'); $config_copy_fieldnames = array('duid', 'ipaddrv6', 'hostname', 'descr', 'filename', 'rootpath', 'domain');
foreach ($config_copy_fieldnames as $fieldname) { foreach ($config_copy_fieldnames as $fieldname) {
if (!empty($pconfig[$fieldname])) { if (!empty($pconfig[$fieldname])) {
$mapent[$fieldname] = $pconfig[$fieldname]; $mapent[$fieldname] = $pconfig[$fieldname];
...@@ -207,6 +206,15 @@ include("head.inc"); ...@@ -207,6 +206,15 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<td><a id="help_for_domain" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Domain name");?></td>
<td>
<input name="domain" type="text" value="<?=$pconfig['domain'];?>" />
<div class="hidden" for="help_for_domain">
<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
</div>
</td>
</tr>
<?php if (isset($config['dhcpdv6'][$if]['netboot'])): ?> <?php if (isset($config['dhcpdv6'][$if]['netboot'])): ?>
<tr> <tr>
<td><a id="help_for_filename" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Netboot filename') ?></td> <td><a id="help_for_filename" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Netboot filename') ?></td>
......
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