On Wed, Jul 31, 2019 at 09:34:22PM +0200, Martijn van Duren wrote:
> Found this while playing around with snmp.
> 
> Right now we don't accept a 0 value the start of an oid. Since we return
> 0.0 OIDs from snmpd they don't get displayed when querying them with
> snmpctl. Diff below removes this restriction.
> 
> $ snmpctl walk 127.0.0.1 oid ifSpecific
> $ LD_PRELOAD=/usr/src/lib/libutil/obj/libutil.so.13.1 snmpctl walk 127.0.0.1 
> oid ifSpecific  
> ifSpecific.1=0.0
> ifSpecific.2=0.0
> ifSpecific.3=0.0
> ifSpecific.4=0.0
> ifSpecific.5=0.0
> ifSpecific.6=0.0
> $ snmpwalk -v2c -cpublic 127.0.0.1 ifSpecific                                 
>              
> IF-MIB::ifSpecific.1 = OID: SNMPv2-SMI::zeroDotZero
> IF-MIB::ifSpecific.2 = OID: SNMPv2-SMI::zeroDotZero
> IF-MIB::ifSpecific.3 = OID: SNMPv2-SMI::zeroDotZero
> IF-MIB::ifSpecific.4 = OID: SNMPv2-SMI::zeroDotZero
> IF-MIB::ifSpecific.5 = OID: SNMPv2-SMI::zeroDotZero
> IF-MIB::ifSpecific.6 = OID: SNMPv2-SMI::zeroDotZero
> 
> OK?

I see nothing that would not allow the first to digits of an OID be 0.
OK claudio@
 
> martijn@
> 
> Index: ber.c
> ===================================================================
> RCS file: /cvs/src/lib/libutil/ber.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 ber.c
> --- ber.c     1 Jun 2019 19:40:05 -0000       1.9
> +++ ber.c     31 Jul 2019 19:33:27 -0000
> @@ -546,9 +546,6 @@ ber_get_oid(struct ber_element *elm, str
>       buf = elm->be_val;
>       len = elm->be_len;
>  
> -     if (!buf[i])
> -             return (-1);
> -
>       memset(o, 0, sizeof(*o));
>       o->bo_id[j++] = buf[i] / 40;
>       o->bo_id[j++] = buf[i++] % 40;
> 

-- 
:wq Claudio

Reply via email to