• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

NSNMP/H25-Jan-2004-652303

t/H25-Jan-2004-1,170829

ChangesH A D25-Jan-20047.4 KiB220148

MANIFESTH A D25-Jan-2004128 1312

Makefile.PLH A D25-Jan-2004490 1310

NSNMP.pmH A D25-Jan-200421.3 KiB640239

READMEH A D25-Jan-20047.1 KiB149123

TODOH A D25-Jan-20045.8 KiB127119

README

1> Copyright (c) 2003-2004 AirWave Wireless, Inc.
2
3> Redistribution and use in source and binary forms, with or without
4> modification, are permitted provided that the following conditions
5> are met:
6
7>    1. Redistributions of source code must retain the above
8>    copyright notice, this list of conditions and the following
9>    disclaimer.
10>    2. Redistributions in binary form must reproduce the above
11>    copyright notice, this list of conditions and the following
12>    disclaimer in the documentation and/or other materials provided
13>    with the distribution.
14>    3. The name of the author may not be used to endorse or
15>    promote products derived from this software without specific
16>    prior written permission.
17
18> THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19> OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21> ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22> DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24> GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25> INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26> WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30SNMP is a new pure-Perl SNMP management library that's dramatically
31faster, simpler to use, and less bug-prone than Net::SNMP, the
32widely-used pure-Perl SNMP library.
33
34SNMP is also more flexible than Net::SNMP, in that you could use it to
35build an SNMP agent, SNMP packet dumper, POE component, etc., without
36rewriting major parts of the code.  None of these features are built
37in yet, except for a skeletal undocumented 87-line SNMP agent
38implementation used for the regression tests.
39
40However, Net::SNMP is much more mature and presently supports more
41features, including SNMPv3, traps, the new request types introduced in
42SNMPv2 (bulk gets and inform requests), nonblocking callback-based
43operation, OID sorting, robustness against some common bugs in SNMP
44agent implementations (specifically, sending negative values for
45unsigned numbers, and circular getNextRequest handling) and (in the
46easy-to-use SNMP::Simple interface) multiple OIDs per request.
47
48I plan to add all of these features, but the existing featureset
49actually covers the majority of management-station uses of SNMP I've
50seen.  SNMPv2 is more efficient than SNMPv1, but not as widely
51supported, and SNMPv2 support is often buggy.  Management stations, by
52definition, don't send SNMP traps or inform-requests.  SNMPv3 still
53isn't widely deployed, despite the absurd security problems SNMPv1
54creates.  Nonblocking operation is important for some high-performance
55applications, but harder to use.  OID sorting is primarily useful when
56you're implementing an agent; both this package and Net::SNMP give you
57back OIDs from walks in sorted order.
58
59That said, this package is about 20% of the size of Net::SNMP,
60counting non-duplicate lines of B::Deparse'd code in SNMP.pm,
61SNMP/Simple.pm, and SNMP/Mapper.pm.
62
63On the other hand, the regression tests for Net::SNMP are just over
64100 lines (using the same metric), while the regression tests for this
65module are about 550.
66Why would you want to use this module instead of its much-more-mature
67sibling, Net::SNMP?
68
69Well, usually, you wouldn't.  I anticipate that this module will get
70better in time, but right now, you probably don't want to use it,
71unless Net::SNMP just doesn't work for you.
72
73Some of the reasons Net::SNMP doesn't work for me follow:
74
75- it's slow.  On my 500MHz laptop, Net::SNMP can do about 110 simple
76  request/response pairs per CPU second.  These SNMP modules can do
77  about 1100, about as many as ucd-snmp snmpd can respond to.  (The
78  SNMP agent in SNMP::Agent is a little faster.)
79
80- it's inconvenient to use for simple cases.
81
82- its interface is bug-prone in a few ways.
83
84  - By default, it does all sorts of translations to make things
85    human-readable, but the translations are sometimes pretty
86    heuristic.  This can result in bugs in your code.  (For example,
87    it renders OCTET_STRINGs in hexadecimal if they contain any
88    unprintable characters.  This (in combination, obviously, with our
89    carelessness) resulted in our software failing to handle MAC
90    addresses correctly if they happened to contain no unprintable
91    characters.
92
93  - You can't do SNMP operations in blocking mode when nonblocking
94    SNMP sessions exist --- that is to say, Perl hasn't destructed
95    them yet.  This occasionally catches performance bugs, but it's
96    silly when you're trying to send an SNMP trap, which doesn't block
97    in any case, or when your nonblocking SNMP sessions have merely
98    not yet gone out of scope.
99
100  - Its SNMP walk interface gives you the results of the walk in a
101    hash, so their order is scrobbled.  There's another method to get
102    the order of the OIDs, though.
103
104  - With SNMPv2, it often returns error indicators in-band, as the
105    values of OIDs.
106
107- it's completely unhelpful for dissecting captured SNMP packets (say,
108  for debugging) because demultiplexing and decoding logic are closely
109  intertwined, apparently for efficiency.
110
111- it's not suitable for writing SNMP agents, because it discards the
112  types before it hands the data back to you.  It also doesn't
113  document a way to receive requests and send responses.  (It exists,
114  of course.)
115
116- it's not suitable for making test stubs for systems that speak SNMP,
117  because it does too much on your behalf.  For example, you might
118  want to verify that your management station handles negative
119  TIMETICKS values in a sane way, but Net::SNMP won't let you send
120  negative TIMETICKS values.  (Net::SNMP does, by default.)
121
122- it has a nonblocking mode, but it insists on using its own event
123  loop, which means you can't integrate it into, say, a POE program.
124
125- it's huge and complicated, and therefore hard to maintain and hard
126  to find bugs in.  Net::SNMP 4.1.2's .pm files total 9690 lines,
127  including 4456 distinct lines.  These SNMP modules total 712 lines
128  at the moment, including 466 distinct lines.  If you use Deparse,
129  Net::SNMP is about 2000 lines, while these SNMP modules are about
130  400.  We had a couple of serious bugs in critical parts of our
131  system that turned out to come from bugs in Net::SNMP, but we only
132  know that because they disappeared when we upgraded to a new version
133  of Net::SNMP that fixed the bugs.  I also find the Net::SNMP code
134  hard to read and understand, which may be just a dialect issue; you
135  be the judge.  Here's the routine that convinced me I needed to
136  rewrite Net::SNMP instead of trying to hack on it:
137
138	sub debug
139	{
140	   (@_ == 2) ? $DEBUG = ($_[1]) ? TRUE : FALSE : $DEBUG;
141	}
142
143  That routine exists, in exactly the same form, in
144  Net::SNMP::Security::USM, Net::SNMP::Security::Community,
145  Net::SNMP::MessageProcessing, Net::SNMP::Message,
146  Net::SNMP::Dispatcher, Net::SNMP::Transport::UDP, Net::SNMP::PDU,
147  and Net::SNMP::Security.  It is by no means the only code duplicated
148  verbatim between these modules.
149