In snmpe_writecb, don't call snmpe_prepare_read() when there's still
authormartijn <martijn@openbsd.org>
Mon, 20 Nov 2023 10:32:45 +0000 (10:32 +0000)
committermartijn <martijn@openbsd.org>
Mon, 20 Nov 2023 10:32:45 +0000 (10:32 +0000)
data left inside sm_data. If there's an incomplete packet left in the
buffer it will be called from snmpe_tryparse, if there's a complete
packet left we can end up with new events from the tcp socket, which the
tcp subsystem isn't prepared to handle.

OK tb@

usr.sbin/snmpd/snmpe.c

index da12181..1216929 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: snmpe.c,v 1.91 2023/11/12 19:59:56 martijn Exp $      */
+/*     $OpenBSD: snmpe.c,v 1.92 2023/11/20 10:32:45 martijn Exp $      */
 
 /*
  * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -648,7 +648,6 @@ snmpe_writecb(int fd, short type, void *arg)
                    msg->sm_datalen - reqlen);
                nmsg->sm_datalen = msg->sm_datalen - reqlen;
                snmp_msgfree(msg);
-               snmpe_prepare_read(nmsg, fd);
                snmpe_tryparse(fd, nmsg);
        } else {
                snmp_msgfree(msg);