From f23f455bc440e46ba086f599b4dd73111f1353fb Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 25 Sep 2023 10:42:00 +0200 Subject: [PATCH] firewall: improve previous by reusing a class constant #6880 --- src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php | 2 +- .../mvc/app/library/OPNsense/Firewall/FilterRule.php | 2 +- .../mvc/app/library/OPNsense/Firewall/ForwardRule.php | 4 ++-- src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php | 5 ++++- src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php index 544029da8..6d87d7a10 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php @@ -58,7 +58,7 @@ class DNatRule extends Rule 'nat' => 'parseStaticText,nat ', 'interface' => 'parseInterface', 'ipprotocol' => 'parsePlain', - 'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}|a/n:"a/n",proto ', + 'protocol' => self::PARSE_PROTO, 'interface.from' => 'parseInterface, from (,:network)', 'from' => 'parsePlainCurly,to ', 'interface.to' => 'parseInterface, -> (,)', diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php index aaa1268cb..1ddbef8a7 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php @@ -46,7 +46,7 @@ class FilterRule extends Rule 'gateway' => 'parseRoute', 'reply' => 'parsePlain', 'ipprotocol' => 'parsePlain', - 'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}|a/n:"a/n",proto ', + 'protocol' => self::PARSE_PROTO, 'from' => 'parsePlainCurly,from ', 'from_port' => 'parsePlainCurly, port ', 'os' => 'parsePlain, os {","}', diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/ForwardRule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/ForwardRule.php index 17819327e..407f3b162 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/ForwardRule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/ForwardRule.php @@ -42,7 +42,7 @@ class ForwardRule extends Rule 'log' => 'parseBool,log ', 'interface' => 'parseInterface', 'ipprotocol' => 'parsePlain', - 'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}|a/n:"a/n",proto ', + 'protocol' => self::PARSE_PROTO, 'from' => 'parsePlainCurly,from ', 'from_port' => 'parsePlainCurly, port ', 'to' => 'parsePlainCurly,to ', @@ -59,7 +59,7 @@ class ForwardRule extends Rule 'nat' => 'parseStaticText,nat ', 'interface' => 'parseInterface', 'ipprotocol' => 'parsePlain', - 'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}|a/n:"a/n",proto ', + 'protocol' => self::PARSE_PROTO, 'interface.from' => 'parseInterface, from (,:network)', 'target.to' => 'parsePlainCurly,to ', 'localport' => 'parsePlainCurly,port ', diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php index 0ce3c1950..079ba63c9 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php @@ -1,7 +1,7 @@ 'parseBool,log', 'interface' => 'parseInterface', 'ipprotocol' => 'parsePlain', - 'protocol' => 'parseReplaceSimple,tcp/udp:{tcp udp}|a/n:"a/n",proto ', + 'protocol' => self::PARSE_PROTO, 'from' => 'parsePlain,from ', 'sourceport' => 'parsePlain, port ', 'to' => 'parsePlain,to ',