summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-12-30 15:46:30 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-12-30 15:46:52 -0500
commit8dccfb20643cfda6b55429177410e6c66fcf0bbd (patch)
tree8f54d9aa21c53b70f0cd83b15ee5ca935584a61e
parentdae9ce3f4edd25bf13dc462f2503fdd112cbd2d9 (diff)
downloadpfsense-8dccfb20643cfda6b55429177410e6c66fcf0bbd.zip
pfsense-8dccfb20643cfda6b55429177410e6c66fcf0bbd.tar.gz
Fixed #5717
-rw-r--r--src/usr/local/www/services_dhcp_relay.php10
-rw-r--r--src/usr/local/www/services_dhcpv6_relay.php45
2 files changed, 27 insertions, 28 deletions
diff --git a/src/usr/local/www/services_dhcp_relay.php b/src/usr/local/www/services_dhcp_relay.php
index e1f287d..ada2eae 100644
--- a/src/usr/local/www/services_dhcp_relay.php
+++ b/src/usr/local/www/services_dhcp_relay.php
@@ -100,6 +100,7 @@ if (is_array($config['dhcpd'])) {
}
if ($_POST) {
+
unset($input_errors);
$pconfig = $_POST;
@@ -137,7 +138,7 @@ if ($_POST) {
$config['dhcrelay']['enable'] = $_POST['enable'] ? true : false;
$config['dhcrelay']['interface'] = implode(",", $_POST['interface']);
$config['dhcrelay']['agentoption'] = $_POST['agentoption'] ? true : false;
- $config['dhcrelay']['server'] = $pconfig['server'];
+ $config['dhcrelay']['server'] = $svrlist;
write_config();
@@ -189,7 +190,6 @@ $section->addInput(new Form_Checkbox(
'agentoption',
'',
'Append circuit ID and agent ID to requests',
- 'yes',
$pconfig['agentoption']
))->setHelp(
'If this is checked, the DHCP relay will append the circuit ID (%s interface number) and the agent ID to the DHCP request.',
@@ -204,9 +204,9 @@ function createDestinationServerInputGroup($value = null) {
'server',
'Destination server',
$value
- ))->setWidth(4)->setHelp(
- 'This is the IP address of the server to which DHCP requests are relayed.'
- )->setIsRepeated();
+ ))->setWidth(4)
+ ->setHelp('This is the IP address of the server to which DHCP requests are relayed.')
+ ->setIsRepeated();
$group->enableDuplication(null, true); // Buttons are in-line with the input
return $group;
diff --git a/src/usr/local/www/services_dhcpv6_relay.php b/src/usr/local/www/services_dhcpv6_relay.php
index 77b9a0e..62a4f5b 100644
--- a/src/usr/local/www/services_dhcpv6_relay.php
+++ b/src/usr/local/www/services_dhcpv6_relay.php
@@ -63,23 +63,15 @@
##|-PRIV
require("guiconfig.inc");
-function filterDestinationServers(array $destinationServers) {
- return array_unique(
- array_filter($destinationServers)
- );
-}
$pconfig['enable'] = isset($config['dhcrelay6']['enable']);
+
if (empty($config['dhcrelay6']['interface'])) {
$pconfig['interface'] = array();
} else {
$pconfig['interface'] = explode(",", $config['dhcrelay6']['interface']);
}
-$pconfig['server'] = filterDestinationServers(
- explode(',', $config['dhcrelay6']['server'])
-);
-
$pconfig['agentoption'] = isset($config['dhcrelay6']['agentoption']);
$iflist = array_intersect_key(
@@ -112,10 +104,6 @@ if ($_POST) {
unset($input_errors);
- if ($_POST['server']) {
- $_POST['server'] = filterDestinationServers($_POST['server']);
- }
-
$pconfig = $_POST;
/* input validation */
@@ -125,11 +113,22 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+ $svrlist = '';
+
if ($_POST['server']) {
- foreach ($_POST['server'] as $srv) {
- if (!is_ipaddrv6($srv)) {
+ foreach ($_POST['server'] as $checksrv => $srv) {
+ if (!is_ipaddrv6($srv[0])) {
$input_errors[] = gettext("A valid Destination Server IPv6 address must be specified.");
}
+
+
+ if (!empty($srv[0])) { // Filter out any empties
+ if (!empty($svrlist)) {
+ $svrlist .= ',';
+ }
+
+ $svrlist .= $srv[0];
+ }
}
}
}
@@ -138,7 +137,7 @@ if ($_POST) {
$config['dhcrelay6']['enable'] = $_POST['enable'] ? true : false;
$config['dhcrelay6']['interface'] = implode(",", $_POST['interface']);
$config['dhcrelay6']['agentoption'] = $_POST['agentoption'] ? true : false;
- $config['dhcrelay6']['server'] = $_POST['server'];
+ $config['dhcrelay6']['server'] = $svrlist;
write_config();
@@ -190,7 +189,6 @@ $section->addInput(new Form_Checkbox(
'agentoption',
'',
'Append circuit ID and agent ID to requests',
- 'yes',
$pconfig['agentoption']
))->setHelp(
'If this is checked, the DHCPv6 relay will append the circuit ID (%s interface number) and the agent ID to the DHCPv6 request.',
@@ -199,15 +197,16 @@ $section->addInput(new Form_Checkbox(
function createDestinationServerInputGroup($value = null) {
$group = new Form_Group('Destination server');
- $group->enableDuplication();
$group->add(new Form_IpAddress(
'server',
'Destination server',
$value
- ))->setHelp(
- 'This is the IPv6 address of the server to which DHCPv6 requests are relayed.'
- )->setIsRepeated();
+ ))->setWidth(4)
+ ->setHelp('This is the IPv6 address of the server to which DHCPv6 requests are relayed.')
+ ->setIsRepeated();
+
+ $group->enableDuplication(null, true); // Buttons are in-line with the input
return $group;
}
@@ -215,8 +214,8 @@ function createDestinationServerInputGroup($value = null) {
if (!isset($pconfig['server']) || count($pconfig['server']) < 1) {
$section->add(createDestinationServerInputGroup());
} else {
- foreach ($pconfig['server'] as $idx => $server) {
- $section->add(createDestinationServerInputGroup($server));
+ foreach ($pconfig['server'] as $server) {
+ $section->add(createDestinationServerInputGroup($server[0]));
}
}
OpenPOWER on IntegriCloud