123 lines
4.6 KiB
Diff
123 lines
4.6 KiB
Diff
diff -urNp a/agent/agent_trap.c b/agent/agent_trap.c
|
|
--- a/agent/agent_trap.c 2019-02-13 13:10:36.862269252 +0100
|
|
+++ b/agent/agent_trap.c 2019-02-13 15:02:11.396042356 +0100
|
|
@@ -174,6 +174,11 @@ _trap_version_incr(int version)
|
|
case SNMP_VERSION_3:
|
|
++_v2_sessions;
|
|
break;
|
|
+#ifdef USING_AGENTX_PROTOCOL_MODULE
|
|
+ case AGENTX_VERSION_1:
|
|
+ /* agentx registers in sinks, no need to count */
|
|
+ break;
|
|
+#endif
|
|
default:
|
|
snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
|
|
}
|
|
@@ -201,6 +206,11 @@ _trap_version_decr(int version)
|
|
_v2_sessions = 0;
|
|
}
|
|
break;
|
|
+#ifdef USING_AGENTX_PROTOCOL_MODULE
|
|
+ case AGENTX_VERSION_1:
|
|
+ /* agentx registers in sinks, no need to count */
|
|
+ break;
|
|
+#endif
|
|
default:
|
|
snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
|
|
}
|
|
diff -urNp old/agent/mibgroup/agentx/master.c new/agent/mibgroup/agentx/master.c
|
|
--- old/agent/mibgroup/agentx/master.c 2019-04-03 12:13:55.115769783 +0200
|
|
+++ new/agent/mibgroup/agentx/master.c 2019-04-10 09:49:53.277168497 +0200
|
|
@@ -280,6 +280,11 @@ agentx_got_response(int operation,
|
|
netsnmp_free_delegated_cache(cache);
|
|
return 0;
|
|
|
|
+ case NETSNMP_CALLBACK_OP_RESEND:
|
|
+ DEBUGMSGTL(("agentx/master", "resend on session %8p req=0x%x\n",
|
|
+ session, (unsigned)reqid));
|
|
+ return 0;
|
|
+
|
|
case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
|
|
/*
|
|
* This session is alive
|
|
diff -urNp old/snmplib/snmp_api.c new/snmplib/snmp_api.c
|
|
--- old/snmplib/snmp_api.c 2019-04-24 00:28:34.904357292 +0200
|
|
+++ new/snmplib/snmp_api.c 2019-04-24 00:24:40.101830685 +0200
|
|
@@ -352,6 +352,7 @@ static int snmpv3_build(u_char ** p
|
|
netsnmp_pdu *pdu);
|
|
static int snmp_parse_version(u_char *, size_t);
|
|
static int snmp_resend_request(struct session_list *slp,
|
|
+ netsnmp_request_list *orp,
|
|
netsnmp_request_list *rp,
|
|
int incr_retries);
|
|
static void register_default_handlers(void);
|
|
@@ -5717,7 +5718,7 @@ _sess_process_packet_handle_pdu(void *se
|
|
* * inifinite resend
|
|
*/
|
|
if (rp->retries <= sp->retries) {
|
|
- snmp_resend_request(slp, rp, TRUE);
|
|
+ snmp_resend_request(slp, orp, rp, TRUE);
|
|
break;
|
|
} else {
|
|
/* We're done with retries, so no longer waiting for a response */
|
|
@@ -6662,9 +6663,22 @@ snmp_timeout(void)
|
|
snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
|
|
}
|
|
|
|
+static void
|
|
+remove_request(struct snmp_internal_session *isp,
|
|
+ netsnmp_request_list *orp, netsnmp_request_list *rp)
|
|
+{
|
|
+ if (orp)
|
|
+ orp->next_request = rp->next_request;
|
|
+ else
|
|
+ isp->requests = rp->next_request;
|
|
+ if (isp->requestsEnd == rp)
|
|
+ isp->requestsEnd = orp;
|
|
+ snmp_free_pdu(rp->pdu);
|
|
+}
|
|
+
|
|
static int
|
|
-snmp_resend_request(struct session_list *slp, netsnmp_request_list *rp,
|
|
- int incr_retries)
|
|
+snmp_resend_request(struct session_list *slp, netsnmp_request_list *orp,
|
|
+ netsnmp_request_list *rp, int incr_retries)
|
|
{
|
|
struct snmp_internal_session *isp;
|
|
netsnmp_session *sp;
|
|
@@ -6731,9 +6745,11 @@ snmp_resend_request(struct session_list
|
|
sp->s_snmp_errno = SNMPERR_BAD_SENDTO;
|
|
sp->s_errno = errno;
|
|
snmp_set_detail(strerror(errno));
|
|
- if (rp->callback)
|
|
+ if (rp->callback) {
|
|
rp->callback(NETSNMP_CALLBACK_OP_SEND_FAILED, sp,
|
|
rp->pdu->reqid, rp->pdu, rp->cb_data);
|
|
+ remove_request(isp, orp, rp);
|
|
+ }
|
|
return -1;
|
|
} else {
|
|
netsnmp_get_monotonic_clock(&now);
|
|
@@ -6813,19 +6829,12 @@ snmp_sess_timeout(void *sessp)
|
|
callback(NETSNMP_CALLBACK_OP_TIMED_OUT, sp,
|
|
rp->pdu->reqid, rp->pdu, magic);
|
|
}
|
|
- if (orp)
|
|
- orp->next_request = rp->next_request;
|
|
- else
|
|
- isp->requests = rp->next_request;
|
|
- if (isp->requestsEnd == rp)
|
|
- isp->requestsEnd = orp;
|
|
- snmp_free_pdu(rp->pdu);
|
|
+ remove_request(isp, orp, rp);
|
|
freeme = rp;
|
|
continue; /* don't update orp below */
|
|
} else {
|
|
- if (snmp_resend_request(slp, rp, TRUE)) {
|
|
+ if (snmp_resend_request(slp, orp, rp, TRUE))
|
|
break;
|
|
- }
|
|
}
|
|
}
|
|
orp = rp;
|