Remove deprecated Socket6
This commit is contained in:
parent
0bd821f589
commit
938240b748
@ -1,11 +1,12 @@
|
||||
Name: perl-Net-SNMP
|
||||
Version: 6.0.1
|
||||
Release: 35%{?dist}
|
||||
Release: 36%{?dist}
|
||||
Summary: Object oriented interface to SNMP
|
||||
|
||||
License: GPL+ or Artistic
|
||||
URL: https://metacpan.org/release/Net-SNMP
|
||||
Source0: https://cpan.metacpan.org/authors/id/D/DT/DTOWN/Net-SNMP-v%{version}.tar.gz
|
||||
Patch0: perl-net-snmp-remove-deprecated.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: coreutils
|
||||
@ -29,7 +30,6 @@ BuildRequires: perl(Errno)
|
||||
BuildRequires: perl(Exporter)
|
||||
BuildRequires: perl(IO::Socket)
|
||||
BuildRequires: perl(Math::BigInt)
|
||||
# Socket6 0.23 not used at tests
|
||||
# Optional run-time:
|
||||
# Crypt::Rijndael 1.02 not used at tests
|
||||
# Sys::Hostname not used at tests
|
||||
@ -58,6 +58,7 @@ Management Protocol and related network management concepts.
|
||||
|
||||
%prep
|
||||
%setup -q -n Net-SNMP-v%{version}
|
||||
%patch -P0 -p1
|
||||
%{__perl} -pi -e 's|^#!\s+/usr/local/bin/perl|#!%{__perl}|' examples/*.pl
|
||||
chmod -c a-x examples/*.pl
|
||||
|
||||
@ -89,6 +90,9 @@ make test
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jun 14 2023 Petr Salaba <psalaba@redhat.com> - 6.0.1-36
|
||||
- Switch from Socket6 to Socket
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.1-35
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
107
perl-net-snmp-remove-deprecated.patch
Normal file
107
perl-net-snmp-remove-deprecated.patch
Normal file
@ -0,0 +1,107 @@
|
||||
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
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
use Net::SNMP::Transport qw( DEBUG_INFO );
|
||||
|
||||
-use Socket6 0.23 qw(
|
||||
- PF_INET6 AF_INET6 in6addr_any in6addr_loopback getaddrinfo
|
||||
- pack_sockaddr_in6_all unpack_sockaddr_in6_all inet_pton inet_ntop
|
||||
+use Socket qw(
|
||||
+ PF_INET6 AF_INET6 IN6ADDR_ANY IN6ADDR_LOOPBACK getaddrinfo
|
||||
+ pack_sockaddr_in6 unpack_sockaddr_in6 inet_pton inet_ntop
|
||||
);
|
||||
|
||||
## Version of the Net::SNMP::Transport::IPv6 module
|
||||
@@ -89,12 +89,12 @@
|
||||
|
||||
sub _addr_any
|
||||
{
|
||||
- return in6addr_any;
|
||||
+ return IN6ADDR_ANY;
|
||||
}
|
||||
|
||||
sub _addr_loopback
|
||||
{
|
||||
- return in6addr_loopback;
|
||||
+ return IN6ADDR_LOOPBACK;
|
||||
}
|
||||
|
||||
sub _hostname_resolve
|
||||
@@ -117,23 +117,22 @@
|
||||
|
||||
# Resolve the address.
|
||||
|
||||
- my @info = getaddrinfo(($_[1] = $host), q{}, PF_INET6);
|
||||
+ my ($err, $info) = getaddrinfo(($_[1] = $host), q{}, {'family' => PF_INET6});
|
||||
|
||||
- if (@info >= 5) {
|
||||
+ if (! $err) {
|
||||
if ($host =~ s/(.*)%.*$/$1/) { # <address>%<ifName>
|
||||
$_[1] = $1;
|
||||
}
|
||||
- while (@info >= 5) {
|
||||
- if ($info[0] == PF_INET6) {
|
||||
- $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'});
|
||||
}
|
||||
- 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'});
|
||||
}
|
||||
} else {
|
||||
- DEBUG_INFO('getaddrinfo(): %s', $info[0]);
|
||||
+ DEBUG_INFO('getaddrinfo(): %s', $info->{'family'});
|
||||
if ((my @host = split /:/, $host) == 2) { # <hostname>:<service>
|
||||
$_[1] = sprintf '[%s]:%s', @host;
|
||||
return $this->_hostname_resolve($_[1], $nh);
|
||||
@@ -156,9 +155,9 @@
|
||||
|
||||
sub _name_pack
|
||||
{
|
||||
- return pack_sockaddr_in6_all(
|
||||
- $_[1]->{port}, $_[1]->{flowinfo} || 0,
|
||||
- $_[1]->{addr}, $_[1]->{scope_id} || 0
|
||||
+ return pack_sockaddr_in6(
|
||||
+ $_[1]->{port}, $_[1]->{addr},
|
||||
+ $_[1]->{scope_id} || 0, $_[1]->{flowinfo} || 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -169,12 +168,12 @@
|
||||
|
||||
sub _addr
|
||||
{
|
||||
- return (unpack_sockaddr_in6_all($_[1]))[2];
|
||||
+ return (unpack_sockaddr_in6($_[1]))[1];
|
||||
}
|
||||
|
||||
sub _port
|
||||
{
|
||||
- return (unpack_sockaddr_in6_all($_[1]))[0];
|
||||
+ return (unpack_sockaddr_in6($_[1]))[0];
|
||||
}
|
||||
|
||||
sub _taddress
|
||||
@@ -193,12 +192,12 @@
|
||||
|
||||
sub _scope_id
|
||||
{
|
||||
- return (unpack_sockaddr_in6_all($_[1]))[3];
|
||||
+ return (unpack_sockaddr_in6($_[1]))[2];
|
||||
}
|
||||
|
||||
sub _flowinfo
|
||||
{
|
||||
- return (unpack_sockaddr_in6_all($_[1]))[1];
|
||||
+ return (unpack_sockaddr_in6($_[1]))[3];
|
||||
}
|
||||
|
||||
# ============================================================================
|
Loading…
Reference in New Issue
Block a user