Hi Coders,

We use standard linux-3.10 kernel and net-snmp version 5.7.2 on powerpc
target.

As per RFC-2741, that now  RESPONSE-PDU is generated for trap notify &
close in AgentX.
Is there any specific reason for that to get included? Because I see that
the flag UCD_MSG_FLAG_EXPECT_RESPONSE being set (in function
_agentx_realloc_build) for notify and these packets are getting saved in
queue for later  retransmission. So it leads duplication trap at sometime.

Below is the tcpdump of the same issue:

21009    2017-04-14 09:22:18.334216    127.0.0.1    127.0.0.1    AgentX
 366    Notify-PDU: sid=6, tid=0,* packid=679843704*, plen=292    >>>>OK
Trap

21011    2017-04-14 09:22:18.346861    127.0.0.1    127.0.0.1    AgentX
 374    Response-PDU: sid=6, tid=0, packid=679843704, plen=300

21013    2017-04-14 09:22:18.518079    127.0.0.1    127.0.0.1    AgentX
 74    Ping-PDU: sid=40, tid=0, packid=2102434099, plen=0

21014    2017-04-14 09:22:18.519092    127.0.0.1    127.0.0.1    AgentX
 82    Response-PDU: sid=40, tid=0, packid=2102434099, plen=8

21019    2017-04-14 09:22:18.930801    127.0.0.1    127.0.0.1    AgentX
 254    Notify-PDU: sid=12, tid=0, packid=1192, plen=180

21020    2017-04-14 09:22:18.967669    127.0.0.1    127.0.0.1    AgentX
 154    Notify-PDU: sid=26, tid=0, packid=924, plen=80

21023    2017-04-14 09:22:19.004928    127.0.0.1    127.0.0.1    AgentX
 154    Notify-PDU: sid=26, tid=0, packid=925, plen=80

21025    2017-04-14 09:22:19.021387    127.0.0.1    127.0.0.1    AgentX
 262    Response-PDU: sid=12, tid=0, packid=1192, plen=188

21027    2017-04-14 09:22:19.099249    127.0.0.1    127.0.0.1    AgentX
 162    Response-PDU: sid=26, tid=0, packid=924, plen=88

21029    2017-04-14 09:22:19.112175    127.0.0.1    127.0.0.1    AgentX
 162    Response-PDU: sid=26, tid=0, packid=925, plen=88

21031    2017-04-14 09:22:20.470909    127.0.0.1    127.0.0.1    AgentX
 366    Notify-PDU: sid=6, tid=0, *packid=679843704*, plen=292    >>>>OK
Trap

21032    2017-04-14 09:22:20.478677    127.0.0.1    127.0.0.1    AgentX
 374    Response-PDU: sid=6, tid=0, packid=679843704, plen=300


And as per RFC-2471
"


*Note that the master agent's successful response indicates the
agentx-Notify-PDU was received and validated.  It does not      indicate
that any particular notifications were actually generated      or received
by notification targets."*

So I tried disabling the flag for trap notify with the below patch and I
don’t see any such duplication of trap further on.

Is it oK to go with below snip ? OR Is there anyother way by which I can
stop the duplication of trap ?

--- a/agent/mibgroup/agentx/protocol.c
+++ b/agent/mibgroup/agentx/protocol.c
@@ -720,6 +720,11 @@ _agentx_realloc_build(u_char ** buf, size_t * buf_len,
size_t * out_len,

     pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;

+   /* double trap */
+   if(pdu->command == AGENTX_MSG_NOTIFY) {
+       pdu->flags &= ~UCD_MSG_FLAG_EXPECT_RESPONSE;
+   }
+
     DEBUGDUMPHEADER("send", "AgentX Payload");
     switch (pdu->command) {

diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
index 87c45a7..e3098f6 100644
--- a/snmplib/snmp_api.c
+++ b/snmplib/snmp_api.c
@@ -4804,6 +4804,7 @@ _sess_async_send(void *sessp,
         case SNMP_MSG_REPORT:
         case AGENTX_MSG_CLEANUPSET:
         case AGENTX_MSG_RESPONSE:
+        case AGENTX_MSG_NOTIFY: /* SMX/CMX */

Thanks in Advance,
A. Mydeen.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to