Package: resource-agents
Severity: grave
Tags: upstream patch
ldirectord failed to start, with following error:
Subroutine main::pack_sockaddr_in6 redefined at
/usr/share/perl/5.14/Exporter.pm line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::unpack_sockaddr_in6 redefined at
/usr/share/perl/5.14/Exporter.pm line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm
line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::pack_sockaddr_in6 redefined at /usr/sbin/ldirectord line 3060
Subroutine main::unpack_sockaddr_in6 redefined at /usr/sbin/ldirectord line
3060
Subroutine main::sockaddr_in6 redefined at /usr/sbin/ldirectord line 3060
Subroutine main::pack_sockaddr_in6 redefined at
/usr/share/perl/5.14/Exporter.pm line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::unpack_sockaddr_in6 redefined at
/usr/share/perl/5.14/Exporter.pm line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm
line 67.
at /usr/sbin/ldirectord line 831
Subroutine main::pack_sockaddr_in6 redefined at /usr/sbin/ldirectord line 3060
Subroutine main::unpack_sockaddr_in6 redefined at /usr/sbin/ldirectord line
3060
Subroutine main::sockaddr_in6 redefined at /usr/sbin/ldirectord line 3060
After comment out `use Socket6;`, got following error:
Bareword "NI_NUMERICHOST" not allowed while "strict subs" in use at
/usr/sbin/ldirectord line 5046.
Bareword "NI_NUMERICSERV" not allowed while "strict subs" in use at
/usr/sbin/ldirectord line 5046.
Execution of /usr/sbin/ldirectord aborted due to compilation errors.
Additional dependency required:
libsocket-getaddrinfo-perl
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (300,
'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
resource-agents (1:3.9.2-5) unstable; urgency=high
.
* debian/control: Fix the Conflicts and Replaces lines of resource-agents
to make sure that cluster-agents and resource-agents are mutually
exclusive. Setting the urgency to high because this bug keeps people
from running the whole clusterstack (Closes: #646110)
* debian/patches/ocf-asterisk: Include the Asterisk PBX OCF resource agent
written by Florian Haas, Andreas Kurz and me, sponsored by hastexo
Author: Martin Loschwitz <[email protected]>
Bug-Debian: http://bugs.debian.org/646110
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
Index: resource-agents-3.9.2/ldirectord/ldirectord.in
===================================================================
--- resource-agents-3.9.2.orig/ldirectord/ldirectord.in 2012-06-04 13:24:40.000000000 +0800
+++ resource-agents-3.9.2/ldirectord/ldirectord.in 2012-06-04 14:16:33.994237831 +0800
@@ -828,7 +828,8 @@
#use English;
#use Time::HiRes qw( gettimeofday tv_interval );
use Socket;
-use Socket6;
+use Socket::GetAddrInfo qw( getaddrinfo getnameinfo NI_NUMERICHOST NI_NUMERICSERV NI_NAMEREQD );
+#use Socket6;
use Sys::Hostname;
use POSIX qw(setsid :sys_wait_h);
use Sys::Syslog qw(:DEFAULT setlogsock);
@@ -5039,17 +5040,21 @@
if ($name =~ /\[(.*)\]/) {
$name = $1;
}
- my @host = getaddrinfo($name, 0, $af);
- if (!defined($host[3])) {
- return undef;
- }
- my @ret = getnameinfo($host[3], NI_NUMERICHOST | NI_NUMERICSERV);
- if ($host[0] == AF_INET6) {
- return "[$ret[0]]";
- }
- else {
- return $ret[0];
+ my %hints = ( family => $af );
+ my ( $err, @res ) = getaddrinfo($name, 0, \%hints);
+ return undef if ($err);
+ while( my $ai = shift @res ) {
+ my ( $err, $hostname, $servicename ) = getnameinfo( $ai->{addr} );
+ if (!$err) {
+ if ($ai->{family} == AF_INET6) {
+ return "[$hostname]";
+ }
+ else {
+ return $hostname;
+ }
+ }
}
+ return undef;
}
# ld_gethostbyaddr
@@ -5064,13 +5069,13 @@
my ($ip)=(@_);
$ip = &ld_strip_brackets($ip);
- my @host = getaddrinfo($ip,0);
- if (!defined($host[3])) {
- return undef;
+ my ( $err, @res ) = getaddrinfo($ip,0);
+ return undef if ($err);
+ while( my $ai = shift @res ) {
+ my ( $err, $host, $service ) = getnameinfo($ai->{addr}, NI_NAMEREQD);
+ return $host unless($err);
}
- my @ret = getnameinfo($host[3], NI_NAMEREQD);
- return undef unless(scalar(@ret) == 2);
- return $ret[0];
+ return undef;
}
# ld_getservbyname