Improve patch for switch from Socket6 to Socket

This commit is contained in:
Michal Josef Špaček 2024-06-17 12:44:21 +02:00
parent 10020706c6
commit 091ec10689
2 changed files with 125 additions and 9 deletions

View File

@ -1,6 +1,6 @@
Name: perl-Net-SNMP
Version: 6.0.1
Release: 41%{?dist}
Release: 42%{?dist}
Summary: Object oriented interface to SNMP
License: GPL-1.0-or-later OR Artistic-1.0-Perl
@ -90,6 +90,9 @@ make test
%changelog
* Tue Jun 27 2024 Michal Josef Špaček <mspacek@redhat.com> - 6.0.1-42
- Improve patch for switch from Socket6 to Socket
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 6.0.1-41
- Bump release for June 2024 mass rebuild

View File

@ -1,3 +1,116 @@
diff -Naur A/Build.PL B/Build.PL
--- A/Build.PL
+++ B/Build.PL
@@ -33,6 +33,7 @@ Module::Build->new(
Exporter => 0,
IO::Socket => 0,
Math::BigInt => 0,
+ Socket => '2.000',
},
recommends => {
Crypt::DES => '2.03', # SNMPv3
@@ -40,7 +41,6 @@ Module::Build->new(
Digest::SHA1 => '1.02', # SNMPv3
Digest::HMAC => '1.00', # SNMPv3
Crypt::Rijndael => '1.02', # SNMPv3 - AES Cipher Algorithm
- Socket6 => '0.23', # UDP/IPv6 or TCP/IPv6 Transport Domain
},
meta_merge => {
resources => {
diff -Naur A/META.yml B/META.yml
--- A/META.yml
+++ B/META.yml
@@ -3,14 +3,15 @@ abstract: 'Object oriented interface to SNMP'
author:
- 'David M. Town <dtown@cpan.org>'
build_requires:
- Test: 0
+ Test: '0'
configure_requires:
- Module::Build: 0.36
-generated_by: 'Module::Build version 0.3607'
+ Module::Build: '0.42'
+dynamic_config: 1
+generated_by: 'Module::Build version 0.4234, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Net-SNMP
provides:
Net::SNMP:
@@ -59,21 +60,22 @@ provides:
file: lib/Net/SNMP/Transport/IPv6/UDP.pm
version: v3.0.0
recommends:
- Crypt::DES: 2.03
- Crypt::Rijndael: 1.02
- Digest::HMAC: 1.00
- Digest::MD5: 2.11
- Digest::SHA1: 1.02
- Socket6: 0.23
+ Crypt::DES: '2.03'
+ Crypt::Rijndael: '1.02'
+ Digest::HMAC: '1.00'
+ Digest::MD5: '2.11'
+ Digest::SHA1: '1.02'
requires:
- Carp: 0
- Errno: 0
- Exporter: 0
- IO::Socket: 0
- Math::BigInt: 0
- perl: 5.006
+ Carp: '0'
+ Errno: '0'
+ Exporter: '0'
+ IO::Socket: '0'
+ Math::BigInt: '0'
+ Socket: '2.000'
+ perl: '5.006'
resources:
CPANForum: http://www.cpanforum.com/dist/Net-SNMP
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SNMP
license: http://dev.perl.org/licenses/
version: v6.0.1
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -Naur A/Makefile.PL B/Makefile.PL
index 4678c32..a15243b 100644
--- A/Makefile.PL
+++ B/Makefile.PL
@@ -42,6 +42,7 @@ WriteMakefile(
Digest::MD5 => '2.11', # SNMPv3
Digest::SHA1 => '1.02', # SNMPv3
Digest::HMAC => '1.00', # SNMPv3
+ Socket => '2.000',
},
dist => {
CI => 'ci -u -sRel -m\"Changes for $(VERSION)\"',
diff -Naur A/README B/README
--- A/README
+++ B/README
@@ -60,7 +60,7 @@ REQUIREMENTS
protocol, the non-core module Crypt::Rijndael is needed.
To use UDP/IPv6 or TCP/IPv6 as a Transport Domain, the non-core
- module Socket6 is needed.
+ module Socket is needed.
DOCUMENTATION
diff -Naur A/lib/Net/SNMP.pm B/lib/Net/SNMP.pm
--- A/lib/Net/SNMP.pm
+++ B/lib/Net/SNMP.pm
@@ -3561,7 +3561,7 @@ non-core module F<Crypt::Rijndael> is needed.
=item *
To use UDP/IPv6 or TCP/IPv6 as a Transport Domain, the non-core module
-F<Socket6> is needed.
+F<Socket> is needed.
=back
diff -Naur A/lib/Net/SNMP/Transport/IPv6.pm B/lib/Net/SNMP/Transport/IPv6.pm
--- A/lib/Net/SNMP/Transport/IPv6.pm 2010-09-10 02:02:45.000000000 +0200
+++ B/lib/Net/SNMP/Transport/IPv6.pm 2023-06-14 09:27:57.736399948 +0200
@ -34,7 +147,7 @@ diff -Naur A/lib/Net/SNMP/Transport/IPv6.pm B/lib/Net/SNMP/Transport/IPv6.pm
# Resolve the address.
- my @info = getaddrinfo(($_[1] = $host), q{}, PF_INET6);
+ my ($err, $info) = getaddrinfo(($_[1] = $host), q{}, {'family' => PF_INET6});
+ my ($err, @addrs) = getaddrinfo(($_[1] = $host), q{}, {'family' => PF_INET6});
- if (@info >= 5) {
+ if (! $err) {
@ -46,19 +159,19 @@ diff -Naur A/lib/Net/SNMP/Transport/IPv6.pm B/lib/Net/SNMP/Transport/IPv6.pm
- $nh->{flowinfo} = $this->_flowinfo($info[3]);
- $nh->{scope_id} ||= $this->_scope_id($info[3]);
- return $nh->{addr} = $this->_addr($info[3]);
+ while (! $err) {
+ if ($info->{'family'} == PF_INET6) {
+ $nh->{flowinfo} = $this->_flowinfo($info->{'addr'});
+ $nh->{scope_id} ||= $this->_scope_id($info->{'addr'});
+ return $nh->{addr} = $this->_addr($info->{'addr'});
+ while (my $addr = shift @addrs) {
+ if ($addr->{'family'} == PF_INET6) {
+ $nh->{flowinfo} = $this->_flowinfo($addr->{'addr'});
+ $nh->{scope_id} ||= $this->_scope_id($addr->{'addr'});
+ return $nh->{addr} = $this->_addr($addr->{'addr'});
}
- DEBUG_INFO('family = %d, sin = %s', $info[0], unpack 'H*', $info[3]);
- splice @info, 0, 5;
+ DEBUG_INFO('family = %d, sin = %s', $info->{'family'}, unpack 'H*', $info->{'addr'});
+ DEBUG_INFO('family = %d, sin = %s', $addr->{'family'}, unpack 'H*', $addr->{'addr'});
}
} else {
- DEBUG_INFO('getaddrinfo(): %s', $info[0]);
+ DEBUG_INFO('getaddrinfo(): %s', $info->{'family'});
+ DEBUG_INFO('getaddrinfo(): %s', $err);
if ((my @host = split /:/, $host) == 2) { # <hostname>:<service>
$_[1] = sprintf '[%s]:%s', @host;
return $this->_hostname_resolve($_[1], $nh);