VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/lwip/doc/snmp_agent.txt@ 17797

Last change on this file since 17797 was 17797, checked in by vboxsync, 16 years ago

OSE: export INIP feature for use with iSCSI

  • Property svn:eol-style set to native
File size: 5.7 KB
Line 
1SNMPv1 agent for lwIP
2
3Author: Christiaan Simons
4
5This is a brief introduction how to use and configure the SNMP agent.
6Note the agent uses the raw-API UDP interface so you may also want to
7read rawapi.txt to gain a better understanding of the SNMP message handling.
8
90 Agent Capabilities
10====================
11
12SNMPv1 per RFC1157
13 This is an old(er) standard but is still widely supported.
14 For SNMPv2c and v3 have a greater complexity and need many
15 more lines of code. IMHO this breaks the idea of "lightweight IP".
16
17 Note the S in SNMP stands for "Simple". Note that "Simple" is
18 relative. SNMP is simple compared to the complex ISO network
19 management protocols CMIP (Common Management Information Protocol)
20 and CMOT (CMip Over Tcp).
21
22MIB II per RFC1213
23 The standard lwIP stack management information base.
24 This is a required MIB, so this is always enabled.
25 When builing lwIP without TCP, the mib-2.tcp group is omitted.
26 The groups EGP, CMOT and transmission are disabled by default.
27
28 Most mib-2 objects are not writable except:
29 sysName, sysLocation, sysContact, snmpEnableAuthenTraps.
30 Writing to or changing the ARP and IP address and route
31 tables is not possible.
32
33 Note lwIP has a very limited notion of IP routing. It currently
34 doen't have a route table and doesn't have a notion of the U,G,H flags.
35 Instead lwIP uses the interface list with only one default interface
36 acting as a single gateway interface (G) for the default route.
37
38 The agent returns a "virtual table" with the default route 0.0.0.0
39 for the default interface and network routes (no H) for each
40 network interface in the netif_list.
41 All routes are considered to be up (U).
42
43Loading additional MIBs
44 MIBs can only be added in compile-time, not in run-time.
45 There is no MIB compiler thus additional MIBs must be hand coded.
46
47Large SNMP message support
48 The packet decoding and encoding routines are designed
49 to use pbuf-chains. Larger payloads then the minimum
50 SNMP requirement of 484 octets are supported if the
51 PBUF_POOL_SIZE and IP_REASS_BUFSIZE are set to match your
52 local requirement.
53
541 Building the Agent
55====================
56
57First of all you'll need to add the following define
58to your local lwipopts.h:
59
60#define LWIP_SNMP 1
61
62and add the source files in lwip/src/core/snmp
63and some snmp headers in lwip/src/include/lwip to your makefile.
64
65Note you'll might need to adapt you network driver to update
66the mib2 variables for your interface.
67
682 Running the Agent
69===================
70
71The following function calls must be made in your program to
72actually get the SNMP agent running.
73
74Before starting the agent you should supply pointers
75to non-volatile memory for sysContact, sysLocation,
76and snmpEnableAuthenTraps. You can do this by calling
77
78snmp_set_syscontact()
79snmp_set_syslocation()
80snmp_set_snmpenableauthentraps()
81
82Additionally you may want to set
83
84snmp_set_sysdescr()
85snmp_set_sysobjid() (if you have a private MIB)
86snmp_set_sysname()
87
88Also before starting the agent you need to setup
89one or more trap destinations using these calls:
90
91snmp_trap_dst_enable();
92snmp_trap_dst_ip_set();
93
94In the lwIP initialisation sequence call snmp_init() just after
95the call to udp_init().
96
97Exactly every 10 msec the SNMP uptime timestamp must be updated with
98snmp_inc_sysuptime(). You should call this from a timer interrupt
99or a timer signal handler depending on your runtime environment.
100
101
1023 Private MIBs
103==============
104
105If want to extend the agent with your own private MIB you'll need to
106add the following define to your local lwipopts.h:
107
108#define SNMP_PRIVATE_MIB 1
109
110You must provide the private_mib.h and associated files yourself.
111Note we don't have a "MIB compiler" that generates C source from a MIB,
112so you're required to do some serious coding if you enable this!
113
114Note the lwIP enterprise ID (26381) is assigned to the lwIP project,
115ALL OBJECT IDENTIFIERS LIVING UNDER THIS ID ARE ASSIGNED BY THE lwIP
116MAINTAINERS!
117
118If you need to create your own private MIB you'll need
119to apply for your own enterprise ID with IANA: http://www.iana.org/numbers.html
120
121You can set it by passing a struct snmp_obj_id to the agent
122using snmp_set_sysobjid(&my_object_id), just before snmp_init().
123
124Note the object identifiers for thes MIB-2 and your private MIB
125tree must be kept in sorted ascending (lexicographical) order.
126This to ensure correct getnext operation.
127
128An example for a private MIB is part of the "minimal Unix" project:
129contrib/ports/unix/proj/minimal/lwip_prvmib.c
130
131The next chapter gives a more detailed description of the
132MIB-2 tree and the optional private MIB.
133
1344 The Gory Details
135==================
136
1374.0 Object identifiers and the MIB tree.
138
139We have three distinct parts for all object identifiers:
140
141The prefix
142 .iso.org.dod.internet
143
144the middle part
145 .mgmt.mib-2.ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
146
147and the index part
148 .1.192.168.0.1
149
150Objects located above the .internet hierarchy aren't supported.
151Currently only the .mgmt sub-tree is available and
152when the SNMP_PRIVATE_MIB is enabled the .private tree
153becomes available too.
154
155Object identifiers from incoming requests are checked
156for a matching prefix, middle part and index part
157or are expanded(*) for GetNext requests with short
158or inexisting names in the request.
159(* we call this "expansion" but this also
160resembles the "auto-completion" operation)
161
162The middle part is usually located in ROM (const)
163to preserve precious RAM on small microcontrollers.
164However RAM location is possible for an dynamically
165changing private tree.
166
167The index part is handled by functions which in
168turn use dynamically allocated index trees from RAM.
169These trees are updated by e.g. the etharp code
170when new entries are made or removed form the ARP cache.
171
172/** @todo more gory details */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette