From: martijn Date: Wed, 19 Jan 2022 11:00:56 +0000 (+0000) Subject: Hook up the new application layer. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=84d6342e8e2810995955cf8522db057d84276112;p=openbsd Hook up the new application layer. OK jmatthew@ tested as part of larger diff by sthen@ and Joel Carnat --- diff --git a/usr.sbin/snmpd/Makefile b/usr.sbin/snmpd/Makefile index eb7b6c927d2..9fbe1aecdc0 100644 --- a/usr.sbin/snmpd/Makefile +++ b/usr.sbin/snmpd/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.17 2020/06/30 17:11:49 martijn Exp $ +# $OpenBSD: Makefile,v 1.18 2022/01/19 11:00:56 martijn Exp $ PROG= snmpd MAN= snmpd.8 snmpd.conf.5 -SRCS= parse.y log.c snmpe.c \ +SRCS= parse.y log.c snmpe.c application.c application_legacy.c \ mps.c trap.c mib.c smi.c kroute.c snmpd.c timer.c \ pf.c proc.c usm.c traphandler.c util.c diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 36b20555d16..19c0f009941 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.81 2022/01/19 10:36:35 martijn Exp $ */ +/* $OpenBSD: snmpe.c,v 1.82 2022/01/19 11:00:56 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -37,6 +37,7 @@ #include #include +#include "application.h" #include "snmpd.h" #include "snmpe.h" #include "mib.h" @@ -98,6 +99,7 @@ snmpe_init(struct privsep *ps, struct privsep_proc *p, void *arg) kr_init(); timer_init(); usm_generate_keys(); + appl_init(); /* listen for incoming SNMP UDP/TCP messages */ TAILQ_FOREACH(h, &env->sc_addresses, entry) { @@ -136,6 +138,7 @@ snmpe_shutdown(void) close(h->fd); } kr_shutdown(); + appl_shutdown(); } int @@ -429,7 +432,7 @@ badversion: for (a = msg->sm_varbind; a != NULL; a = a->be_next) { if (ober_scanf_elements(a, "{oS$}", NULL) == -1) goto parsefail; - } + } msg->sm_request = req; msg->sm_error = errval; @@ -471,6 +474,13 @@ snmpe_parsevarbinds(struct snmp_message *msg) struct ber_oid o; int i; + appl_processpdu(msg, msg->sm_ctxname, msg->sm_version, msg->sm_pdu); + return 0; + /* + * Leave code here for now so it's easier to switch back in case of + * issues. + */ + msg->sm_errstr = "invalid varbind element"; varbind = msg->sm_varbind; @@ -815,6 +825,11 @@ snmpe_dispatchmsg(struct snmp_message *msg) /* XXX Do proper error handling */ (void) snmpe_parsevarbinds(msg); + return; + /* + * Leave code here for now so it's easier to switch back in case of + * issues. + */ /* respond directly */ msg->sm_pdutype = SNMP_C_RESPONSE; snmpe_response(msg);