* [ECOS] Bug in snmp2c in current build tree
@ 2001-07-30 17:21 Ron Kundla
2001-07-31 8:02 ` Hugo Tyson
0 siblings, 1 reply; 2+ messages in thread
From: Ron Kundla @ 2001-07-30 17:21 UTC (permalink / raw)
To: eCos Mailing List (E-mail)
I am not sure how many people have been messing with the MIB compiler
included in the latest build tree but I have been having some problems using
mib2c to compile the RFC-3083 (DOCSIS Baseline Privacy MIB).
My system setup is the same as described in the eCos SNMP documentation,
using Perl 5.005_03 and the SNMP-3.1.0 Perl package. I am running on a
Windows 2000 box using Cygwin 1.3.2.
The compiler would run on the MIB and generate output. What I noticed was
that the header file only contained one definition of for a table when there
are seven of them defined in the MIB.
Now, if you haven't looked at mib2c, it is pretty darn confusing! After some
tinkering, I found a line of code that didn't quite jive with my test debug
print statements. So I made the following change:
Old Code:
#============================================
#
# Table-handling routines.
#
#============================================
foreach $vtable (@table_list) {
foreach $ptable (@processtable) {
$variables{$ptable}{'processed'} =
(eval "\"$variables{$ptable}{'code'}\"") . "\n\n";
}
$var_routines .=
(eval "\"$variables{'code-var_table'}{'code'}\"") . "\n\n";
}
New Code:
#============================================
#
# Table-handling routines.
#
#============================================
foreach $vtable (@table_list) {
foreach $ptable (@processtable) {
$variables{$ptable}{'processed'} .= <--- *** NEW CHANGE ***
(eval "\"$variables{$ptable}{'code'}\"") . "\n"; <--- here too,
cosmetic
}
$var_routines .=
(eval "\"$variables{'code-var_table'}{'code'}\"") . "\n\n";
}
and voila! My header file had the proper tables entries and the
corresponding c file also had the proper functions to access the tables.
Has anyone else reported this as a problem? In discussing this with a
co-worker, we made the observation that the DOCSIS MIBs could be compliant,
but the fact that in mib2c they concatenate the one variable but not the
other proved the reason why I was only seeing the *last* table in the header
file.
Ron
==============================================
Ron Kundla nBand Communications, Inc.
Systems Engineer Mountain View, CA 94041
rkundla@nband.com Main: 650.716.0700
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] Bug in snmp2c in current build tree
2001-07-30 17:21 [ECOS] Bug in snmp2c in current build tree Ron Kundla
@ 2001-07-31 8:02 ` Hugo Tyson
0 siblings, 0 replies; 2+ messages in thread
From: Hugo Tyson @ 2001-07-31 8:02 UTC (permalink / raw)
To: Ron Kundla; +Cc: eCos Mailing List (E-mail)
Ron Kundla <rkundla@nband.com> writes:
> The compiler would run on the MIB and generate output. What I noticed was
> that the header file only contained one definition of for a table when
> there are seven of them defined in the MIB.
I noticed that same issue when initially getting the SNMP package
introduced to eCos' network stack, but time pressure and...
> Now, if you haven't looked at mib2c, it is pretty darn confusing!
...is why I just lived with it and fixed up the header by hand; IIRC
only having to tinker with a couple of files.
> some tinkering, I found a line of code that didn't quite jive with my
> test debug print statements. So I made the following change:
> <snip>
> and voila! My header file had the proper tables entries and the
> corresponding c file also had the proper functions to access the tables.
That's excellent, so I have committed the change (below) to our source
repository - your name in lights! ;-)
> Has anyone else reported this as a problem? In discussing this with a
> co-worker, we made the observation that the DOCSIS MIBs could be compliant,
> but the fact that in mib2c they concatenate the one variable but not the
> other proved the reason why I was only seeing the *last* table in the header
> file.
Yes, I agree with that analysis. I'll copy the guys at UCD with this to
let them adopt the change, if they haven't got it already.
Thanks again,
- Huge
Index: net/snmp/agent/current/ChangeLog
===================================================================
RCS file: /home/cvs/ecc/ecc/net/snmp/agent/current/ChangeLog,v
retrieving revision 1.30
diff -u -5 -p -r1.30 ChangeLog
--- net/snmp/agent/current/ChangeLog 2001/06/07 12:21:28 1.30
+++ net/snmp/agent/current/ChangeLog 2001/07/31 14:54:07
@@ -1,5 +1,13 @@
+2001-07-31 Hugo Tyson <hmt@redhat.com>
+2001-07-31 Ron Kundla <rkundla@nband.com>
+
+ * utils/mib2c/mib2c (Table-handling): Concatenate rather than
+ replace subsequent processed variables. The symptom was that in
+ the generated header file you only get the last table in the MIB.
+ This fixes it. Thanks Ron!
+
2001-06-07 Jesper Skov <jskov@redhat.com>
* src/mibgroup/mibII/ip.c (var_ipNetToMediaTable): Only handle
IPNETTOMEDIAPHYSADDRESS for devices with associated hardware.
Index: net/snmp/agent/current/utils/mib2c/mib2c
===================================================================
RCS file: /home/cvs/ecc/ecc/net/snmp/agent/current/utils/mib2c/mib2c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 mib2c
--- net/snmp/agent/current/utils/mib2c/mib2c 2000/06/02 13:05:26 1.1
+++ net/snmp/agent/current/utils/mib2c/mib2c 2001/07/31 14:54:07
@@ -130,11 +130,11 @@ $varlen = $varLengths[$varlen];
# Table-handling routines.
#
#============================================
foreach $vtable (@table_list) {
foreach $ptable (@processtable) {
- $variables{$ptable}{'processed'} =
+ $variables{$ptable}{'processed'} .=
(eval "\"$variables{$ptable}{'code'}\"") . "\n\n";
}
$var_routines .=
(eval "\"$variables{'code-var_table'}{'code'}\"") . "\n\n";
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-31 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-30 17:21 [ECOS] Bug in snmp2c in current build tree Ron Kundla
2001-07-31 8:02 ` Hugo Tyson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).