Ethereal-dev: Re: [ethereal-dev] packet-snmp.c and libsmi

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Juergen Schoenwaelder <schoenw@xxxxxxxxxxxxxxx>
Date: Wed, 28 Jun 2000 15:10:38 +0200
>>>>> Guy Harris writes:

Guy> ...and this one is even better (again, a patch to the stuff in
Guy> the CVS tree; update your CVS tree first), as it gets rid of a
Guy> string-size #define that is no longer used.

You can optimze memory usage be doing the following libsmi
initialization:

#ifdef HAVE_SMI_H
        int flags;
        
        smiInit("ethereal");
        flags = smiGetFlags();
        flags |= SMI_FLAG_NODESCR;
        smiSetFlags(flags);
#endif

Setting the SMI_FLAG_NODESCR tells the parser to throw away all
description clauses which are otherwise kept in memory. This saves
about 2 MB if you load all IETF MIB modules.

Looking further at the patch, I think it is necessary to first get
agreement what the desirable out is. I think there are two different
things one can display:

(a) The plain data as it is contained in the SNMP packet.

(b) The semantically more meaningful data according to the MIB
    definition.

An example to make things clearer:

(a)

1.3.6.1.2.1.2.2.1.7.1 = [INTEGER] 1
1.3.6.1.2.1.25.3.8.1.8.769 = [OCTET STRING] 00:00:01:01:00:00:00:00
1.3.6.1.2.1.25.5.1.1.2.222 = [INTEGER] 44

(b)

IF-MIB::ifAdminStatus.1 = [Enumeration] up(1)
HOST-RESOURCES-MIB::hrFSLastFullBackupDate.769 = [DateAndTime] 0-1-1,0:0:0.0
HOST-RESOURCES-MIB::hrSWRunPerfMem.222 = [Integer32] 44 KBytes

I think it is important to distinguish these two formats, especially
since there can be error when mapping (a) to (b) if for instance the
payload in the packet does not match the MIB definition. In my tcpdump
patch, I am actually trying to detect these problems.

There is also an issue how you display instance identifiers,
especially if you have complex ones. Furthermore, there is an issue of
compactness and readability and preciseness (e.g. it is not always
necessary to have the type or module information available).

Before continuing on this patch, I think it is important to reach
agreement what display we like and whether we want (a), (b) or perhaps
both.

/js

-- 
Juergen Schoenwaelder      Technical University Braunschweig
<schoenw@xxxxxxxxxxxxxxx>  Dept. Operating Systems & Computer Networks
Phone: +49 531 391 3289    Bueltenweg 74/75, 38106 Braunschweig, Germany
Fax:   +49 531 391 5936    <URL:http://www.ibr.cs.tu-bs.de/~schoenw/>