diff options
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/application.c | 3 | ||||
-rw-r--r-- | usr.sbin/snmpd/application.h | 3 | ||||
-rw-r--r-- | usr.sbin/snmpd/snmpe.c | 4 | ||||
-rw-r--r-- | usr.sbin/snmpd/usm.c | 14 |
4 files changed, 7 insertions, 17 deletions
diff --git a/usr.sbin/snmpd/application.c b/usr.sbin/snmpd/application.c index 4004e628568..afc9f2e74cc 100644 --- a/usr.sbin/snmpd/application.c +++ b/usr.sbin/snmpd/application.c @@ -1,4 +1,4 @@ -/* $OpenBSD: application.c,v 1.34 2023/11/08 20:02:52 martijn Exp $ */ +/* $OpenBSD: application.c,v 1.35 2023/11/08 20:07:14 martijn Exp $ */ /* * Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org> @@ -152,7 +152,6 @@ int appl_varbind_valid(struct appl_varbind *, struct appl_varbind_internal *, int appl_error_valid(enum appl_error, enum snmp_pdutype); int appl_varbind_backend(struct appl_varbind_internal *); void appl_varbind_error(struct appl_varbind_internal *, enum appl_error); -void appl_report(struct snmp_message *, int32_t, struct ber_oid *); void appl_pdu_log(struct appl_backend *, enum snmp_pdutype, int32_t, uint16_t, uint16_t, struct appl_varbind *); void ober_oid_nextsibling(struct ber_oid *); diff --git a/usr.sbin/snmpd/application.h b/usr.sbin/snmpd/application.h index 30657c5b295..7519a7d7009 100644 --- a/usr.sbin/snmpd/application.h +++ b/usr.sbin/snmpd/application.h @@ -1,4 +1,4 @@ -/* $OpenBSD: application.h,v 1.10 2023/11/08 19:46:28 martijn Exp $ */ +/* $OpenBSD: application.h,v 1.11 2023/11/08 20:07:14 martijn Exp $ */ /* * Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org> @@ -140,6 +140,7 @@ void appl_processpdu(struct snmp_message *, const char *, enum snmp_version , struct ber_element *); void appl_response(struct appl_backend *, int32_t, enum appl_error, int16_t, struct appl_varbind *); +void appl_report(struct snmp_message *, int32_t, struct ber_oid *); struct ber_element *appl_exception(enum appl_exception); /* application_legacy.c */ diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 669fbd0ac53..42eabc46cfa 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.89 2023/11/08 19:50:24 martijn Exp $ */ +/* $OpenBSD: snmpe.c,v 1.90 2023/11/08 20:07:14 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -565,7 +565,6 @@ snmpe_tryparse(int fd, struct snmp_message *msg) if (snmpe_parse(msg) == -1) { if (msg->sm_usmerr && MSG_REPORT(msg)) { usm_make_report(msg); - snmpe_response(msg); return; } else goto fail; @@ -717,7 +716,6 @@ snmpe_recvmsg(int fd, short sig, void *arg) if (snmpe_parse(msg) == -1) { if (msg->sm_usmerr != 0 && MSG_REPORT(msg)) { usm_make_report(msg); - snmpe_response(msg); return; } else { snmp_msgfree(msg); diff --git a/usr.sbin/snmpd/usm.c b/usr.sbin/snmpd/usm.c index a3df1ac0f31..586925c0eee 100644 --- a/usr.sbin/snmpd/usm.c +++ b/usr.sbin/snmpd/usm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usm.c,v 1.26 2023/05/08 12:25:23 gerhard Exp $ */ +/* $OpenBSD: usm.c,v 1.27 2023/11/08 20:07:14 martijn Exp $ */ /* * Copyright (c) 2012 GeNUA mbH @@ -39,6 +39,7 @@ #include <openssl/evp.h> #include <openssl/hmac.h> +#include "application.h" #include "snmpd.h" #include "mib.h" @@ -569,16 +570,7 @@ usm_finalize_digest(struct snmp_message *msg, char *buf, ssize_t len) void usm_make_report(struct snmp_message *msg) { - struct ber_oid usmstat = OID(MIB_usmStats, 0, 0); - - msg->sm_pdutype = SNMP_C_REPORT; - usmstat.bo_id[OIDIDX_usmStats] = msg->sm_usmerr; - usmstat.bo_n = OIDIDX_usmStats + 2; - if (msg->sm_varbindresp != NULL) - ober_free_elements(msg->sm_varbindresp); - msg->sm_varbindresp = ober_add_sequence(NULL); - mps_getreq(NULL, msg->sm_varbindresp, &usmstat, msg->sm_version); - return; + appl_report(msg, 0, &OID(MIB_usmStats, msg->sm_usmerr, 0)); } int |