Date: Sun, 30 Aug 2020 19:44:10 +0000 (UTC) From: Eugene Grosbein <eugen@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r547075 - in head/net-mgmt/p5-SNMP_Session: . files Message-ID: <202008301944.07UJiAh4075260@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eugen Date: Sun Aug 30 19:44:10 2020 New Revision: 547075 URL: https://svnweb.freebsd.org/changeset/ports/547075 Log: net-mgmt/p5-SNMP_Session: permit fractional timeout backoff values This perl module allows to change default timeout backoff and validates new value with its set_backoff() function. This function contains obvious copy-paste error from previous functions set_timeout()/set_retries() that deal with integer values. So, set_backoff() erroneously check the value to be integer but it should accept fractional numbers, too. This change corrects the check eliminating int($backoff) call. Corrected code compares new value with 1.0 just like old one but catches possible warning on argument being non-numeric (non-floating point) and rejects non-numeric allowing fractional numbers. The change makes it possible to use the following within mrtg configuration file: SnmpOptions: backoff => 1.1 PR: 249015 Approved by: demon (maintainer) Modified: head/net-mgmt/p5-SNMP_Session/Makefile head/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm Modified: head/net-mgmt/p5-SNMP_Session/Makefile ============================================================================== --- head/net-mgmt/p5-SNMP_Session/Makefile Sun Aug 30 19:14:22 2020 (r547074) +++ head/net-mgmt/p5-SNMP_Session/Makefile Sun Aug 30 19:44:10 2020 (r547075) @@ -3,7 +3,7 @@ PORTNAME= SNMP_Session PORTVERSION= 1.13 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net-mgmt perl5 MASTER_SITES= http://pkgs.fedoraproject.org/repo/pkgs/perl-SNMP_Session/SNMP_Session-1.13.tar.gz/055e1065babf55f1f8606329c6bdb947/ PKGNAMEPREFIX= p5- Modified: head/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm ============================================================================== --- head/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm Sun Aug 30 19:14:22 2020 (r547074) +++ head/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm Sun Aug 30 19:44:10 2020 (r547075) @@ -1,6 +1,6 @@ ---- lib/SNMP_Session.pm.orig 2008-11-21 08:25:17.000000000 +0300 -+++ lib/SNMP_Session.pm 2013-08-12 15:13:26.000000000 +0400 -@@ -146,8 +146,8 @@ +--- lib/SNMP_Session.pm.orig 2008-11-21 05:25:17 UTC ++++ lib/SNMP_Session.pm +@@ -146,8 +146,8 @@ BEGIN { if (eval {local $SIG{__DIE__};require Socket6;} && eval {local $SIG{__DIE__};require IO::Socket::INET6; IO::Socket::INET6->VERSION("1.26");}) { @@ -11,7 +11,20 @@ $SNMP_Session::ipv6available = 1; } eval 'local $SIG{__DIE__};local $SIG{__WARN__};$dont_wait_flags = MSG_DONTWAIT();'; -@@ -549,7 +549,7 @@ +@@ -194,8 +194,11 @@ sub set_retries { + } + sub set_backoff { + my ($session, $backoff) = @_; ++ my ($_good, $_warn); ++ ++ { local $SIG{__WARN__} = sub { $_warn = $_[0] }; $_good = $backoff >= 1.0; } + croak ("backoff ($backoff) must be a number >= 1.0") +- unless $backoff == int ($backoff) && $backoff >= 1.0; ++ unless $_good && !$_warn; + $session->{'backoff'} = $backoff; + } + +@@ -549,7 +552,7 @@ sub pretty_address { # complaining about AF_INET6 when Socket6 is not available if( (defined $ipv6_addr_len) && (length $addr == $ipv6_addr_len)) { @@ -20,7 +33,7 @@ $addrstr = inet_ntop (AF_INET6(), $addrunpack); } else { ($port,$addrunpack) = unpack_sockaddr_in ($addr); -@@ -605,7 +605,7 @@ +@@ -605,7 +608,7 @@ use Carp; BEGIN { if($SNMP_Session::ipv6available) { import IO::Socket::INET6; @@ -29,7 +42,7 @@ } } -@@ -825,8 +825,8 @@ +@@ -825,8 +828,8 @@ sub sa_equal_p ($$$) { ($p2,$a2) = unpack_sockaddr_in ($sa2); } elsif($this->{'sockfamily'} == AF_INET6()) { # IPv6 addresses @@ -40,7 +53,7 @@ } else { return 0; } -@@ -899,7 +899,7 @@ +@@ -899,7 +902,7 @@ sub receive_trap { return undef unless $remote_addr; if( (defined $ipv6_addr_len) && (length $remote_addr == $ipv6_addr_len)) { @@ -49,7 +62,7 @@ } else { ($port,$iaddr) = unpack_sockaddr_in($remote_addr); } -@@ -948,7 +948,7 @@ +@@ -948,7 +951,7 @@ sub receive_request { return undef unless $remote_addr; if( (defined $ipv6_addr_len) && (length $remote_addr == $ipv6_addr_len)) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008301944.07UJiAh4075260>