diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Firewall/forms/dialogFilterRule.xml b/src/opnsense/mvc/app/controllers/OPNsense/Firewall/forms/dialogFilterRule.xml index 74f5860f11..249796623e 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Firewall/forms/dialogFilterRule.xml +++ b/src/opnsense/mvc/app/controllers/OPNsense/Firewall/forms/dialogFilterRule.xml @@ -199,6 +199,13 @@ Limits the maximum number of simultaneous state entries that a single source address can create with this rule. true + + rule.max-src-conn + + text + Limit the maximum number of simultaneous TCP connections which have completed the 3-way handshake that a single host can make. + true + rule.nopfsync diff --git a/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php b/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php index 282a7e028e..0bcfbff113 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php +++ b/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php @@ -120,7 +120,8 @@ public function performValidation($validateFullModel = false) } if ($rule->statetype == 'none') { foreach ([ - 'statetimeout', 'max', 'max-src-states', 'max-src-nodes', 'adaptivestart', 'adaptiveend' + 'statetimeout', 'max', 'max-src-states', 'max-src-nodes', 'adaptivestart', 'adaptiveend', + 'max-src-conn' ] as $fieldname) { if (!empty((string)$rule->$fieldname)) { $messages->appendMessage(new Message( @@ -130,11 +131,15 @@ public function performValidation($validateFullModel = false) } } } - if (!in_array($rule->protocol, ['TCP', 'TCP/UDP']) && !empty((string)$rule->statetimeout)) { - $messages->appendMessage(new Message( - gettext("You can only specify the state timeout (advanced option) for TCP protocol."), - $rule->statetimeout->__reference - )); + if (!in_array($rule->protocol, ['TCP', 'TCP/UDP'])) { + foreach (['statetimeout', 'max-src-conn'] as $fieldname) { + if (!empty((string)$rule->$fieldname)) { + $messages->appendMessage(new Message( + gettext("Invalid option for other than TCP protocol choices."), + $rule->$fieldname->__reference + )); + } + } } if (empty((string)$rule->max) && ($rule->adaptivestart == '0' || $rule->adaptiveend == '0')) { $messages->appendMessage(new Message( diff --git a/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.xml b/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.xml index bfc8b5ca36..007ce0e835 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.xml @@ -152,6 +152,9 @@ 1 + + 1 + 1