make mask nullable and do a strict compare to allow firwall rules without masks (#432)

This commit is contained in:
Tobias Schulz 2025-01-13 17:28:59 +01:00 committed by GitHub
parent a0940d4581
commit 93a7bf9c3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ public static function rules(): array
'ip',
],
'mask' => [
'required',
'nullable',
'numeric',
],
];

View File

@ -30,7 +30,7 @@ public function addRule(string $type, string $protocol, int $port, string $sourc
'protocol' => $protocol,
'port' => $port,
'source' => $source,
'mask' => $mask || $mask == 0 ? '/'.$mask : '',
'mask' => $mask || $mask === 0 ? '/'.$mask : '',
]),
'add-firewall-rule'
);
@ -44,7 +44,7 @@ public function removeRule(string $type, string $protocol, int $port, string $so
'protocol' => $protocol,
'port' => $port,
'source' => $source,
'mask' => $mask || $mask == 0 ? '/'.$mask : '',
'mask' => $mask || $mask === 0 ? '/'.$mask : '',
]),
'remove-firewall-rule'
);