> According to RFC2741 section 6.1.1 an agentx-response-pdu shouldn't have
> the NON_DEFAULT_CONTEXT set. Remove the argument from ax_response().
Here's the libagentx counterpart.
OK?
martijn@
Index: agentx.c
===
RCS file: /cvs/src/lib/libagentx/agentx.c,v
retrieving revision 1.22
diff -u -p -r1.22 agentx.c
--- agentx.c27 Dec 2022 17:10:05 - 1.22
+++ agentx.c9 Oct 2023 20:24:40 -
@@ -2733,8 +2733,7 @@ agentx_get_finalize(struct agentx_get *a
free(logmsg);
if (ax_response(ax->ax_ax, axs->axs_id, axg->axg_transactionid,
- axg->axg_packetid, AGENTX_CONTEXT_CTX(axc), 0, error, index,
- vbl, nvarbind) == -1) {
+ axg->axg_packetid, 0, error, index, vbl, nvarbind) == -1) {
agentx_log_axg_warn(axg, "Couldn't parse request");
agentx_reset(ax);
} else
@@ -4041,7 +4040,6 @@ agentx_read(struct agentx *ax)
if (ax_response(ax->ax_ax, axs->axs_id,
pdu->ap_header.aph_transactionid,
pdu->ap_header.aph_packetid,
- axc == NULL ? NULL : AGENTX_CONTEXT_CTX(axc),
0, error, 1, NULL, 0) == -1)
agentx_log_axc_warn(axc,
"transaction: %u packetid: %u: failed to send "
Index: ax.c
===
RCS file: /cvs/src/lib/libagentx/ax.c,v
retrieving revision 1.8
diff -u -p -r1.8 ax.c
--- ax.c24 Oct 2021 17:43:38 - 1.8
+++ ax.c9 Oct 2023 20:24:40 -
@@ -553,11 +553,11 @@ ax_unregister(struct ax *ax, uint32_t se
int
ax_response(struct ax *ax, uint32_t sessionid, uint32_t transactionid,
-uint32_t packetid, struct ax_ostring *context, uint32_t sysuptime,
-uint16_t error, uint16_t index, struct ax_varbind *vblist, size_t nvb)
+uint32_t packetid, uint32_t sysuptime, uint16_t error, uint16_t index,
+struct ax_varbind *vblist, size_t nvb)
{
if (ax_pdu_header(ax, AX_PDU_TYPE_RESPONSE, 0, sessionid,
- transactionid, packetid, context) == -1)
+ transactionid, packetid, NULL) == -1)
return -1;
if (ax_pdu_add_uint32(ax, sysuptime) == -1 ||
Index: ax.h
===
RCS file: /cvs/src/lib/libagentx/ax.h,v
retrieving revision 1.4
diff -u -p -r1.4 ax.h
--- ax.h2 Jan 2021 01:06:31 - 1.4
+++ ax.h9 Oct 2023 20:24:40 -
@@ -220,8 +220,7 @@ uint32_t ax_register(struct ax *, uint8_
uint32_t ax_unregister(struct ax *, uint32_t, struct ax_ostring *,
uint8_t, uint8_t, struct ax_oid *, uint32_t);
int ax_response(struct ax *, uint32_t, uint32_t, uint32_t,
-struct ax_ostring *, uint32_t, uint16_t, uint16_t,
-struct ax_varbind *, size_t);
+uint32_t, uint16_t, uint16_t, struct ax_varbind *, size_t);
void ax_pdu_free(struct ax_pdu *);
void ax_varbind_free(struct ax_varbind *);
const char *ax_error2string(enum ax_pdu_error);