On Sat, Aug 07, 2004 at 12:32:54AM +0200, Magnus Fromreide wrote:
> On Mon, Aug 02, 2004 at 10:21:52PM -0700, Wes Hardaker wrote:
> > >>>>> On Mon, 2 Aug 2004 19:52:25 +0200, Magnus Fromreide <[EMAIL PROTECTED]> said:
> > 
> > Magnus> Recently the (CVS) agent have started to default associate the
> > Magnus> empty context when no context is specified. How should I do to
> > Magnus> restore the old behaviour so that no context is transmitted?
> > 
> > Magnus> Note that the empty context ain't equal to the default
> > Magnus> context, just as "" != NULL.
> > 
> > I'll look into that.  Thanks for pointing it out.
> 

Attached is a patch that solves the problem for me by always using the context
string the AgentX subagent registered for communicating with it. This makes it
independent of the mapping between SNMP request context and AgentX registration
context.

/MF
Index: agent/mibgroup/agentx/master.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/agentx/master.c,v
retrieving revision 5.25
diff -c -r5.25 master.c
*** agent/mibgroup/agentx/master.c      13 Aug 2004 10:09:02 -0000      5.25
--- agent/mibgroup/agentx/master.c      15 Aug 2004 21:02:45 -0000
***************
*** 497,505 ****
      pdu->reqid = snmp_get_next_transid();
      pdu->transid = reqinfo->asp->pdu->transid;
      pdu->sessid = ax_session->subsession->sessid;
!     if (reqinfo->asp->pdu->contextName) {
!         pdu->community = strdup(reqinfo->asp->pdu->contextName);
!         pdu->community_len = strlen(reqinfo->asp->pdu->contextName);
          pdu->flags |= AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT;
      }
      if (ax_session->subsession->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER)
--- 497,505 ----
      pdu->reqid = snmp_get_next_transid();
      pdu->transid = reqinfo->asp->pdu->transid;
      pdu->sessid = ax_session->subsession->sessid;
!     if (reginfo->contextName) {
!         pdu->community = strdup(reginfo->contextName);
!         pdu->community_len = strlen(reginfo->contextName);
          pdu->flags |= AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT;
      }
      if (ax_session->subsession->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER)

Reply via email to