summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-03-20 12:32:07 -0400
committerSteve Beaver <sbeaver@netgate.com>2017-03-20 12:32:07 -0400
commitac31482873862f44a509d20f26c28f4647e99bbb (patch)
treec3c451fd2363c30eed8567faaede8a67ba6de7f6 /src/etc/inc
parent11800cffd5bd0731596324cd4d26f829bf198174 (diff)
parentbea1884125fdd9d8ef58afd97f53516b61adaf29 (diff)
downloadpfsense-ac31482873862f44a509d20f26c28f4647e99bbb.zip
pfsense-ac31482873862f44a509d20f26c28f4647e99bbb.tar.gz
Merge pull request #3642 from phil-davis/icmp-type-skip-redmine-7372
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/filter.inc4
-rw-r--r--src/etc/inc/util.inc17
2 files changed, 20 insertions, 1 deletions
diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc
index ef46c72..be68d03 100644
--- a/src/etc/inc/filter.inc
+++ b/src/etc/inc/filter.inc
@@ -2793,7 +2793,9 @@ function filter_generate_user_rule($rule) {
if ($rule['protocol'] == "icmp" && $rule['icmptype'] && ($rule['icmptype'] != 'any')) {
$icmptype_key = ($rule['ipprotocol'] == 'inet6' ? 'icmp6-type' : 'icmp-type');
- $icmptype_text = (strpos($rule['icmptype'], ",") === false ? $rule['icmptype'] : '{ ' . $rule['icmptype'] . ' }');
+ // XXX: Bug #7372
+ $icmptype_text = replace_element_in_list($rule['icmptype'], ',', 'skip', '39');
+ $icmptype_text = (strpos($icmptype_text, ",") === false ? $icmptype_text : '{ ' . $icmptype_text . ' }');
$aline[$icmptype_key] = "{$icmptype_key} {$icmptype_text} ";
}
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index 145b43c..4440bdc 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -2369,6 +2369,23 @@ function explode_assoc($delimiter, $string) {
return $result;
}
+/*
+ * Given a string of text with some delimiter, look for occurrences
+ * of some string and replace all of those.
+ * $text - the text string (e.g. "abc,defg,x123,ipv4,xyz")
+ * $delimiter - the delimiter (e.g. ",")
+ * $element - the element to match (e.g. "defg")
+ * $replacement - the string to replace it with (e.g. "42")
+ * Returns the resulting delimited string (e.g. "abc,42,x123,ipv4,xyz")
+ */
+function replace_element_in_list($text, $delimiter, $element, $replacement) {
+ $textArray = explode($delimiter, $text);
+ while (($entry = array_search($element, $textArray)) !== false) {
+ $textArray[$entry] = $replacement;
+ }
+ return implode(',', $textArray);
+}
+
/* Try to change a static route, if it doesn't exist, add it */
function route_add_or_change($args) {
global $config;
OpenPOWER on IntegriCloud