Re: [net-snmp:patches] #1388 patch for bug 2923: snmpv3 bulkget errors result in double free core dump

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
On 5/14/19 4:01 PM, Bill Fenner wrote:
> Perhaps getbulk no longer dumps core, but I can not get it to return
> anything but GENERR any more, and, it seems to leak memory.
>
> Any "large enough" request seems to fail in this way, e.g.,
> snmpbulkget -v 3 ... -Cn 5 -Cr 50 sysUpTime sysUpTime sysUpTime
> sysUpTime sysUpTime .1
>
> This is particularly frustrating because code was added to 5.8 to
> rebuild a getbulk reply if it's too big.  But there was already code
> to not build the PDU too big, it's just not taking the v3 header into
> account properly (that's my best guess, at least).  So now there are
> two different mechanisms to send a "right-size" reply and they both
> don't work.  Around 5.8 release time I was working with Robert Story
> to fix this, but that effort kind of petered out and Robert's work
> didn't make it into git.
>
> Can anyone get getbulk to work in the current 5.8-patches with SNMPv3?
>
> I've attached a test script with 504 failing test cases when I run it
> against an unmodified V5-8-patches branch, and net-snmp leaks about a
> meg of RAM during the test.  This is an adaptation of my internal test
> to the net-snmp test framework; the complete test would use all
> supported values for -l, -a, -x but for now this is the simplest one
> using nanp.

Hi Bill,

How about the patch below? I am not aware of any requirement in any RFC
to limit the maximum size of an SNMP reply to a single network MTU.

Thanks,

Bart.

Subject: [PATCH] libsnmp: Increase the maximum session receive size from
1472to 2**31-1 bytes

This patch adjusts a limit that was introduced by commit 6e83b3cd891d
("  - respect msgMaxSize in received v3 PDUs (in the weak sense that
if     the serialized response PDU is more than it, we don't send it)")
# v5.7.
---
 snmplib/snmp_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
index c9a5b1edee34..e133ab6eb603 100644
--- a/snmplib/snmp_api.c
+++ b/snmplib/snmp_api.c
@@ -769,7 +769,7 @@ snmp_sess_init(netsnmp_session * session)
     session->retries = SNMP_DEFAULT_RETRIES;
     session->version = SNMP_DEFAULT_VERSION;
     session->securityModel = SNMP_DEFAULT_SECMODEL;
-    session->rcvMsgMaxSize = SNMP_MAX_MSG_SIZE;
+    session->rcvMsgMaxSize = netsnmp_max_send_msg_size();
     session->sndMsgMaxSize = netsnmp_max_send_msg_size();
     session->flags |= SNMP_FLAGS_DONT_PROBE;
 }





_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.