Branch Coverage

blib/lib/IPTables/Parse.pm
Criterion Covered Total %
branch 0 248 0.0


line true false branch
51 0 0 if ($$self{'_skip_ipt_exec_check'}) { }
52 0 0 unless ($$self{'_firewall_cmd'} or $$self{'_iptables'})
57 0 0 if ($$self{'_firewall_cmd'}) { }
0 0 elsif ($$self{'_iptables'}) { }
58 0 0 unless -e $$self{'_firewall_cmd'}
60 0 0 unless -x $$self{'_firewall_cmd'}
63 0 0 unless -e $$self{'_iptables'}
65 0 0 unless -x $$self{'_iptables'}
71 0 0 if (-e $fwc_bin and -x $fwc_bin) { }
0 0 elsif (-e $ipt_bin and -x $ipt_bin) { }
0 0 elsif (-e $ipt6_bin and -x $ipt6_bin) { }
84 0 0 if ($$self{'_ipv6'} and $$self{'_iptables'} eq $ipt_bin)
85 0 0 if (-e $ipt6_bin and -x $ipt6_bin) { }
95 0 0 if ($$self{'_firewall_cmd'}) { }
96 0 0 if $$self{'_firewall_cmd'} =~ m[.*/(\S+)]
98 0 0 if $$self{'_iptables'} =~ m[.*/(\S+)]
102 0 0 if ($$self{'_ipv6'})
103 0 0 if ($$self{'_firewall_cmd'}) { }
104 0 0 if ($$self{'_fwd_args'} =~ /ipv4/i)
108 0 0 if ($$self{'_ipt_bin_name'} eq 'iptables')
109 0 0 unless ($$self{'_skip_ipt_exec_check'})
117 0 0 if $$self{'_ipt_bin_name'} eq 'ip6tables'
118 0 0 if ($$self{'_firewall_cmd'})
119 0 0 if $$self{'_fwd_args'} =~ /ipv6/
125 0 0 if ($$self{'_firewall_cmd'})
245 0 0 if ($$self{'_ipt_rules_file'} and not $file)
249 0 0 if ($file) { }
252 0 0 unless open F, "< $file"
262 0 0 if (/^\s*Chain\s+(\w+)/)
277 0 0 if ($$self{'_ipt_rules_file'} and not $file)
281 0 0 if ($file) { }
284 0 0 unless open F, "< $file"
297 0 0 if ($line =~ /^\s*Chain\s+$chain\s+\(policy\s+(\w+)/)
326 0 0 if ($$self{'_ipt_rules_file'} and not $file)
330 0 0 if ($file) { }
333 0 0 unless open F, "< $file"
346 0 0 if ($line =~ /^\s*pkts\s+bytes\s+target/)
355 0 0 if $found_chain and $line =~ /^\s*Chain\s+/
357 0 0 if ($line =~ /^\s*Chain\s+$chain\s+\(/i)
361 0 0 if ($ipt_verbose) { }
362 0 0 if $line =~ /^\s*pkts\s+bytes\s+target\s/i
364 0 0 if $line =~ /^\s*target\s+prot/i
366 0 0 unless $found_chain
367 0 0 unless $line
381 0 0 if ($ipt_verbose) { }
397 0 0 if ($$self{'_ipt_bin_name'} eq 'ip6tables' or $$self{'_ipt_bin_name'} eq 'firewall-cmd' and $$self{'_fwd_args'} =~ /\sipv6/)
404 0 0 if ($line =~ /$match_re/)
438 0 0 if ($$self{'_ipt_bin_name'} eq 'ip6tables' or $$self{'_ipt_bin_name'} eq 'firewall-cmd' and $$self{'_fwd_args'} =~ /\sipv6/)
444 0 0 if ($line =~ /$match_re/)
447 0 0 if $proto eq '0'
465 0 0 if ($$rule_hr{'extended'} =~ /$$ext_keys_hr{$key}{'regex'}/)
471 0 0 if ($$rule_hr{'protocol'} eq '0') { }
0 0 elsif ($$rule_hr{'protocol'} eq 'tcp' or $$rule_hr{'protocol'} eq 'udp') { }
476 0 0 if $$rule_hr{'s_port'} eq ''
478 0 0 if $$rule_hr{'d_port'} eq ''
493 0 0 if ($$self{'_ipt_rules_file'} and not $file)
497 0 0 if ($file) { }
500 0 0 unless open F, "< $file"
510 0 0 unless @ipt_lines
524 0 0 if $found_chain and $line =~ /^\s*Chain\s+/
528 0 0 if ($line =~ /^\s*Chain\s+$chain\s+\(policy\s+(\w+)\)/)
532 0 0 if $line =~ /^\s*target\s/i
533 0 0 unless $found_chain
541 0 0 if ($$self{'_ipt_bin_name'} eq 'ip6tables' or $$self{'_ipt_bin_name'} eq 'firewall-cmd' and $$self{'_fwd_args'} =~ /ipv6/)
551 0 0 if ($line =~ /$log_re/) { }
0 0 elsif ($policy eq 'ACCEPT' and $line =~ /$drop_re/) { }
558 0 0 if $proto eq '0'
560 0 0 if ($p_tmp and $p_tmp =~ /LOG.*\s+prefix\s+ \`\s*(.+?)\s*\'/x)
569 0 0 if $proto eq '0'
579 0 0 if ($policy eq 'DROP')
584 0 0 unless %protocols and $found_default_drop
602 0 0 if ($$self{'_ipt_rules_file'} and not $file)
610 0 0 if ($file) { }
613 0 0 unless open F, "< $file"
626 0 0 if ($line =~ /^\s*pkts\s+bytes\s+target/)
632 0 0 unless @ipt_lines
643 0 0 if ($line =~ /^\s*Chain\s+(.*?)\s+\(/ and not $line =~ /0\s+references/)
647 0 0 unless $line =~ /\S/
648 0 0 unless $log_chain
652 0 0 if ($ipt_verbose) { }
653 0 0 if ($$self{'_ipt_bin_name'} eq 'ip6tables' or $$self{'_ipt_bin_name'} eq 'firewall-cmd' and $$self{'_fwd_args'} =~ /\sipv6/) { }
656 0 0 if ($line =~ /^\s*\d+\s+\d+\s*U?LOG\s+(\w+)\s+ \S+\s+\S+\s+$any_ip_re \s+$any_ip_re\s+.*U?LOG/x)
663 0 0 if ($line =~ /^\s*\d+\s+\d+\s*U?LOG\s+(\w+)\s+\-\-\s+ \S+\s+\S+\s+$any_ip_re \s+$any_ip_re\s+.*U?LOG/x)
671 0 0 if ($$self{'_ipt_bin_name'} eq 'ip6tables' or $$self{'_ipt_bin_name'} eq 'firewall-cmd' and $$self{'_fwd_args'} =~ /\sipv6/) { }
674 0 0 if ($line =~ /^\s*U?LOG\s+(\w+)\s+$any_ip_re \s+$any_ip_re\s+.*U?LOG/x)
680 0 0 if ($line =~ /^\s*U?LOG\s+(\w+)\s+\-\-\s+$any_ip_re \s+$any_ip_re\s+.*U?LOG/x)
688 0 0 if ($found)
689 0 0 if $proto eq '0'
692 0 0 if $log_chain eq $chain
696 0 0 unless %log_chains
707 0 0 if (defined $sub_chains{$log_chain})
725 0 0 if ($line =~ /^\s*Chain\s+$start_chain\s+\(/ and not $line =~ /0\s+references/)
730 0 0 unless $found
731 0 0 if ($found and $line =~ /^\s*Chain\s/)
734 0 0 if ($line =~ /^\s*(\S+)\s+\S+\s+/)
736 0 0 if ($new_chain ne 'LOG' and $new_chain ne 'DROP' and $new_chain ne 'REJECT' and $new_chain ne 'ACCEPT' and $new_chain ne 'RETURN' and $new_chain ne 'QUEUE' and $new_chain ne 'SNAT' and $new_chain ne 'DNAT' and $new_chain ne 'MASQUERADE' and $new_chain ne 'pkts' and $new_chain ne 'Chain' and $new_chain ne 'target')
769 0 0 unless $cmd =~ /^\s*iptables/ or $cmd =~ m[^\S+/iptables] or $cmd =~ /^\s*ip6tables/ or $cmd =~ m[^\S+/ip6tables] or $cmd =~ /^\s*firewall-cmd/ or $cmd =~ m[^\S+/firewall-cmd]
779 0 0 if $verbose
781 0 0 if ($debug or $verbose)
784 0 0 if ($ipt_exec_sleep > 0)
790 0 0 if ($ipt_exec_sleep > 0)
791 0 0 if ($debug or $verbose)
799 0 0 if ($ipt_exec_style eq 'system') { }
0 0 elsif ($ipt_exec_style eq 'popen') { }
802 0 0 unless open CMD, "$cmd 2> $ipterr |"
805 0 0 unless open F, "> $iptout"
811 0 0 if ($debug or $verbose)
817 0 0 if ($ipt_pid = fork) { }
828 0 0 if ($@)
829 0 0 unless kill 15, $ipt_pid
832 0 0 unless defined $ipt_pid
840 0 0 if (-e $iptout)
841 0 0 unless open F, "< $iptout"
845 0 0 if (-e $ipterr)
846 0 0 unless open F, "< $ipterr"
850 0 0 if @stderr
853 0 0 if (@stdout)
854 0 0 if ($stdout[$#stdout] =~ /^success/)
857 0 0 if ($$self{'_ipt_bin_name'} eq 'firewall-cmd')
859 0 0 if (/COMMAND_FAILED/)
867 0 0 if ($debug or $verbose)
871 0 0 if ($line =~ /\n$/) { }
880 0 0 if ($line =~ /\n$/) { }
888 0 0 if ($debug or $verbose)