Re: [tkined] scotty and BITS syntax

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Tue, 9 Dec 1997 20:00:49 +0100

Mark Ellison <ellison@world.std.com> said:

Mark> I believe a varBind with a syntax of BITS is supposed to be
Mark> encoded as an OCTET STRING(4) on the wire, per sxn 8.3 of RFC
Mark> 1906. What I'm seeing with scotty is a syntax of NULL(5), and
Mark> a value length of 0.

Here is a more complete response and a surprisingly simple patch.

Mark> Here's an example using snmp session, snmp0, created with
Mark> -version SNMPv2c:

Mark> snmp0 set { {1.3.6.1.4.1.36.2.15.2.98.14.0 BITS 07:ff:80 } } { }

This is the critical part. There is no BITS type in SNMPv2 - just a
hack in the SMIv2 spec so that MIB developers can use something which
smells like BITS. To send a BITS value, you have to send the OCTET
STRING value. This means you really want to do:

snmp0 set { {1.3.6.1.4.1.36.2.15.2.98.14.0 {OCTET STRING} 07:ff:80 } } { }

Now, the problem is that scotty did not complain about the BITS
type. I checked the code and found out that you could use any string
as a type and scotty would not complain. The patch below fixes this.

Now, the open question is whether scotty should provide some syntactic
sugar for MIB objects which are defined to be BITS. I think this would
be a valuable addition for the future.
Juergen

*** tnmSnmpSend.c.orig Wed Sep 18 09:34:14 1996
--- tnmSnmpSend.c Tue Dec 9 19:49:03 1997
***************
*** 797,806 ****
} else {
asn1_type = TnmGetTableKey(tnmSnmpTypeTable, vbv[1]);
if (asn1_type < 0) {
! asn1_type = ASN1_NULL;
}
}
break;
}

/*
--- 797,813 ----
} else {
asn1_type = TnmGetTableKey(tnmSnmpTypeTable, vbv[1]);
if (asn1_type < 0) {
! asn1_type = ASN1_OTHER;
}
}
break;
+ }
+
+ if (asn1_type == ASN1_OTHER) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "unknown type \"", vbv[1], "\"",
+ (char *) NULL);
+ return NULL;
}

/*

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.