diff options
author | Renato Botelho <renato@netgate.com> | 2016-07-13 16:55:39 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-07-13 16:55:39 -0300 |
commit | 9da88ef5a1eceddcaa149e0d196addcbf7e9fb3f (patch) | |
tree | 4c4d7862c5ad350aaf99e60d9b5181a2f013622c | |
parent | 0d9fc91cbf6167f58ad8f39460b2a1ba26287b4b (diff) | |
parent | 264ca54e406eee7c01b01f748aabd4a29e9c4872 (diff) | |
download | pfsense-9da88ef5a1eceddcaa149e0d196addcbf7e9fb3f.zip pfsense-9da88ef5a1eceddcaa149e0d196addcbf7e9fb3f.tar.gz |
Merge pull request #3020 from shieldwed/Allow_comma_in_DHCP_option_string
-rw-r--r-- | src/etc/inc/interfaces.inc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index a4d0825..83b1289 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,10 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) { return $dhclientconf; } +function DHCP_Config_Option_Split($option_string) { + preg_match_all('/[^",]*(?:"[^"]*"[^",]*)+(?:"[^",]*)?|[^,]+/m', $option_string, $matches, PREG_PATTERN_ORDER); + return $matches ? $matches[0] : []; +} function DHCP_Config_File_Override($wancfg, $wanif) { |