From d3a79d0b6c67bcb9b1a48d68fe490beaacd0be51 Mon Sep 17 00:00:00 2001 From: martijn Date: Sun, 12 Nov 2023 19:58:15 +0000 Subject: [PATCH] No reason to call (error-prone) smi_scalar_oidlen when we include the scalar .0 ourselves. OK tb@ --- usr.sbin/snmpd/trap.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index acdce028ac0..873251f84b9 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.37 2021/09/02 05:41:02 martijn Exp $ */ +/* $OpenBSD: trap.c,v 1.38 2023/11/12 19:58:15 martijn Exp $ */ /* * Copyright (c) 2008 Reyk Floeter @@ -42,13 +42,11 @@ void trap_init(void) { - struct ber_oid trapoid = OID(MIB_coldStart); - /* * Send a coldStart to notify that the daemon has been * started and re-initialized. */ - trap_send(&trapoid, NULL); + trap_send(&OID(MIB_coldStart, 0), NULL); } int @@ -56,8 +54,8 @@ trap_send(struct ber_oid *oid, struct ber_element *elm) { struct trap_address *tr; struct ber_element *vblist, *trap; - struct ber_oid uptime = OID(MIB_sysUpTime); - struct ber_oid trapoid = OID(MIB_snmpTrapOID); + struct ber_oid uptime = OID(MIB_sysUpTime, 0); + struct ber_oid trapoid = OID(MIB_snmpTrapOID, 0); char ostr[SNMP_MAX_OID_STRLEN]; struct oid oa, ob; struct snmp_message *msg; @@ -65,10 +63,6 @@ trap_send(struct ber_oid *oid, struct ber_element *elm) if (TAILQ_EMPTY(&snmpd_env->sc_trapreceivers)) return (0); - smi_scalar_oidlen(&uptime); - smi_scalar_oidlen(&trapoid); - smi_scalar_oidlen(oid); - smi_oid2string(oid, ostr, sizeof(ostr), 0); log_debug("trap_send: oid %s", ostr); -- 2.20.1