Commit dbaf457b authored by Ad Schellevis's avatar Ad Schellevis

(legacy) Unable to use commas in advanced DHCP client options...

(legacy) Unable to use commas in advanced DHCP client options https://github.com/opnsense/core/issues/530
parent 72a32731
...@@ -3570,7 +3570,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) ...@@ -3570,7 +3570,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
{ {
$send_options = ""; $send_options = "";
if ($wancfg['adv_dhcp6_interface_statement_send_options'] != '') { if ($wancfg['adv_dhcp6_interface_statement_send_options'] != '') {
$options = split(",", $wancfg['adv_dhcp6_interface_statement_send_options']); $options = preg_split('/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/', $wancfg['adv_dhcp6_interface_statement_send_options']);
foreach ($options as $option) { foreach ($options as $option) {
$send_options .= "\tsend " . trim($option) . ";\n"; $send_options .= "\tsend " . trim($option) . ";\n";
} }
...@@ -3578,7 +3578,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) ...@@ -3578,7 +3578,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif)
$request_options = ""; $request_options = "";
if ($wancfg['adv_dhcp6_interface_statement_request_options'] != '') { if ($wancfg['adv_dhcp6_interface_statement_request_options'] != '') {
$options = split(",", $wancfg['adv_dhcp6_interface_statement_request_options']); $options = preg_split('/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/', $wancfg['adv_dhcp6_interface_statement_request_options']);
foreach ($options as $option) { foreach ($options as $option) {
$request_options .= "\trequest " . trim($option) . ";\n"; $request_options .= "\trequest " . trim($option) . ";\n";
} }
...@@ -3830,7 +3830,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) { ...@@ -3830,7 +3830,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
$send_options = ""; $send_options = "";
if ($wancfg['adv_dhcp_send_options'] != '') { if ($wancfg['adv_dhcp_send_options'] != '') {
$options = split(",", $wancfg['adv_dhcp_send_options']); $options = preg_split('/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/', $wancfg['adv_dhcp_send_options']);
foreach ($options as $option) { foreach ($options as $option) {
$send_options .= "\tsend " . trim($option) . ";\n"; $send_options .= "\tsend " . trim($option) . ";\n";
} }
...@@ -3848,7 +3848,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) { ...@@ -3848,7 +3848,7 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
$option_modifiers = ""; $option_modifiers = "";
if ($wancfg['adv_dhcp_option_modifiers'] != '') { if ($wancfg['adv_dhcp_option_modifiers'] != '') {
$modifiers = split(",", $wancfg['adv_dhcp_option_modifiers']); $modifiers = preg_split('/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/', $wancfg['adv_dhcp_option_modifiers']);
foreach ($modifiers as $modifier) { foreach ($modifiers as $modifier) {
$option_modifiers .= "\t" . trim($modifier) . ";\n"; $option_modifiers .= "\t" . trim($modifier) . ";\n";
} }
......
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