summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2016-06-23 00:34:18 +0200
committerRenato Botelho <renato@netgate.com>2016-07-13 16:56:58 -0300
commit489091dcf7c8bebbe9f6f722057c985a8d938295 (patch)
treec3cfcba058fcc08c39b97d0daf6de3a671b3529a
parenta8f2442995f323d84bcf366d4ad5f404f0a50e8f (diff)
downloadpfsense-489091dcf7c8bebbe9f6f722057c985a8d938295.zip
pfsense-489091dcf7c8bebbe9f6f722057c985a8d938295.tar.gz
Allow passing comma in string quoted DHCP client options
(cherry picked from commit 332a64d0c8a6486d40c6295351ca3068a77a216a)
-rw-r--r--src/etc/inc/interfaces.inc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index e845c29..1bbb438 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -4027,7 +4027,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) {
$send_options = "";
if ($wancfg['adv_dhcp6_interface_statement_send_options'] != '') {
- $options = explode(',', $wancfg['adv_dhcp6_interface_statement_send_options']);
+ $options = DHCP_Config_Option_Split($wancfg['adv_dhcp6_interface_statement_send_options']);
foreach ($options as $option) {
$send_options .= "\tsend " . trim($option) . ";\n";
}
@@ -4035,7 +4035,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) {
$request_options = "";
if ($wancfg['adv_dhcp6_interface_statement_request_options'] != '') {
- $options = explode(',', $wancfg['adv_dhcp6_interface_statement_request_options']);
+ $options = DHCP_Config_Option_Split($wancfg['adv_dhcp6_interface_statement_request_options']);
foreach ($options as $option) {
$request_options .= "\trequest " . trim($option) . ";\n";
}
@@ -4305,7 +4305,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
$send_options = "";
if ($wancfg['adv_dhcp_send_options'] != '') {
- $options = explode(',', $wancfg['adv_dhcp_send_options']);
+ $options = DHCP_Config_Option_Split($wancfg['adv_dhcp_send_options']);
foreach ($options as $option) {
$send_options .= "\tsend " . trim($option) . ";\n";
}
@@ -4323,7 +4323,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
$option_modifiers = "";
if ($wancfg['adv_dhcp_option_modifiers'] != '') {
- $modifiers = explode(',', $wancfg['adv_dhcp_option_modifiers']);
+ $modifiers = DHCP_Config_Option_Split($wancfg['adv_dhcp_option_modifiers']);
foreach ($modifiers as $modifier) {
$option_modifiers .= "\t" . trim($modifier) . ";\n";
}
@@ -4357,6 +4357,14 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
return $dhclientconf;
}
+function DHCP_Config_Option_Split($option_string) {
+ $options = [];
+ preg_match_all('/[^",]*(?:"[^"]*"[^",]*)+(?:"[^",]*)?|[^,]+/m', $option_string, $result, PREG_PATTERN_ORDER);
+ for ($i = 0; $i < count($result[0]); $i++) {
+ $options[] = $result[0][$i];
+ }
+ return $options;
+}
function DHCP_Config_File_Override($wancfg, $wanif) {
OpenPOWER on IntegriCloud