Branch Coverage

lib/Net/ISP/Balance.pm
Criterion Covered Total %
branch 116 264 43.9


line true false branch
203 0 2 unless $conf and -r $conf
354 0 0 if ($self->isp_services) { }
362 0 0 unless $self->echo_only
374 0 0 unless open my $f, 'ip route show table all|'
377 0 0 if /unreachable/
378 0 0 if /proto none/
383 0 0 unless open $f, 'ip rule show|'
389 0 0 unless open $f, 'iptables-save|'
400 0 0 if ($self->{'stored_routes'})
406 0 0 if ($self->{'stored_rules'})
410 0 0 if $priority == 32766
411 0 0 if $priority == 32767
416 0 0 if ($self->{'stored_firewall'})
417 0 0 unless open my $f, '|iptables-restore'
435 0 252 if @_
450 2 230 if @_
472 3 7 if @_
473 4 6 if $d and $d =~ /failover/i
487 0 0 if @_
501 0 0 if @_
517 0 0 if @_
540 0 230 if $self->verbose
541 230 0 if ($self->echo_only) { }
575 4 160 if (ref $_[0] eq 'ARRAY') { }
578 118 42 unless $seen_rule{join $", @_}++
585 0 13 unless $chain
586 10 0 $operation eq 'insert' ? :
0 10 $operation eq 'check ' ? :
1 10 $operation eq 'delete' ? :
2 11 $operation eq 'append' ? :
593 3 10 if $table
675 0 13 if (@_)
726 0 2 unless my $service = $self->_service_or_device($service_or_device)
755 0 1 unless $network and $device
785 1 0 if ($masquerade)
797 4 110 if /^-\w{2,}/
823 2 0 if $self->dev($sod)
850 2 1 unless @protocols
865 36 12 $protocol eq 'tcp' ? :
893 0 0 unless @protocols
942 0 0 if @_
1006 0 0 if (@_)
1008 0 0 unless $new_state =~ /^(up|down)$/
1009 0 0 unless $self->vdev($svc)
1011 0 0 -e $file ? :
1012 0 0 unless open my $fh, $mode, $file
1023 0 0 if (open my $fh, '<', $file) { }
1075 0 0 if $script =~ /^#/
1076 0 0 if $script =~ /~$/
1077 0 0 unless -f $script and -x _
1091 2 4 if @_
1092 2 4 unless ($self->{'up'})
1195 0 899 unless my $s = $self->{'services'}{$service}
1205 0 0 unless my(@chains) = grep({not /^-N ($mine)/;} grep({/^-N (\S+)/;} @rules))
1215 0 0 unless my $custom_chains = $self->{'_custom_chains'}
1217 0 0 unless my(@rules) = @{$custom_chains->{$table};}
1239 7 0 if -d '/etc/network'
1240 0 0 if -d '/etc/sysconfig/network-scripts'
1309 0 0 if @_
1322 1 2 if @_
1335 0 0 if @_
1348 0 1 if @_
1421 2 15 unless defined $defaults{$option}
1434 0 3 if $vdev ne $device
1446 0 2 unless open my $f, $path
1450 6 26 if /^\s*#/
1451 0 26 if (/^forwarding_group\s*=\s*(.+)$/)
1452 0 0 unless my @group = split(/\s+/, $1, 0)
1456 1 25 if (/^mode\s*=\s*(.+)$/)
1460 0 25 if (/^(\w+)\s*=\s*(.*)$/)
1465 0 15 unless $service and $device and $role
1466 0 15 if $service =~ /^(up|down)$/
1470 4 41 if $$_ eq 'default'
1492 0 0 if $self->_collect_interfaces(\%ifs)
1502 0 2 unless my $s = $self->{'svc_config'}
1518 2 13 unless my $info = $i->{$vdev}
1538 5 8 $role eq 'isp' ? :
5 8 $role eq 'isp' ? :
1567 0 2 if ref $self and exists $self->{'_interface_info_cache'}
1595 0 18 unless $addr
1613 4 2 if $net eq 'nexthop'
1615 2 4 unless $net eq 'default'
1644 2 0 if ref $self
1667 12 0 unless my $fh = $self->_open_dhclient_leases($dev)
1671 0 0 if /option routers (\S+)[,;]/
1679 0 12 if (my $dummy = eval { do { $self->{'dummy_data'}{"leases_$device"} } })
1680 0 0 unless open my $fh, '<', \$dummy
1683 12 0 unless my $leases = $self->_find_dhclient_leases($device)
1684 0 0 unless open my $fh, $leases
1694 36 0 unless @matches
1727 0 0 if $self->keep_custom_chains
1730 0 0 if $self->keep_custom_chains
1744 0 1 $_[0] ? :
1762 1 1 if ($mode eq 'balanced') { }
1 0 elsif ($mode eq 'failover') { }
1790 1 0 if (@up > 1) { }
1791 0 1 if $self->verbose
1797 0 3 unless my $gw = $self->gw($svc)
1798 0 3 unless my $dev = $self->vdev($svc)
1799 0 3 unless my $weight = $self->weight($svc)
1802 0 1 unless $hops
1807 0 0 if $self->verbose
1816 0 1 if $self->verbose
1837 0 5 if $self->verbose
1915 0 5 if $f =~ /~$/
1916 0 5 if $f =~ /^#/
1917 0 5 if $self->verbose
1919 0 5 if $f =~ /(~|\.bak)$/ or $f =~ /^#/
1921 3 2 if ($f =~ /\.pl$/) { }
1924 0 3 if $@
1926 0 2 unless open my $fh, $f
1992 0 0 if ($self->iptables_verbose)
1993 0 0 if $self->verbose
2022 1 2 unless $self->operating_mode eq 'balanced'
2024 0 2 if $self->verbose
2029 0 6 unless defined $mark and defined $table
2044 4 4 if (@up > 1) { }
2045 0 4 if $self->verbose
2057 0 4 if $self->verbose
2090 0 0 unless $proportions{$a} <=> $proportions{$b}
2114 1 0 if @ppp_devices > 0
2163 4 4 unless $self->{'svc_config'}{$svc}{'role'} eq 'isp'
2188 12 0 $self->_allow_forwarding($lan, $svc) ? :
2203 4 12 if $i == $j
2206 12 0 $self->_allow_forwarding($lan1, $lan2) ? :
2226 23 1 if exists $self->{'_forwarding_groups'}
2230 1 0 unless (@$fgs)
2236 1 0 /^:lan$/ ? :
1 1 /^:isp$/ ? :
2259 0 0 unless $self->lan_services
2299 0 0 unless open my $f, '/var/run/lsm.pid'
2302 0 0 unless $pid =~ /^\d+$/