BSNMP Enhancements
Student: ShonaliBalakrishna (shonali@)
Mentor: ShteryanaShopova (syrinx@)
Project description
BSNMP is a portable SNMP framework consisting of a daemon (bsnmpd), modules and tools. Bsnmp consists of the following pieces:
- A library libbsnmp that includes ASN.1 handling, the SNMP protocol version V1 and V2C and a number of helper stuff to simplify writing of SNMP agents and clients.
- The gensnmptree tool that generates the C- and H-files from an object hierarchy description (.def file).
- The gensnmpdef tool that generates an initial .def file from a MIB. This requires the libsmi library.
- bsnmpd - the SNMP daemon.
- snmp_mibII - an implementation of the standard MIB-II sub-tree.
- snmp_ntp - a partial implementation of the experimental NTP MIB.
The bsnmpd daemon implements just the bare minimum that is needed for such a daemon: the system group, parts of the SNMP group and a private tree that does the following:
- handling of loadable modules. This allows loading/unloading parts of the tree at runtime or configuration time.
- handling of communities. A table that allows loaded modules to create new communities at run-time (ILMI is a consumer of this).
- handling trap destinations for V1.
- several configuration parameters like the protocol versions to handle, buffer sizes and so on.
- tables that manage the UDP and local unix ports the daemon is listening on.
- statistics and debugging
The BSNMPD SNMP daemon implements a minimal MIB which consists of the system group, part of the SNMP MIB, a private configuration MIB, a trap destination table, a UDP port table, a community table, a module table, a statistics group and a debugging group. All other MIBs are supported through loadable modules. This allows bsnmpd to use that which is not a classical SNMP task, for tasks. Modules are loaded by writing to the module table. This table is indexed by a string, which identifies the module to the daemon. This identifier is used to select the correct configuration section from the configuration files and to identify resources allocated to this module.
All real functionality is implemented via loadable modules. This project proposes to add full IPv6 support (e.g. able to talk to snmpd daemon over IPv6) in both bsnmpd and the bsnmp tools. This will be done as a loadable transport module to BSNMP.
Deliverables
Add full IPv6 support as a loadable transport module to BSNMP.
Milestones
1. Community bonding period
- Getting familiar with the mentors.
- Studying the FreeBSD BSNMP code, writing sample code
- Discussing the ways of implementation with mentor.
2. 19th May – 9th June
- Write code to add IPv6 support to bsnmpd
3. 9th – 23rd June
- Write test cases and comprehensively test the code written
4. 23rd – 27th June
- Mid Term evaluations
5. 28th June - 13th July
- Write code to add IPv6 support to bsnmpd tools
6. 14th - 27th July
- Write test cases and comprehensively test the code written
7. 28th July - 10th Aug
- Buffer period to wrap up incomplete items, test some more and resolve bugs.
8. 11th – 18th Aug
- Look for bugs in the code, tests, code samples, evaluation
- Start wrapping it up for merging
- Write documentation
- Code submission
9. 18th – 22nd Aug
- Final Evaluation
Approach to solving the problem
Full IPv6 support for the daemon bsnmpd as well as for bsnmptools was added, as a loadable transport module. An IPv6 UDP transport module was created(trans_udpv6.c) with an equivalent header file(trans_udpv6.h). This module used IPv6 accommodating data structures and functions. The recv functions(recv_stream, check_priv_stream and recv_dgram, check_priv_dgram) were moved from main to their equivalent functions in each of their respective transport modules. Trap.c was modified to support IPv6. IPv6 entries were added to snmpd.config. MIB definitions were added to BEGEMOT-SNMPD-MIB and tree.def for IPv6 transport module as well as for IPv6 traps. Separate IPv6 functions and function calls were added to bsnmp(config.c, export.c, action.c), trap(trap.c, target_snmp.c) and bsnmptools(bsnmptools.c, bsnmpget.c). Data structures were changed in snmpd.h, snmpmod.h and snmp.h to add/ modify structures that support IPv6.
Test Plan
The testing of the code is not yet completed and is currently in progress.
The Code
The source code changes are located in: https://socsvn.freebsd.org/socsvn/soc2014/shonali/head/contrib/bsnmp/ https://socsvn.freebsd.org/socsvn/soc2014/shonali/head/usr.sbin/bsnmpd/