tcpdump mailing list archives
Re: [tcpdump] About smiInit() parameter
From: Guy Harris via tcpdump-workers <tcpdump-workers () lists tcpdump org>
Date: Mon, 30 Mar 2020 13:54:18 -0400 (EDT)
--- Begin Message --- From: Guy Harris <gharris () sonic net>
Date: Mon, 30 Mar 2020 10:55:26 -0700
On Mar 30, 2020, at 10:24 AM, Francois-Xavier Le Bail <devel.fx.lebail () orange fr> wrote: Hi Guy, We have: $ git grep -n '"tcpdump"' netdissect.c:72: smiInit("tcpdump"); netdissect.c is a part of libnetdissect. Should we use smiInit("libnetdissect"); or something else to separate the lib and the tool ?The man page at https://www.ibr.cs.tu-bs.de/projects/libsmi/smi_config.html says: int smiInit(const char *tag); ... The smiInit() function should be the first SMI function called in an application. It initializes its internal structures. If tag is not NULL, the global configuration file and (on UNIX systems) a user configuration file are read implicitly, if existent. All global statements and those statements with a tag (a ``tag: '' prefix) that matches the tag argument are executed. (see also CONFIGURATION FILES below). I don't know if anybody's actually *using* that particular libsmi feature, but smiInit has been called with "tcpdump" as an argument since at least tcpdump 0.7. For what it's worth, the configuration file example they give in the man page *does* have a "tcpdump:" statement in it: Example configuration: # # $HOME/.smirc # # add a private directory path :/usr/home/strauss/lib/mibs # don’t show any errors by default level 0 # preload some basic modules load SNMPv2-SMI load SNMPv2-TC load SNMPv2-CONF # want to make smilint shout smilint: level 8 # but please don’t claim about # any names longer than 32 chars smilint: hide namelength-32 tcpdump: load DISMAN-SCRIPT-MIB smiquery: load IF-MIB smiquery: load DISMAN-SCRIPT-MIB so there might be some who have "tcpdump:" statements in libsmi configuration files. So either 1) we should consider leaving "tcpdump" there or 2) we should make the tag an argument to nd_init and pass it "tcpdump" from tcpdump although the latter means that any new program using libnetdissect might dissect SNMP packets differently from tcpdump, whether that's a bug or a feature.
--- End Message ---
_______________________________________________ tcpdump-workers mailing list tcpdump-workers () lists tcpdump org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- Re: [tcpdump] About smiInit() parameter Guy Harris via tcpdump-workers (Mar 30)
- <Possible follow-ups>
- Fwd: Re: [tcpdump] About smiInit() parameter Francois-Xavier Le Bail via tcpdump-workers (Mar 30)