Skip Menu |

This queue is for tickets about the Net-NTP CPAN distribution.

Report information
The Basics
Id: 38234
Status: resolved
Priority: 0/
Queue: Net-NTP

People
Owner: Nobody in particular
Requestors: martin.vonloewis [...] hpi.uni-potsdam.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.2
Fixed in: (no value)



Subject: Use IO::Socket::INET6 if available
To access IPv6 NTP servers, INET6 sockets must be used; INET6 also works for v4 sockets. This patch converts NTP.pm to use them, but falls back to old INET sockets if INET6 is not available.
Subject: s
From: martin.vonloewis [...] hpi.uni-potsdam.de
It seems the file did not get attached.
--- NTP.pm 2004-02-23 18:53:47.000000000 +0100 +++ /usr/share/perl5/Net/NTP.pm 2008-08-06 07:45:49.000000000 +0200 @@ -141,15 +141,22 @@ sub get_ntp_response{ use IO::Socket; + use constant HAVE_SOCKET_INET6 => eval { require IO::Socket::INET6 }; my $host = shift || 'localhost'; my $port = shift || 'ntp'; - my $sock = IO::Socket::INET->new( + my %args = ( Proto => 'udp', PeerHost => $host, - PeerPort => $port ) - or die $@; + PeerPort => $port ); + my $sock; + if (HAVE_SOCKET_INET6) { + $sock = IO::Socket::INET6->new(%args); + } else { + $sock = IO::Socket::INET->new(%args); + } + die $@ unless $sock; my %tmp_pkt; my %packet;
On Wed Aug 06 01:55:30 2008, loewis wrote: Show quoted text
> To access IPv6 NTP servers, INET6 sockets must be used; INET6 also works > for v4 sockets. This patch converts NTP.pm to use them, but falls back > to old INET sockets if INET6 is not available.
I added this patch to my git repository which I'm releasing as 1.3 today. https://github.com/abh/net-ntp - ask