~allison/ubuntu/oneiric/backuppc/merge-debian-inetutils

« back to all changes in this revision

Viewing changes to lib/BackupPC/Lib.pm

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-03-07 11:35:50 UTC
  • Revision ID: james.westby@ubuntu.com-20110307113550-jozwwg3n2ar4v4ib
Tags: 3.2.0-3ubuntu2
Applied ipv6-support.dpatch, debian/control:
Add support for ipv6. (LP: #54918)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
use File::Path;
47
47
use File::Compare;
48
48
use Socket;
 
49
use Socket6;
49
50
use Cwd;
50
51
use Digest::MD5;
51
52
use Config;
955
956
{
956
957
    my($bpc, $host) = @_;
957
958
    my($s, $pingCmd, $ret);
 
959
    my($family, @res, $args);
958
960
 
959
961
    #
960
962
    # Return success if the ping cmd is undefined or empty.
965
967
        return 0;
966
968
    }
967
969
 
968
 
    my $args = {
969
 
        pingPath => $bpc->{Conf}{PingPath},
970
 
        host     => $host,
971
 
    };
 
970
    ($family, @res) = getaddrinfo($host, "22");
 
971
    if ( $family eq AF_INET ) {
 
972
        $args = {
 
973
            pingPath => $bpc->{Conf}{PingPath},
 
974
            host     => $host,
 
975
        };
 
976
    }
 
977
    if ( $family eq AF_INET6 ) {
 
978
        $args = {
 
979
            pingPath => $bpc->{Conf}{Ping6Path},
 
980
            host     => $host,
 
981
        };
 
982
    }
 
983
 
972
984
    $pingCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{PingCmd}, $args);
973
985
 
974
986
    #