- if ($rule =~ s/^-s (\S+)\s*//) {
- die "missing source" if !$pkg->{source};
- return undef if $pkg->{source} ne $1; # no match
- }
+ if ($rule =~ s/^--dport (\d+):(\d+)\s*//) {
+ die "missing dport" if !$pkg->{dport};
+ return undef if ($pkg->{dport} < $1) || ($pkg->{dport} > $2); # no match
+ next;
+ }
+
+ if ($rule =~ s/^--dport (\d+)\s*//) {
+ die "missing dport" if !$pkg->{dport};
+ return undef if $pkg->{dport} != $1; # no match
+ next;
+ }
+
+ if ($rule =~ s/^-s (\S+)\s*//) {
+ die "missing source" if !$pkg->{source};
+ my $ip = Net::IP->new($1);
+ return undef if !$ip->overlaps(Net::IP->new($pkg->{source})); # no match
+ next;
+ }