1 |
786 |
skrzyp |
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
SNMP
|
32 |
|
|
|
33 |
|
|
SNMP for eCos
|
34 |
|
|
|
35 |
|
|
Version
|
36 |
|
|
|
37 |
|
|
This is a port of UCD-SNMP-4.1.2
|
38 |
|
|
|
39 |
|
|
Originally this document said: See
|
40 |
|
|
http://ucd-snmp.ucdavis.edu/
|
41 |
|
|
for details. And send them a postcard.
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
The project has since been renamed “net-snmp” and re-homed at
|
45 |
|
|
|
46 |
|
|
http://net-snmp.sourceforge.net/
|
47 |
|
|
where various new releases (of the original, not eCos
|
48 |
|
|
ports) are available.
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
The original source base from which we worked to create the
|
52 |
|
|
eCos port is available from various archive sites such
|
53 |
|
|
as
|
54 |
|
|
|
55 |
|
|
ftp://ftp.freesnmp.com/mirrors/net-snmp/
|
56 |
|
|
or
|
57 |
|
|
|
58 |
|
|
ftp://sunsite.cnlab-switch.ch/mirror/ucd-snmp/
|
59 |
|
|
generally with this filename and details:
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
ucd-snmp-4.1.2.tar.gz. . . . . . Nov 2 2000 1164k
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
SNMP packages in the eCos source repository
|
68 |
|
|
|
69 |
|
|
The SNMP/eCos package consists of two eCos packages;
|
70 |
|
|
the SNMP library and the SNMP agent.
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
The sources are arranged this way partly for consistency with
|
74 |
|
|
the original release from UCD, and so as to accommodate possible
|
75 |
|
|
future use of the SNMP library without having an agent present.
|
76 |
|
|
That could be used to build an eCos-based SNMP client application.
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
The library contains support code for talking SNMP over the
|
80 |
|
|
net - the SNMP protocol itself - and a MIB file parser (ASN-1) which
|
81 |
|
|
is not used in the agent case.
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
The agent contains the application specific handler files
|
85 |
|
|
to get information about the system into the SNMP world, together
|
86 |
|
|
with the SNMP agent thread
|
87 |
|
|
(snmpd in UNIX terms).
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
MIBs supported
|
92 |
|
|
|
93 |
|
|
The standard set in MIB-II, together with the Ether-Like MIB, are supported
|
94 |
|
|
by default. The MIB files used to compile the handlers in the agent and to
|
95 |
|
|
“drive” the testing (snmpwalk et
|
96 |
|
|
al under LINUX)
|
97 |
|
|
are those acquired from that same UCD distribution.
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
These are the supported MIBs; all are below mib2 == 1.3.6.1.2.1:
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
system { mib2 1 }
|
104 |
|
|
interfaces { mib2 2 }
|
105 |
|
|
[ address-translation “at” { mib2 3 } is deprecated ]
|
106 |
|
|
ip { mib2 4 }
|
107 |
|
|
icmp { mib2 5 }
|
108 |
|
|
tcp { mib2 6 }
|
109 |
|
|
udp { mib2 7 }
|
110 |
|
|
[ exterior gateway protocol “egp” { mib2 8 } not supported ]
|
111 |
|
|
[ cmot { mib2 9 } is “historic”, just a placeholder ]
|
112 |
|
|
dot3 { mib2 10 7 } == { transmission 7 } “EtherLike MIB”
|
113 |
|
|
snmp { mib2 11 }
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
On inclusion of SNMPv3 support packages, the following MIBs are added to the
|
117 |
|
|
default set of MIBs enumerated above :
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
snmpEngine { snmpFrameworkMIBObjects 1 } SNMP-FRAMEWORK-MIB, as described in
|
121 |
|
|
RFC-2571 for support of SNMPv3
|
122 |
|
|
framework.
|
123 |
|
|
|
124 |
|
|
usmStats { usmMIBObjects 1 } SNMP-USER-BASED-SM-MIB, as
|
125 |
|
|
usmUser { usmMIBObjects 2 } specified in RFC-2574 for support
|
126 |
|
|
of user based security model in
|
127 |
|
|
SNMPv3 management domains.
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
Changes to eCos sources
|
132 |
|
|
|
133 |
|
|
Small changes have been made in three areas:
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
Various hardware-specific ethernet drivers.
|
137 |
|
|
The generic ethernet device driver.
|
138 |
|
|
The OpenBSD TCP/IP networking package.
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
These changes were made in order to export information about the driver and
|
142 |
|
|
the network that the SNMP agent must report. The changes were trivial in
|
143 |
|
|
the case of the network stack, since it was already SNMP-friendly. The
|
144 |
|
|
generic ethernet device driver was re-organized to have an extensive header
|
145 |
|
|
file and to add a couple of APIs to extract statistics that the
|
146 |
|
|
hardware-specific device drivers keep within themselves.
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
There may be a performance hit for recording that data; disabling
|
150 |
|
|
a config option named something like
|
151 |
|
|
CYGDBG_DEVS_ETH_xxxx_xxxx_KEEP_STATISTICS
|
152 |
|
|
depending on the specific device driver will prevent that.
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
Not all platform ethernet device drivers export complete SNMP statistical
|
156 |
|
|
information; if the exported information is missing, SNMP will report zero
|
157 |
|
|
values for such data (in the dot3 MIB).
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
The interface chipset has an ID which is an OID; not all the latest greatest
|
161 |
|
|
devices are listed in the abailable database, so new chipsets may need to
|
162 |
|
|
be added to the client MIB, if not defined in those from UCD.
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
Starting the SNMP Agent
|
167 |
|
|
|
168 |
|
|
A routine to instantiate and start the SNMP agent thread in the default
|
169 |
|
|
configuration is provided in
|
170 |
|
|
PACKAGES/net/snmp/agent/VERSION/src/snmptask.c
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
It starts the snmpd thread at priority
|
174 |
|
|
CYGPKG_NET_THREAD_PRIORITY+1
|
175 |
|
|
by default, ie. one step less important than the TCP/IP stack service
|
176 |
|
|
thread.
|
177 |
|
|
It also statically creates and uses a very large stack of around 100
|
178 |
|
|
KiloBytes.
|
179 |
|
|
To use that convenience function, this code fragment may be copied (in
|
180 |
|
|
plain C).
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
#ifdef CYGPKG_SNMPAGENT
|
184 |
|
|
{
|
185 |
|
|
extern void cyg_net_snmp_init(void);
|
186 |
|
|
cyg_net_snmp_init();
|
187 |
|
|
|
188 |
|
|
}
|
189 |
|
|
#endif
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
In case you need to perform initialization, for example setting up SNMPv3
|
193 |
|
|
security features, when the snmp agent starts and every time it restarts,
|
194 |
|
|
you can register a callback function by simply writing the global variable:
|
195 |
|
|
|
196 |
|
|
externC void (*snmpd_reinit_function)( void );
|
197 |
|
|
|
198 |
|
|
with a suitable function pointer.
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
The entry point to the SNMP agent is
|
202 |
|
|
|
203 |
|
|
externC void snmpd( void (*initfunc)( void ) );
|
204 |
|
|
|
205 |
|
|
so you can of course easily start it in a thread of your choice at another
|
206 |
|
|
priority instead if required, after performing whatever other
|
207 |
|
|
initialization your SNMP MIBs need. A larger than default stacksize is
|
208 |
|
|
required. The initfunc parameter is the callback
|
209 |
|
|
function mentioned above — a NULL parameter there is safe and
|
210 |
|
|
obviously means no callback is registered.
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
Note that if you call snmpd(); yourself and do
|
214 |
|
|
not call cyg_net_snmp_init(); then
|
215 |
|
|
that routine, global variable, and the default large stack will not be
|
216 |
|
|
used. This is the recommended way control such features from your
|
217 |
|
|
application; create and start the thread yourself at the appropriate
|
218 |
|
|
moment.
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
Other APIs from the snmpd module are available,
|
222 |
|
|
specifically:
|
223 |
|
|
|
224 |
|
|
void SnmpdShutDown(int a);
|
225 |
|
|
|
226 |
|
|
which causes the snmpd to restart itself —
|
227 |
|
|
including the callback to your init function — as soon as possible.
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
The parameter a is ignored. It is there because in
|
231 |
|
|
snmpd's “natural environment” this routine
|
232 |
|
|
is a UNIX signal handler.
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
The helper functions in the network stack for managing
|
236 |
|
|
DHCP
|
237 |
|
|
leases will call SnmpdShutDown()
|
238 |
|
|
when necessary, for example if network interfaces go down and/or come up
|
239 |
|
|
again.
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
Configuring eCos
|
244 |
|
|
|
245 |
|
|
To use the SNMP agent, the SNMP library and agent packages must be
|
246 |
|
|
included in your configuration. To incorporate the stack into your
|
247 |
|
|
configuration select the SNMP library and SNMP agent packages in the
|
248 |
|
|
eCos Configuration Tool, or at the command line type:
|
249 |
|
|
|
250 |
|
|
$ ecosconfig add snmplib snmpagent
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
After adding the networking, common ethernet device drivers,
|
255 |
|
|
snmp library and snmp agent packages, there is no configuration
|
256 |
|
|
required. However there are a number of configuration options
|
257 |
|
|
that can be set such as some details for the System MIB, and
|
258 |
|
|
disabling SNMPv3 support (see below).
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
Starting the SNMP agent is not integrated into network
|
262 |
|
|
tests other than snmpping below, nor is it
|
263 |
|
|
started automatically in normal eCos startup -
|
264 |
|
|
it is up to the application to start the agent when it is ready,
|
265 |
|
|
at least after the network interfaces are both ‘up’.
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
Version usage (v1, v2 or v3)
|
269 |
|
|
|
270 |
|
|
The default build supports all three versions of the SNMP protocol, but without
|
271 |
|
|
any dispatcher functionality (rfc 2571, section 3.1.1.2). This has the
|
272 |
|
|
following implications :
|
273 |
|
|
|
274 |
|
|
1. There is no community authentication for v1 and v2c.
|
275 |
|
|
2. Security provided by v3 can be bypassed by using v1/v2c protocol.
|
276 |
|
|
|
277 |
|
|
To provide the dispatcher with rfc 2571 type functionality, it is required to
|
278 |
|
|
set up security models and access profiles. This can be provided in the normal
|
279 |
|
|
Unix style by writing the required configurations in snmpd.conf
|
280 |
|
|
file. Application code may setup profiles in snmpd.conf and
|
281 |
|
|
optionally set the environment variable SNMPCONFPATH to
|
282 |
|
|
point to the file if it is not in the usual location. The whole concept works
|
283 |
|
|
in the usual way as with the standard UCD-SNMP distribution.
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
Traps
|
288 |
|
|
|
289 |
|
|
The support of the trapsink command in the
|
290 |
|
|
snmpd.conf file is not tested
|
291 |
|
|
and there may be problems for it working as expected. Moreover, in systems that do not
|
292 |
|
|
have filesystem support, there is no way to configure a trap-session in the
|
293 |
|
|
conventional way.
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
For reasons mentioned above, applications need to initialize their own trap
|
297 |
|
|
sessions and pass it the details of trap-sink. The following is a small sample
|
298 |
|
|
for initializing a v1 trap session :
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
typedef struct trap {
|
302 |
|
|
unsigned char ip [4];
|
303 |
|
|
unsigned int port;
|
304 |
|
|
unsigned char community [256];
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
trap trapsink;
|
308 |
|
|
unsinged char sink [16];
|
309 |
|
|
|
310 |
|
|
...
|
311 |
|
|
...
|
312 |
|
|
|
313 |
|
|
if (trapsink.ip != 0) {
|
314 |
|
|
sprintf (sink, "%d.%d.%d.%d",
|
315 |
|
|
trapsink[0], trapsink[1], trapsink[2], trapsink[3]);
|
316 |
|
|
if (create_trap_session (sink,
|
317 |
|
|
trapsink.port,
|
318 |
|
|
(char *)trapsink.community,
|
319 |
|
|
SNMP_VERSION_1,
|
320 |
|
|
SNMP_MSG_TRAP) == 0) {
|
321 |
|
|
log_error ("Creation of trap session failed \n");
|
322 |
|
|
}
|
323 |
|
|
}
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
snmpd.conf file
|
328 |
|
|
|
329 |
|
|
Using snmpd.conf requires the inclusion of one of the file-system packages
|
330 |
|
|
(eg. CYGPKG_RAMFS) and CYGPKG_FILEIO. With these two packages included, the
|
331 |
|
|
SNMP sub-system will read the snmpd.conf file from the location specified in
|
332 |
|
|
SNMPCONFPATH, or the standard builtin locations, and use
|
333 |
|
|
these profiles. Only the profiles specified in the ACCESS-CONTROL
|
334 |
|
|
section of snmpd.conf file have
|
335 |
|
|
been tested and shown to work. Other profiles which have been implemented in
|
336 |
|
|
UCD-SNMP-4.1.2's snmpd.conf may not work
|
337 |
|
|
because the sole purpose of adding support for the snmpd.conf file has been to
|
338 |
|
|
set up ACCESS-CONTROL models.
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
At startup, the SNMP module tries to look for file snmp.conf.
|
342 |
|
|
If this file is not available, the module successively looks for files
|
343 |
|
|
snmpd.conf, snmp.local.conf and
|
344 |
|
|
snmpd.local.conf at the locations pointed to by
|
345 |
|
|
SNMPCONFPATH environment variable. In case SNMPCONFPATH
|
346 |
|
|
is not defined, the search sequence is carried out in default directories.
|
347 |
|
|
The default directories are :/usr/share/snmp,
|
348 |
|
|
/usr/local/share/snmp and $(HOME)/.snmp.
|
349 |
|
|
The configurations read from these files are used to control both, SNMP
|
350 |
|
|
applications and the SNMP agent; in the usual UNIX fashion.
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
The inclusion of snmpd.conf support is enabled by default when suitable
|
354 |
|
|
filesystems and FILEIO packages are active.
|
355 |
|
|
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
Test cases
|
360 |
|
|
|
361 |
|
|
Currently only one test program is provided which uses SNMP.
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
"snmpping" in the SNMP agent package runs the ping test from
|
365 |
|
|
the TCPIP package, with the snmpd running also. This allows you
|
366 |
|
|
to interrogate it using host tools of your choice. It supports MIBs
|
367 |
|
|
as documented above, so eg. snmpwalk
|
368 |
|
|
<hostname> public dot3 under
|
369 |
|
|
Linux/UNIX should have the desired effect.
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
For serious testing, you should increase the length of time
|
373 |
|
|
the test runs by setting CYGNUM_SNMPAGENT_TESTS_ITERATIONS
|
374 |
|
|
to something big (e.g., 999999). Build the test
|
375 |
|
|
(make -C net/snmp/agent/current tests)
|
376 |
|
|
and run it on the target.
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
Then start several jobs, some for pinging the board (to make
|
380 |
|
|
the stats change) and some for interrogating the snmpd. Set $IP
|
381 |
|
|
to whatever IP address the board has:
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
# in a root shell, for flood ping
|
385 |
|
|
while(1)
|
386 |
|
|
date
|
387 |
|
|
ping -f -c 3001 $IP
|
388 |
|
|
sleep 5
|
389 |
|
|
ping -c 32 -s 2345 $IP
|
390 |
|
|
end
|
391 |
|
|
|
392 |
|
|
# have more than one of these going at once
|
393 |
|
|
setenv MIBS all
|
394 |
|
|
while (1)
|
395 |
|
|
snmpwalk -OS $IP public
|
396 |
|
|
date
|
397 |
|
|
end
|
398 |
|
|
|
399 |
|
|
Leave to run for a couple of days or so to test stability.
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
The test program can also test snmpd.conf support. It tries to build a minimal
|
403 |
|
|
snmpd.conf file on a RAM filesystem and passes it to the snmp sub-system. With
|
404 |
|
|
this profile on target, the following snmp[cmd] (cmd=walk, get, set) should
|
405 |
|
|
work :
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
snmp[cmd] -v1 $IP crux $OID
|
409 |
|
|
snmp[cmd] -v2 $IP crux $OID
|
410 |
|
|
snmp[cmd] -v3 $IP -u root -L noAuthNoPriv $OID
|
411 |
|
|
snmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a md5passwd $OID
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
The following commands would however fail since they violate the access model :
|
415 |
|
|
|
416 |
|
|
|
417 |
|
|
snmp[cmd] $IP public $OID
|
418 |
|
|
snmp[cmd] -v1 $IP public $OID
|
419 |
|
|
snmp[cmd] -v2c $IP public $OID
|
420 |
|
|
snmp[cmd] -v3 $IP -u no_user -L noAuthNoPriv $OID
|
421 |
|
|
snmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a badpasswd $OID
|
422 |
|
|
|
423 |
|
|
|
424 |
|
|
|
425 |
|
|
SNMP clients and package use
|
426 |
|
|
|
427 |
|
|
SNMP clients may use these packages, but this usage is currently
|
428 |
|
|
untested: the reason why this port to eCos exists is to acquire
|
429 |
|
|
the SNMP agent. The fact that that the SNMP API (for clients) exists
|
430 |
|
|
is a side-effect. See the standard man page SNMP_API(3)
|
431 |
|
|
for details. There are further caveats below about client-side
|
432 |
|
|
use of the SNMP library.
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
All of the SNMP header files are installed beneath .../include/ucd-snmp
|
436 |
|
|
in the install tree. The SNMP code itself assumes that directory
|
437 |
|
|
is on its include path, so we recommend that client code does the
|
438 |
|
|
same. Further, like the TCP/IP stack, compiling SNMP code
|
439 |
|
|
requires definition of _KERNEL and __ECOS,
|
440 |
|
|
and additionally IN_UCD_SNMP_SOURCE.
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
Therefore, add all of these to your compile lines if you wish
|
444 |
|
|
to include SNMP header files:
|
445 |
|
|
|
446 |
|
|
-D_KERNEL
|
447 |
|
|
-D__ECOS
|
448 |
|
|
-DIN_UCD_SNMP_SOURCE=1
|
449 |
|
|
-I$(PREFIX)/include/ucd-snmp
|
450 |
|
|
|
451 |
|
|
|
452 |
|
|
Unimplemented features
|
453 |
|
|
|
454 |
|
|
Currently, the filesystem and persistent storage areas are
|
455 |
|
|
left undone, to be implemented by the application.
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
The SNMP library package is intended to support client and
|
459 |
|
|
agent code alike. It therefore contains lots of assumptions about
|
460 |
|
|
the presence of persistent storage ie. a filesystem. Currently,
|
461 |
|
|
by default, eCos has no such thing, so those areas have been simply
|
462 |
|
|
commented out and made to return empty lists or say “no
|
463 |
|
|
data here.”
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
Specifically the following files have omitted/unimplemented code :
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
PACKAGES/net/snmp/lib/VERSION/src/parse.c
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
contains code to enumerate MIB files discovered in the system
|
473 |
|
|
MIB directories (“/usr/share/snmp/mibs”),
|
474 |
|
|
and read them all in, building data structures that are used by
|
475 |
|
|
client programs to interrogate an agent. This is not required in
|
476 |
|
|
an agent, so the routine which enumerates the directories returns
|
477 |
|
|
an empty list.
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
PACKAGES/net/snmp/lib/VERSION/src/read_config.c
|
481 |
|
|
contains two systems:
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
The first tries to read the configuration file as described in the
|
485 |
|
|
snmpd.conf file section and
|
486 |
|
|
the second system contains code to record persistent data as files in a
|
487 |
|
|
directory (typically /var/ucd-snmp) thus preserving the
|
488 |
|
|
state permanently.
|
489 |
|
|
|
490 |
|
|
|
491 |
|
|
The first part is partially implemented to support multiple profiles and enables
|
492 |
|
|
dispatcher functionality as discussed in .
|
493 |
|
|
The second part is not supported at all in the default implementation. As required,
|
494 |
|
|
a cleaner interface to permit application code to manage persistent data will be
|
495 |
|
|
developed in consultation with customers.
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
MIB Compiler
|
500 |
|
|
In the directory
|
501 |
|
|
/snmp/agent/VERSION/utils/mib2c,
|
502 |
|
|
there are the following files:
|
503 |
|
|
|
504 |
|
|
README-eCos notes about running with a nonstandard
|
505 |
|
|
perl path.
|
506 |
|
|
README.mib2c the README from UCD; full instructions on
|
507 |
|
|
using mib2c
|
508 |
|
|
mib2c the perl program
|
509 |
|
|
mib2c.conf a configuration file altered to include the
|
510 |
|
|
eCos/UCD
|
511 |
|
|
mib2c.conf-ORIG copyright and better #include paths; and
|
512 |
|
|
the ORIGinal.
|
513 |
|
|
mib2c.storage.conf other config files, not modified.
|
514 |
|
|
mib2c.vartypes.conf
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
mib2c is provided BUT it requires the SNMP perl package SNMP-3.1.0,
|
518 |
|
|
and that in turn requires perl nsPerl5.005_03 (part of
|
519 |
|
|
Red Hat Linux from 6.0, April 1999).
|
520 |
|
|
These are available from the CPAN (“the Comprehensive
|
521 |
|
|
Perl Archive Network”) as usual;
|
522 |
|
|
http://www.cpan.org/
|
523 |
|
|
and links from there. Specifically:
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
PERL itself:
|
528 |
|
|
|
529 |
|
|
http://people.netscape.com/kristian/nsPerl/
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
http://people.netscape.com/richm/nsPerl/nsPerl5.005_03-11-i686-linux.tar.gz
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
SNMP.pl
|
537 |
|
|
|
538 |
|
|
http://www.cpan.org/modules/01modules.index.html
|
539 |
|
|
|
540 |
|
|
|
541 |
|
|
|
542 |
|
|
http://cpan.valueclick.com/modules/by-category/05_Networking_Devices_IPC/SNMP/
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
|
|
http://www.cpan.org/authors/id/G/GS/GSM/SNMP.tar.gz
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
(note that the .tar.gz files are not browsable)
|
550 |
|
|
|
551 |
|
|
For documentation on the files produced, see the documentation
|
552 |
|
|
available at
|
553 |
|
|
http://ucd-snmp.ucdavis.edu/
|
554 |
|
|
|
555 |
|
|
in general, and file AGENT.txt in particular.
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
It is likely that the output of mib2c will be further customized
|
559 |
|
|
depending on eCos customer needs; it’s easy to do this
|
560 |
|
|
by editing the mib2c.conf file to add or remove whatever you need
|
561 |
|
|
with the resulting C sources.
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
The UCD autoconf-style configuration does not apply to eCos.
|
565 |
|
|
So if you add a completely new MIB to the agent, and support it
|
566 |
|
|
using mib2c so that the my_new_mib.c file contains
|
567 |
|
|
a init_my_new_mib() routine to register
|
568 |
|
|
the MIB handler, you will also need to edit a couple of control
|
569 |
|
|
files; these claim to be auto-generated, but in the eCos release,
|
570 |
|
|
they’re not, don’t worry.
|
571 |
|
|
|
572 |
|
|
PACKAGES/net/snmp/agent/VERSION/include/mib_module_includes.h
|
573 |
|
|
|
574 |
|
|
contains a number of lines like
|
575 |
|
|
|
576 |
|
|
#include “mibgroup/mibII/interfaces.h”
|
577 |
|
|
|
578 |
|
|
so add your new MIB thus:
|
579 |
|
|
|
580 |
|
|
#include “mibgroup/mibII/my_new_mib.h”
|
581 |
|
|
PACKAGES/net/snmp/agent/VERSION/include/mib_module_inits.h
|
582 |
|
|
|
583 |
|
|
contains a number of lines like
|
584 |
|
|
|
585 |
|
|
init_interfaces();
|
586 |
|
|
init_dot3();
|
587 |
|
|
|
588 |
|
|
and so on; add your new MIB as follows:
|
589 |
|
|
|
590 |
|
|
init_my_new_mib();
|
591 |
|
|
|
592 |
|
|
and this should work correctly.
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
|
596 |
|
|
&net-snmp-agent-snmp-manpages-sgml
|
597 |
|
|
|
598 |
|
|
|