cannot do SNMPv3 set

Jochen Katz katz____agentpp.com
Sat Dec 1 01:44:20 CET 2001


Hi,

> Ever since I upgraded to snmp++v3.1.4a and agent++v3.5h I have been unable
> to perform set operations.  Gets work just fine, and I can also walk the
> mib, but I am not able to change any values (even though snmpSet returns
> SUCCESS as status on the set).  I am using SNMPv3 with both authentication
> 
> Here are some of these messages (generated by the agent):
> mp: received request message with zero length contextEngineID ->
> unknownPduHandlers.

well, again this thing: The contextEngineId of the Pdu isn't checked, as
the UTarget has a engineId != "". See the attached fix against plain
v3.4.1a.

> And what is generated by snmpSet:
> ***Receiving a ReportPDU ***
> SNMPv3: Invalid Message
> Set Status = Success

I will look at this later.

Kind regards,
  Jochen
-------------- next part --------------
--- uxsnmp.with_nasty_bug	Thu Nov 15 23:14:31 2001
+++ uxsnmp.cpp	Sat Dec  1 01:30:57 2001
@@ -1081,6 +1081,14 @@
       return SNMP_CLASS_INVALID_TARGET;
     }
 
+    // set context_engine_id of pdu, if it is not set
+    if (pdu.get_context_engine_id().len() == 0)
+    {
+      debugprintf(8, "Setting contextEngineID of Pdu to (%s)",
+                  engine_id.get_printable());
+      pdu.set_context_engine_id(engine_id);
+    }
+
     debugprintf(4,"Snmp::trap:");
     debugprintf(4," engineID (%s), securityName (%s)\n securityModel (%i) security_level (%i)",
 		engine_id.get_printable(), security_name.get_printable(),
@@ -1468,16 +1476,16 @@
 				   (char*)udp_address.get_printable())
 	    == SNMPv3_MP_OK ) {
 	  utarget->set_engine_id(engine_id);
-	  // set context_engine_id of pdu, if it is not set
-	  if (pdu.get_context_engine_id().len() == 0)
-	    {
-	      debugprintf(8, "Setting contextEngineID of Pdu to (%s)",
-			  engine_id.get_printable());
-	      pdu.set_context_engine_id(engine_id);
-	      backupPdu.set_context_engine_id(engine_id);
-	    }
 	} // else: engineID="" --> automatic engineID discovery
 	v3Lock.unlock();
+      }
+      // set context_engine_id of pdu, if it is not set
+      if (pdu.get_context_engine_id().len() == 0)
+      {
+        debugprintf(8, "Setting contextEngineID of Pdu to (%s)",
+                    engine_id.get_printable());
+        pdu.set_context_engine_id(engine_id);
+        backupPdu.set_context_engine_id(engine_id);
       }
 
       debugprintf(4,"Snmp::snmp_engine:");


More information about the AGENTPP mailing list