Branch Coverage

lib/Net/ISP/Balance.pm
Criterion Covered Total %
branch 114 260 43.8


line true false branch
202 0 2 unless $conf and -r $conf
353 0 0 if ($self->isp_services) { }
361 0 0 unless $self->echo_only
373 0 0 unless open my $f, 'ip route show table all|'
376 0 0 if /unreachable/
377 0 0 if /proto none/
382 0 0 unless open $f, 'ip rule show|'
388 0 0 unless open $f, 'iptables-save|'
399 0 0 if ($self->{'stored_routes'})
405 0 0 if ($self->{'stored_rules'})
409 0 0 if $priority == 32766
410 0 0 if $priority == 32767
415 0 0 if ($self->{'stored_firewall'})
416 0 0 unless open my $f, '|iptables-restore'
434 0 236 if @_
449 2 214 if @_
465 3 7 if @_
466 4 6 if $d and $d =~ /failover/i
480 0 0 if @_
494 0 0 if @_
510 0 0 if @_
533 0 214 if $self->verbose
534 214 0 if ($self->echo_only) { }
568 4 159 if (ref $_[0] eq 'ARRAY') { }
571 112 47 unless $seen_rule{join $", @_}++
578 0 13 unless $chain
579 10 0 $operation eq 'insert' ? :
0 10 $operation eq 'check ' ? :
1 10 $operation eq 'delete' ? :
2 11 $operation eq 'append' ? :
586 3 10 if $table
668 0 13 if (@_)
719 0 2 unless my $service = $self->_service_or_device($service_or_device)
748 0 1 unless $network and $device
778 1 0 if ($masquerade)
790 4 110 if /^-\w{2,}/
816 2 0 if $self->dev($sod)
843 2 1 unless @protocols
858 36 12 $protocol eq 'tcp' ? :
886 0 0 unless @protocols
935 0 0 if @_
999 0 0 if (@_)
1001 0 0 unless $new_state =~ /^(up|down)$/
1002 0 0 unless $self->dev($svc)
1004 0 0 -e $file ? :
1005 0 0 unless open my $fh, $mode, $file
1016 0 0 if (open my $fh, '<', $file) { }
1068 0 0 if $script =~ /^#/
1069 0 0 if $script =~ /~$/
1070 0 0 unless -f $script and -x _
1084 2 4 if @_
1085 2 4 unless ($self->{'up'})
1187 0 881 unless my $s = $self->{'services'}{$service}
1197 0 0 unless my(@chains) = grep({not /^-N ($mine)/;} grep({/^-N (\S+)/;} @rules))
1207 0 0 unless my $custom_chains = $self->{'_custom_chains'}
1209 0 0 unless my(@rules) = @{$custom_chains->{$table};}
1231 7 0 if -d '/etc/network'
1232 0 0 if -d '/etc/sysconfig/network-scripts'
1301 0 0 if @_
1314 1 2 if @_
1327 0 0 if @_
1340 0 1 if @_
1413 2 15 unless defined $defaults{$option}
1436 0 2 unless open my $f, $path
1440 6 26 if /^\s*#/
1441 0 26 if (/^forwarding_group\s*=\s*(.+)$/)
1442 0 0 unless my @group = split(/\s+/, $1, 0)
1446 1 25 if (/^mode\s*=\s*(.+)$/)
1450 0 25 if (/^(\w+)\s*=\s*(.*)$/)
1455 0 15 unless $service and $device and $role
1456 0 15 if $service =~ /^(up|down)$/
1460 4 41 if $$_ eq 'default'
1482 0 0 if $self->_collect_interfaces(\%ifs)
1492 0 2 unless my $s = $self->{'svc_config'}
1508 2 13 unless my $info = $i->{$vdev}
1527 5 8 $role eq 'isp' ? :
5 8 $role eq 'isp' ? :
1556 0 2 if ref $self and exists $self->{'_interface_info_cache'}
1584 0 18 unless $addr
1602 4 2 if $net eq 'nexthop'
1604 2 4 unless $net eq 'default'
1632 2 0 if ref $self
1655 12 0 unless my $fh = $self->_open_dhclient_leases($dev)
1659 0 0 if /option routers (\S+)[,;]/
1667 0 12 if (my $dummy = eval { do { $self->{'dummy_data'}{"leases_$device"} } })
1668 0 0 unless open my $fh, '<', \$dummy
1671 12 0 unless my $leases = $self->_find_dhclient_leases($device)
1672 0 0 unless open my $fh, $leases
1682 36 0 unless @matches
1715 0 0 if $self->keep_custom_chains
1718 0 0 if $self->keep_custom_chains
1732 0 1 $_[0] ? :
1750 1 1 if ($mode eq 'balanced') { }
1 0 elsif ($mode eq 'failover') { }
1778 1 0 if (@up > 1) { }
1779 0 1 if $self->verbose
1785 0 3 unless my $gw = $self->gw($svc)
1786 0 3 unless my $dev = $self->dev($svc)
1787 0 3 unless my $weight = $self->weight($svc)
1790 0 1 unless $hops
1795 0 0 if $self->verbose
1804 0 1 if $self->verbose
1825 0 5 if $self->verbose
1901 0 5 if $f =~ /~$/
1902 0 5 if $f =~ /^#/
1903 0 5 if $self->verbose
1905 0 5 if $f =~ /(~|\.bak)$/ or $f =~ /^#/
1907 3 2 if ($f =~ /\.pl$/) { }
1910 0 3 if $@
1912 0 2 unless open my $fh, $f
1978 0 0 if ($self->iptables_verbose)
1979 0 0 if $self->verbose
2008 1 2 unless $self->operating_mode eq 'balanced'
2010 0 2 if $self->verbose
2015 0 6 unless defined $mark and defined $table
2030 4 4 if (@up > 1) { }
2031 0 4 if $self->verbose
2043 0 4 if $self->verbose
2076 0 0 unless $proportions{$a} <=> $proportions{$b}
2144 4 4 unless $self->{'svc_config'}{$svc}{'role'} eq 'isp'
2169 12 0 $self->_allow_forwarding($lan, $svc) ? :
2184 4 12 if $i == $j
2187 12 0 $self->_allow_forwarding($lan1, $lan2) ? :
2207 23 1 if exists $self->{'_forwarding_groups'}
2211 1 0 unless (@$fgs)
2217 1 0 /^:lan$/ ? :
1 1 /^:isp$/ ? :
2240 0 0 unless $self->lan_services
2270 0 0 unless open my $f, '/var/run/lsm.pid'
2273 0 0 unless $pid =~ /^\d+$/