diff options
author | Eugene Grosbein <eugen@FreeBSD.org> | 2020-08-30 19:44:10 +0000 |
---|---|---|
committer | Eugene Grosbein <eugen@FreeBSD.org> | 2020-08-30 19:44:10 +0000 |
commit | 8745403e864e7849887d441b4b8adaa851fb569a (patch) | |
tree | 3b635ec59b4fd6fcb553f5076dc62e175335034e /net-mgmt/p5-SNMP_Session | |
parent | b8ed0ec141a79a077f31c54ca74a1655c9bd9074 (diff) | |
download | ports-8745403e864e7849887d441b4b8adaa851fb569a.tar.gz ports-8745403e864e7849887d441b4b8adaa851fb569a.zip |
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)
Notes
Notes:
svn path=/head/; revision=547075
Diffstat (limited to 'net-mgmt/p5-SNMP_Session')
-rw-r--r-- | net-mgmt/p5-SNMP_Session/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm | 29 |
2 files changed, 22 insertions, 9 deletions
diff --git a/net-mgmt/p5-SNMP_Session/Makefile b/net-mgmt/p5-SNMP_Session/Makefile index 9fc169b8e1da..3ca340bd1a6e 100644 --- a/net-mgmt/p5-SNMP_Session/Makefile +++ b/net-mgmt/p5-SNMP_Session/Makefile @@ -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- diff --git a/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm b/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm index 11534f9e4c18..9d738f0e947d 100644 --- a/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm +++ b/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm @@ -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)) { |