15 ports.
The iptables multiport only supports up to 15 ports (ranges costs more).
To avoid this kind of limitation, now an ipset set will be used which
could handle up to 65k ports at once.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
}
}
if($prot ne 'ICMP'){
- if ($#ips gt 0){$back="-m multiport --dports ";}else{$back="--dport ";}
- }elsif ($prot eq 'ICMP'){
+ # Get amount of ports.
+ my $amount = @ips;
+
+ if ($amount eq 1) {
+ $back = "--dport ";
+ } elsif ($amount > 1 and $amount <= 15) {
+ $back = "-m multiport --dports ";
+ } else {
+ return "-m set --match-set $val\_$prot dst";
+ }
+ } elsif ($prot eq 'ICMP'){
$back="--icmp-type ";
}