Took me a while to dig up my octeon machine.

The problem is that requestid is an int32, not a long long.
Diff below fixes this for me.

OK?

martijn@

On Wed, 2022-02-09 at 15:01 +0100, Sebastian Oswald wrote:
> > Synopsis:      snmpd exits upon query by manager
> > Category:      system
> > Environment:
>         System      : OpenBSD 7.0
>         Details     : OpenBSD 7.0-current (GENERIC.MP) #843: Tue Feb  8 
> 18:55:35 MST 2022
>                          
> [email protected]:/usr/src/sys/arch/octeon/compile/GENERIC.MP
> 
>         Architecture: OpenBSD.octeon
>         Machine     : octeon
> 
> > Description:
> after recent updates/upgrade via 'syspugrade -s' and 'pkg_add -u' snmpd exits 
> upon the first poll by a manager.
> no errors are logged, but when spawning snmpd in foreground with extensive 
> verbosity the following is shown:
> 
> [...]
> USM: engineid '', engine boots 0, engine time 0, user ''
> snmpe_parse: 172.25.50.99:161: unknown engine id
> USM: engineid 
> '800075cb8192181e2bdb5065b50b43f6c3def2b40fd8a21228809b0ee452cc88', engine 
> boots 0, engine time 1644411792, user 'zabbix'
> snmpe_parse: 172.25.50.99:161: SNMPv3 pdutype GetBulkRequest, flags 0x7, 
> secmodel 3, user 'zabbix', ctx-engine 
> 800075cb8192181e2bdb5065b50b43f6c3def2b40fd8a21228809b0ee452cc88, ctx-name 
> '', request
> 1116207041
> 78566 parent exiting
> 
> 
> when trying to use protocol version 2c:
> [...]
> snmpe_parse: 172.25.50.99:161: SNMPv2 'test' pdutype GetBulkRequest request 
> 1825123407
> 94220 parent exiting
> 
> 
> 
> snmpd.conf contents:
> listen_address="172.25.50.1"
> listen on $listen_address
> system description "OpenBSD gateway"
> system location "home"
> system services 74
> system oid 1.3.6.1.4.1.30155.23.1
> seclevel enc
> user "zabbix" authkey "secret" auth "hmac-md5" enckey "secret" enc "aes"
> 
> 
> 
> > How-To-Repeat:
> 
> Steps to reproduce:
> - start snmpd (via rcctl or with "snmpd -dvvvvv" for verbose output)
> - poll agent from another host
> - snmpd exits
> 
Index: application.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/application.c,v
retrieving revision 1.2
diff -u -p -r1.2 application.c
--- application.c       30 Jan 2022 13:27:39 -0000      1.2
+++ application.c       22 Feb 2022 12:45:43 -0000
@@ -610,7 +610,7 @@ appl_processpdu(struct snmp_message *sta
        size_t i, varbindlen = 0, repeaterlen;
 
        /* pdu must be ASN.1 validated in snmpe.c */
-       (void) ober_scanf_elements(pdu, "{iiie", &requestid, &nonrepeaters,
+       (void) ober_scanf_elements(pdu, "{diie", &requestid, &nonrepeaters,
            &maxrepetitions, &varbindlist);
 
        /* RFC 3413, section 3.2, processPDU, item 5, final bullet */

Reply via email to