Branch Coverage

blib/lib/IPTables/Rule.pm
Criterion Covered Total %
branch 175 280 62.5


line true false branch
73 7 12 if defined $self->{$key}
88 3 0 if ($arg)
89 1 2 unless ($arg =~ m[\A/.+\z])
103 3 0 if ($arg)
104 1 2 unless ($arg =~ m[\A/.+\z])
118 14 0 if ($arg)
119 2 12 unless ($arg =~ /\A-[ADIRLSFZNXPE]\z/)
133 12 0 if ($arg)
135 4 8 unless ($arg =~ /\A[46]\z/)
150 8 0 if ($arg)
152 0 8 if $self->{'ipver'} eq '4' and not $arg =~ /\A(filter|nat|mangle|raw)\z/i
153 0 8 if $self->{'ipver'} eq '6' and not $arg =~ /\A(filter|mangle|raw)\z/i
154 0 8 if ($need_to_barf)
169 8 0 if ($arg)
180 10 0 if ($arg)
192 11 0 if ($arg)
193 0 11 unless ($arg =~ /\A[a-z0-9]+\z/)
197 1 10 if ($self->{'ipver'} eq '6' and $arg eq 'icmp')
201 1 9 if ($self->{'ipver'} eq '4' and $arg eq 'icmpv6')
216 9 0 if ($arg)
227 8 0 if ($arg)
239 17 0 if ($arg)
240 7 4 unless (__is_valid_inet_host($arg) or __is_valid_inet_cidr($arg) or __is_valid_inet_range($arg))
261 16 0 if ($arg)
262 7 3 unless (__is_valid_inet_host($arg) or __is_valid_inet_cidr($arg) or __is_valid_inet_range($arg))
283 14 0 if ($arg)
284 5 9 unless (__is_valid_inet_port($arg))
300 11 0 if ($arg)
301 5 6 unless (__is_valid_inet_port($arg))
316 4 0 if ($arg)
317 3 1 unless (__is_valid_mac_address($arg))
332 11 0 if ($arg)
335 3 11 unless ($_ =~ /\A(NEW|ESTABLISHED|RELATED|INVALID|UNTRACKED)\z/i)
351 17 0 if ($arg)
353 6 11 unless ($arg =~ m[\A\d+/(s(ec(ond)?)?|m(in(ute)?)?|h(our)?|d(ay)?)\z]i)
367 10 0 if ($arg)
368 2 8 unless ($arg =~ m[\A[a-z0-9\-]+(/[a-z0-9\-]+)?\z]i)
385 6 0 if ($arg)
386 3 3 if (length $arg > $max_length)
390 0 3 if ($arg =~ /[\"\']/)
407 7 0 if ($arg)
408 1 6 if (length $arg > $max_length)
412 1 5 if ($arg =~ /[\"\']/)
428 0 6 unless ($self->{'chain'})
433 0 6 if (defined $self->{'spt'} and not $self->{'proto'} =~ /\A(tcp|udp)\z/i)
437 0 6 if (defined $self->{'dpt'} and not $self->{'proto'} =~ /\A(tcp|udp)\z/i)
442 0 6 if (defined $self->{'logprefix'} and not $self->{'target'} =~ /\Alog\z/i)
447 5 1 if ($self->{'ipver'} eq '4') { }
1 0 elsif ($self->{'ipver'} eq '6') { }
448 1 4 if ($self->{'src'})
450 1 0 unless (__is_valid_inet4($self->{'src'}))
455 0 4 if ($self->{'dst'})
457 0 0 unless (__is_valid_inet4($self->{'dst'}))
463 1 0 if ($self->{'src'})
465 1 0 unless (__is_valid_inet6($self->{'src'}))
470 0 0 if ($self->{'dst'})
472 0 0 unless (__is_valid_inet6($self->{'dst'}))
483 0 4 if (defined $self->{'icmp_type'} and not $self->{'proto'} =~ /\Aicmp(v6)?\z/i)
491 4 0 if $self->{'ipver'} eq '4'
492 0 4 if $self->{'ipver'} eq '6'
493 2 2 if defined $self->{'table'}
498 0 4 if (defined $self->{'src'})
499 0 0 if (__is_valid_inet_host($self->{'src'}) or __is_valid_inet_cidr($self->{'src'}))
502 0 0 if (__is_valid_inet_range($self->{'src'}))
506 0 4 if (defined $self->{'dst'})
507 0 0 if (__is_valid_inet_host($self->{'dst'}) or __is_valid_inet_cidr($self->{'dst'}))
510 0 0 if (__is_valid_inet_range($self->{'dst'}))
517 1 3 if defined $self->{'proto'}
520 0 4 if (defined $self->{'spt'})
521 0 0 if ($self->{'spt'} =~ /\A\w+\z/)
525 0 0 if ($self->{'spt'} =~ /\A\w+(:\w+)+\z/)
529 0 0 if ($self->{'spt'} =~ /\A\w+(:\w+)+\z/)
534 1 3 if (defined $self->{'dpt'})
535 1 0 if ($self->{'dpt'} =~ /\A\w+\z/)
539 0 1 if ($self->{'dpt'} =~ /\A\w+(:\w+)+\z/)
543 0 1 if ($self->{'dpt'} =~ /\A\w+(:\w+)+\z/)
549 3 1 if defined $self->{'in'}
550 1 3 if defined $self->{'out'}
551 0 4 if defined $self->{'mac'}
552 1 3 if defined $self->{'state'}
553 0 4 if defined $self->{'icmp_type'}
554 3 1 if defined $self->{'comment'}
555 0 4 if defined $self->{'limit'}
556 4 0 if defined $self->{'target'}
557 0 4 if defined $self->{'logprefix'}
577 0 4 unless $arg
579 1 3 if ($arg =~ /\A$qr_mac_addr\z/)
591 0 1 unless $arg
594 0 1 if __is_inet4_host($arg)
597 0 1 if __is_inet4_cidr($arg)
600 0 1 if __is_inet4_range($arg)
603 0 1 if $arg =~ /\A$qr_fqdn\z/
613 0 1 unless $arg
616 0 1 if __is_inet6_host($arg)
619 0 1 if __is_inet6_cidr($arg)
622 0 1 if __is_inet6_range($arg)
625 0 1 if $arg =~ /\A$qr_fqdn\z/
635 0 33 unless $arg
638 3 30 if __is_inet4_host($arg)
641 4 26 if __is_inet6_host($arg)
644 5 21 if $arg =~ /\A$qr_fqdn\z/
654 0 34 unless $arg
657 3 31 if $arg =~ /\A$qr_ip4_addr\z/
667 0 31 unless $arg
670 4 27 if $arg =~ /\A$qr_ip6_addr\z/
680 0 21 unless $arg
683 2 19 if __is_inet4_cidr($arg)
686 5 14 if __is_inet6_cidr($arg)
696 0 22 unless $arg
699 4 18 if ($arg =~ /\A$qr_ip4_cidr\z/)
702 0 4 if $cidr < 0
703 2 2 if $cidr > 32
716 0 20 unless $arg
719 9 11 if ($arg =~ /\A$qr_ip6_cidr\z/)
722 0 9 if $cidr < 0
723 4 5 if $cidr > 128
736 0 14 unless $arg
739 0 14 if __is_inet4_range($arg)
742 0 14 if __is_inet6_range($arg)
752 0 15 unless $arg
755 0 15 if $arg =~ /\A$qr_ip4_addr\-$qr_ip4_addr\z/
767 0 15 unless $arg
770 0 15 if $arg =~ /\A$qr_ip6_addr\-$qr_ip6_addr\z/
782 0 41 unless $arg
785 21 20 if (__is_a_number($arg))
786 0 21 if $arg < 0
787 2 19 if $arg > 65535
793 6 14 if ($arg =~ /\A[a-z]+\z/i)
798 4 10 if ($arg =~ /\A\d+:\d+\z/)
802 0 4 unless __is_valid_inet_port($lower)
803 0 4 unless __is_valid_inet_port($upper)
806 2 2 if $upper < $lower
812 0 10 if ($arg =~ /\A[a-z]+:[a-z]+\z/i)
816 0 0 unless __is_valid_inet_port($lower)
817 0 0 unless __is_valid_inet_port($upper)
823 2 8 if ($arg =~ /\A\d+(,\d+)+\z/)
828 0 4 unless __is_valid_inet_port($port)
835 2 6 if ($arg =~ /\A[a-z]+(,[a-z]+)+\z/i)
840 0 4 unless __is_valid_inet_port($port)
852 21 20 if $arg =~ /\A-?\d+\z/