]> git.proxmox.com Git - pve-firewall.git/commit
fix and improve multiport handling
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 12 Mar 2018 10:55:18 +0000 (11:55 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 12 Mar 2018 11:24:37 +0000 (12:24 +0100)
commitf776d6de5724a296c575b18298e866076fce1ae6
tree194ed0030909a6d473f6febb90c1461e7b126a5d
parent8c41d44438d37eef807413270b5db7be9e8baf10
fix and improve multiport handling

The multiport `--ports` parameter is an `OR` match on source
and destination ports, so we should not use it.

We also don't actually use the port count, so let the port
range parser simply return a boolean and use the counter
only for the internal check. This also fixes a regression
caused by the previous multiport check which caused a single
port range to be recognized as a multiport option while it
did not have to be one, causing entries such as the SMB
macro to be added with `--match multiport` mistakenly, which
refused to accept the source port option.

Additionally, we now allow the case with 1 multiport and 1
single port entry: In order for the iptables command to
accept this the single port entry must come first, otherwise
it'll be passed to the multiport matcher (because why
shouldn't it interpret a singular `--Xport` as an alias to
the plural version `--Xports`... *sigh*).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 6a241ca745f7 ("check multiport limit in port ranges")
src/PVE/Firewall.pm