[AGENT++] subagent mib register with context and net-snmp does not work?
Claus Klein
claus.klein at arcormail.de
Wed Aug 18 21:37:07 CEST 2010
Hi Frank,
I was confused by my own workaround in net-snmp to ignore the wrong
set flags.
I found the function witch set the flags and added the switch block to
check the flags.
The initialisation of int f = flags; was the most important fault
because the
AGENTX_NON_DEFAULT_CONTEXT bit was set in flags.
With that fix it works fine too with the original net-snmp V5.5.
Can you explain why the flags are not zero at the time of call of
encode_header()?
With regards,
Claus
#################################################################
void AgentXPdu::encode_header(AgentXOctets& header, int length) const
{
int f = 0; // FIXME: not used to init: flags; XXX ck
/*
* An optional context field may be present in the agentx-
Register-,
* UnRegister-, AddAgentCaps-, RemoveAgentCaps-, Get-, GetNext-,
* GetBulk-, IndexAllocate-, IndexDeallocate-, Notify-, TestSet-,
* and Ping- PDUs.
*
* The other PDU types don't include context information (RFC
2741, p. 20).
*/
switch (ax_type) {
case AGENTX_OPEN_PDU:
case AGENTX_CLOSE_PDU:
case AGENTX_RESPONSE_PDU:
case AGENTX_COMMITSET_PDU:
case AGENTX_UNDOSET_PDU:
case AGENTX_CLEANUPSET_PDU:
//assert(!(flags & AGENTX_NON_DEFAULT_CONTEXT)); //
FIXME! it was set before? ck
//flags &= ~(AGENTX_NON_DEFAULT_CONTEXT); // TBD force to
clear this bit! ck
break;
default:
if (context.len()>0){
f |= AGENTX_NON_DEFAULT_CONTEXT;
}
break;
}
f |= ((ax_type == AGENTX_REGISTER_PDU) &&
(region.is_single())) ? AGENTX_INSTANCE_REGISTRATION : 0;
f |= (network_byte_order()>0) ? AGENTX_NETWORK_BYTE_ORDER : 0;
header += version;
header += ax_type;
header += f;
header.add_null_octets(1);
header.encode_int(session_id, network_byte_order());
header.encode_int(get_transaction_id(), network_byte_order());
header.encode_int(packet_id, network_byte_order());
header.encode_int(length, network_byte_order());
}
# ---------------------------------------------------------------------
20100810.12:46:45: 11388: (2)EVENT : SubAgentXMib: GET (tid)(pid)
(oid)...: (478), (479), (1.3.6.1.4.1.4976.6.1.2.1)
20100810.12:46:45: 11388: (3)EVENT : Mib: process subrequest: get
request, context, oid: (subagent), (478), (1.3.6.1.4.1.4976.6.1.2.1)
20100810.12:46:45: 11388: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (0), (1.3.6.1.4.1.4976.6.1.2.1), (1), (2)
Assertion failed: !(flags & AGENTX_NON_DEFAULT_CONTEXT), file ..\..\..
\agentX++\src\agentx_pdu.cpp, line 813
# ---------------------------------------------------------------------
20100810.12:56:53: 892: (2)EVENT : SubAgent: starting thread execution
20100810.12:56:53: 892: (2)EVENT : SubAgentXMib: GETBULK (tid)(pid):
(0), (0)
20100810.12:56:53: 892: (2)EVENT : Mib: process request: getbulk
request, oid: (0), (1.3.6.1.4.1.4976.6)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (0), (1.3.6.1.4.1.4976.6.1.1.2.71), (2), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (1), (1.3.6.1.4.1.4976.6.1.1.2.224), (1), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (2), (1.3.6.1.4.1.4976.6.1.1.3.71), (another
text), (4)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (3), (1.3.6.1.4.1.4976.6.1.1.3.224), (a text), (4)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (4), (1.3.6.1.4.1.4976.6.1.2.0), (0), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (5), (1.3.6.1.4.1.4976.6.1.2.1), (1), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (6), (1.3.6.1.4.1.4976.6.1.2.2), (2), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (7), (1.3.6.1.4.1.4976.6.1.2.3), (3), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (8), (1.3.6.1.4.1.4976.6.1.2.4), (4), (2)
20100810.12:56:53: 892: (3)EVENT : RequestList: finished subrequest
(ind)(oid)(val)(syn): (9), (1.3.6.1.4.1.4976.6.1.2.5), (5), (2)
Assertion failed: !(flags & AGENTX_NON_DEFAULT_CONTEXT), file ..\..\..
\agentX++\src\agentx_pdu.cpp, line 813
On 08.08.2010, at 23:08, Claus Klein wrote:
> Hi Frank,
>
> you are right, it is a net-snmp problem.
>
> AgentX++ send the right response message, but net-snmp set the flag
> itself and expect the context, I do not know why?
>
> Thanks for help!
>
> With regards,
>
> Claus
>
> On 06.08.2010, at 22:39, Claus Klein wrote:
>
>> Hi Frank,
>>
>> for me it is a AgentX++ problem.
>> Did you receive my log file?
>>
>> The subagent AgentX Response is wrong coded in case of a get request
>> with context:
>>
>> There is an invalid nonDefaultContext flag set, what is not allowed!
>> And the context is empty too or the rest fields?
>
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp
More information about the AGENTPP
mailing list