1.\" 2.\" Copyright (c) 2001-2003 3.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4.\" All rights reserved. 5.\" 6.\" Author: Harti Brandt <harti@freebsd.org> 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\"
| 1.\" 2.\" Copyright (c) 2001-2003 3.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4.\" All rights reserved. 5.\" 6.\" Author: Harti Brandt <harti@freebsd.org> 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\"
|
29.\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.6 2005/02/28 16:00:11 brandt_h Exp $
| 29.\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.7 2005/05/23 09:11:21 brandt_h Exp $
|
30.\"
| 30.\"
|
31.Dd August 19, 2002
| 31.Dd May 23, 2005
|
32.Dt SNMP_MIBII 3 33.Os 34.Sh NAME 35.Nm mibII , 36.Nm mibif_notify_f , 37.Nm mib_netsock , 38.Nm mib_if_set_dyn , 39.Nm mib_refresh_iflist , 40.Nm mib_find_if , 41.Nm mib_find_if_sys , 42.Nm mib_find_if_name , 43.Nm mib_first_if , 44.Nm mib_next_if , 45.Nm mib_register_newif , 46.Nm mib_unregister_newif , 47.Nm mib_fetch_ifmib , 48.Nm mib_if_admin , 49.Nm mib_find_ifa , 50.Nm mib_first_ififa , 51.Nm mib_next_ififa , 52.Nm mib_ifstack_create , 53.Nm mib_ifstack_delete , 54.Nm mib_find_rcvaddr , 55.Nm mib_rcvaddr_create , 56.Nm mib_rcvaddr_delete , 57.Nm mibif_notify , 58.Nm mibif_unnotify 59.Nd "mib-2 module for snmpd. 60.Sh LIBRARY 61.Pq begemotSnmpdModulePath."mibII" = "@MODPATH@snmp_mibII.so" 62.Sh SYNOPSIS 63.In bsnmp/snmpmod.h 64.In bsnmp/snmp_mibII.h 65.Ft typedef void 66.Fn (*mibif_notify_f) "struct mibif *ifp" "enum mibif_notify event" "void *uarg" 67.Vt extern int mib_netsock ; 68.Ft void 69.Fn mib_if_set_dyn "const char *ifname" 70.Ft void 71.Fn mib_refresh_iflist "void" 72.Ft struct mibif * 73.Fn mib_find_if "u_int ifindex" 74.Ft struct mibif * 75.Fn mib_find_if_sys "u_int sysindex" 76.Ft struct mibif * 77.Fn mib_find_if_name "const char *ifname" 78.Ft struct mibif * 79.Fn mib_first_if "void" 80.Ft struct mibif * 81.Fn mib_next_if "const struct mibif *ifp" 82.Ft int 83.Fn mib_register_newif "int (*func)(struct mibif *)" "const struct lmodule *mod" 84.Ft void 85.Fn mib_unregister_newif "const struct lmodule *mod" 86.Ft int 87.Fn mib_fetch_ifmib "struct mibif *ifp" 88.Ft int 89.Fn mib_if_admin "struct mibif *ifp" "int up" 90.Ft struct mibifa * 91.Fn mib_find_ifa "struct in_addr ipa" 92.Ft struct mibifa * 93.Fn mib_first_ififa "const struct mibif *ifp" 94.Ft struct mibifa * 95.Fn mib_next_ififa "struct mibifa *ifa" 96.Ft int 97.Fn mib_ifstack_create "const struct mibif *lower" "const struct mibif *upper" 98.Ft void 99.Fn mib_ifstack_delete "const struct mibif *lower" "const struct mibif *upper" 100.Ft struct mibrcvaddr * 101.Fn mib_find_rcvaddr "u_int ifindex" "const u_char *addr" "size_t addrlen" 102.Ft struct mibrcvaddr * 103.Fn mib_rcvaddr_create "struct mibif *ifp" "const u_char *addr" "size_t addrlen" 104.Ft void 105.Fn mib_rcvaddr_delete "struct mibrcvaddr *addr" 106.Ft void * 107.Fn mibif_notify "struct mibif *ifp" "const struct lmodule *mod" "mibif_notify_f func" "void *uarg" 108.Ft void 109.Fn mibif_unnotify "void *reg" 110.Sh DESCRIPTION 111The 112.Nm snmp_mibII 113module implements parts of the internet standard MIB-2. Most of the relevant 114MIBs are implemented. Some of the tables are restricted to be read-only 115instead of read-write. The exact current implementation can be found in 116.Pa @DEFPATH@mibII_tree.def . 117The module also exports a number of functions and global variables for use 118by other modules, that need to handle network interfaces. This man page describes 119these functions. 120.Ss DIRECT NETWORK ACCESS 121The 122.Nm 123module opens a socket that is used to execute all network related 124.Xr ioctl 2 125functions. This socket is globally available under the name 126.Va mib_netsock . 127.Ss NETWORK INTERFACES 128The 129.Nm 130module handles a list of all currently existing network interfaces. It allows 131other modules to handle their own interface lists with special information 132by providing a mechanism to register to events that change the interface list 133(see below). The basic data structure is the interface structure: 134.Bd -literal -offset indent 135struct mibif { 136 TAILQ_ENTRY(mibif) link; 137 u_int flags; 138 u_int index; /* logical ifindex */ 139 u_int sysindex; 140 char name[IFNAMSIZ]; 141 char descr[256]; 142 struct ifmibdata mib;
| 32.Dt SNMP_MIBII 3 33.Os 34.Sh NAME 35.Nm mibII , 36.Nm mibif_notify_f , 37.Nm mib_netsock , 38.Nm mib_if_set_dyn , 39.Nm mib_refresh_iflist , 40.Nm mib_find_if , 41.Nm mib_find_if_sys , 42.Nm mib_find_if_name , 43.Nm mib_first_if , 44.Nm mib_next_if , 45.Nm mib_register_newif , 46.Nm mib_unregister_newif , 47.Nm mib_fetch_ifmib , 48.Nm mib_if_admin , 49.Nm mib_find_ifa , 50.Nm mib_first_ififa , 51.Nm mib_next_ififa , 52.Nm mib_ifstack_create , 53.Nm mib_ifstack_delete , 54.Nm mib_find_rcvaddr , 55.Nm mib_rcvaddr_create , 56.Nm mib_rcvaddr_delete , 57.Nm mibif_notify , 58.Nm mibif_unnotify 59.Nd "mib-2 module for snmpd. 60.Sh LIBRARY 61.Pq begemotSnmpdModulePath."mibII" = "@MODPATH@snmp_mibII.so" 62.Sh SYNOPSIS 63.In bsnmp/snmpmod.h 64.In bsnmp/snmp_mibII.h 65.Ft typedef void 66.Fn (*mibif_notify_f) "struct mibif *ifp" "enum mibif_notify event" "void *uarg" 67.Vt extern int mib_netsock ; 68.Ft void 69.Fn mib_if_set_dyn "const char *ifname" 70.Ft void 71.Fn mib_refresh_iflist "void" 72.Ft struct mibif * 73.Fn mib_find_if "u_int ifindex" 74.Ft struct mibif * 75.Fn mib_find_if_sys "u_int sysindex" 76.Ft struct mibif * 77.Fn mib_find_if_name "const char *ifname" 78.Ft struct mibif * 79.Fn mib_first_if "void" 80.Ft struct mibif * 81.Fn mib_next_if "const struct mibif *ifp" 82.Ft int 83.Fn mib_register_newif "int (*func)(struct mibif *)" "const struct lmodule *mod" 84.Ft void 85.Fn mib_unregister_newif "const struct lmodule *mod" 86.Ft int 87.Fn mib_fetch_ifmib "struct mibif *ifp" 88.Ft int 89.Fn mib_if_admin "struct mibif *ifp" "int up" 90.Ft struct mibifa * 91.Fn mib_find_ifa "struct in_addr ipa" 92.Ft struct mibifa * 93.Fn mib_first_ififa "const struct mibif *ifp" 94.Ft struct mibifa * 95.Fn mib_next_ififa "struct mibifa *ifa" 96.Ft int 97.Fn mib_ifstack_create "const struct mibif *lower" "const struct mibif *upper" 98.Ft void 99.Fn mib_ifstack_delete "const struct mibif *lower" "const struct mibif *upper" 100.Ft struct mibrcvaddr * 101.Fn mib_find_rcvaddr "u_int ifindex" "const u_char *addr" "size_t addrlen" 102.Ft struct mibrcvaddr * 103.Fn mib_rcvaddr_create "struct mibif *ifp" "const u_char *addr" "size_t addrlen" 104.Ft void 105.Fn mib_rcvaddr_delete "struct mibrcvaddr *addr" 106.Ft void * 107.Fn mibif_notify "struct mibif *ifp" "const struct lmodule *mod" "mibif_notify_f func" "void *uarg" 108.Ft void 109.Fn mibif_unnotify "void *reg" 110.Sh DESCRIPTION 111The 112.Nm snmp_mibII 113module implements parts of the internet standard MIB-2. Most of the relevant 114MIBs are implemented. Some of the tables are restricted to be read-only 115instead of read-write. The exact current implementation can be found in 116.Pa @DEFPATH@mibII_tree.def . 117The module also exports a number of functions and global variables for use 118by other modules, that need to handle network interfaces. This man page describes 119these functions. 120.Ss DIRECT NETWORK ACCESS 121The 122.Nm 123module opens a socket that is used to execute all network related 124.Xr ioctl 2 125functions. This socket is globally available under the name 126.Va mib_netsock . 127.Ss NETWORK INTERFACES 128The 129.Nm 130module handles a list of all currently existing network interfaces. It allows 131other modules to handle their own interface lists with special information 132by providing a mechanism to register to events that change the interface list 133(see below). The basic data structure is the interface structure: 134.Bd -literal -offset indent 135struct mibif { 136 TAILQ_ENTRY(mibif) link; 137 u_int flags; 138 u_int index; /* logical ifindex */ 139 u_int sysindex; 140 char name[IFNAMSIZ]; 141 char descr[256]; 142 struct ifmibdata mib;
|
143 u_int32_t mibtick;
| 143 uint64_t mibtick;
|
144 void *specmib; 145 size_t specmiblen; 146 u_char *physaddr; 147 u_int physaddrlen; 148 int has_connector; 149 int trap_enable;
| 144 void *specmib; 145 size_t specmiblen; 146 u_char *physaddr; 147 u_int physaddrlen; 148 int has_connector; 149 int trap_enable;
|
150 u_int32_t counter_disc;
| 150 uint64_t counter_disc;
|
151 mibif_notify_f xnotify; 152 void *xnotify_data; 153 const struct lmodule *xnotify_mod; 154 struct asn_oid spec_oid; 155}; 156.Ed 157.Pp 158The 159.Nm 160module tries to implement the semantic if 161.Va ifIndex 162as described in RFC-2863. This RFC states, that an interface indexes may not 163be reused. That means, for example, if 164.Pa tun 165is a synthetic interface type and the system creates the interface 166.Pa tun0 , 167destroys this interfaces and again creates a 168.Pa tun 0 , 169then these interfaces must have different interface indexes, because in fact 170they are different interfaces. If, on the other hand, there is a hardware 171interface 172.Pa xl0 173and this interface disappears, because its driver is unloaded and appears 174again, because the driver is loaded again, the interface index must stay 175the same. 176.Nm 177implements this by differentiating between real and synthetic (dynamic) 178interfaces. An interface type can be declared dynamic by calling the function 179.Fn mib_if_set_dyn 180with the name if the interface type (for example 181.Qq tun ). 182For real interfaces, the module keeps the mapping between the interface name 183and its 184.Va ifIndex 185in a special list, if the interface is unloaded. For dynamic interfaces 186a new 187.Va ifIndex 188is generated each time the interface comes into existance. This 189means, that the interface index as seen by SNMP is not the same index 190as used by the system. The SNMP 191.Va ifIndex 192is held in field 193.Va index , 194the system's interface index is 195.Va sysindex . 196.Pp 197A call to 198.Nm mib_refresh_iflist 199causes the entire interface list to be re-created. 200.Pp 201The interface list can be traversed with the functions 202.Fn mib_first_if 203and 204.Fn mib_next_if . 205Be sure not to change the interface list while traversing the list with 206these two calls. 207.Pp 208There are three functions to find an interface by name or index. 209.Fn mib_find_if 210finds an interface by searching for an SNMP 211.Va ifIndex , 212.Fn mib_find_if_sys 213finds an interface by searching for a system interface index and 214.Fn mib_find_if_name 215finds an interface by looking for an interface name. Each of the 216function returns 217.Li NULL 218if the interface cannot be found. 219.Pp 220The function 221.Fn mib_fetch_ifmib 222causes the interface MIB to be refreshed from the kernel. 223.Pp 224The function 225.Fn mib_if_admin 226can be used to change the interface administrative state to up 227(argument is 1) or down (argument is 0). 228.Ss INTERFACE EVENTS 229A module can register itself to receive a notification when a new entry is 230created in the interface list. This is done by calling 231.Fn mib_register_newif . 232A module can register only one function, a second call to 233.Fn mib_register_newif 234causes the registration to be overwritten. The registration can be removed 235with a call to 236.Fn mib_unregister_newif . 237If is unregistered automatically, when the registering module is unloaded. 238.Pp 239A module can also register to events on a specific interface. This is done 240by calling 241.Fn mibif_notify . 242This causes the given callback 243.Fa func 244to be called with the interface pointer, a notification code and 245the user argument 246.Fa uarg 247when any of the following events occur: 248.Bl -tag -width "XXXXX" 249.It Li MIBIF_NOTIFY_DESTROY 250The interface is destroyed. 251.El 252.Pp 253This mechanism can be used to implement interface type specific MIB parts 254in other modules. The registration can be removed with 255.Fn mib_unnotify 256which the return value from 257.Fa mib_notify . 258Any notification registration is removed automatically when the interface 259is destroyed or the registering module is unloaded. 260.Em Note that only one module can register to any given interface . 261.Ss INTERFACE ADDRESSES 262The 263.Nm 264module handles a table of interface IP-addresses. These addresses are held 265in a 266.Bd -literal -offset indent 267struct mibifa { 268 TAILQ_ENTRY(mibifa) link; 269 struct in_addr inaddr; 270 struct in_addr inmask; 271 struct in_addr inbcast; 272 struct asn_oid index; 273 u_int ifindex; 274 u_int flags; 275}; 276.Ed 277.Pp 278The (ordered) list of IP-addresses on a given interface can be traversed by 279calling 280.Fn mib_first_ififa 281and 282.Fn mib_next_ififa . 283The list should not be considered read-only. 284.Ss INTERFACE RECEIVE ADDRESSES 285The internet MIB-2 contains a table of interface receive addresses. These 286addresses are handled in: 287.Bd -literal -offset indent 288struct mibrcvaddr { 289 TAILQ_ENTRY(mibrcvaddr) link; 290 struct asn_oid index; 291 u_int ifindex; 292 u_char addr[ASN_MAXOIDLEN]; 293 size_t addrlen; 294 u_int flags; 295}; 296enum { 297 MIBRCVADDR_VOLATILE = 0x00000001, 298 MIBRCVADDR_BCAST = 0x00000002, 299 MIBRCVADDR_HW = 0x00000004, 300}; 301.Ed 302.Pp 303Note, that the assignment of 304.Li MIBRCVADDR_BCAST 305is based on a list of known interface types. The flags should be handled 306by modules inplementing interface type specific MIBs. 307.Pp 308A receive address can be created with 309.Fn mib_rcvaddr_create 310and deleted with 311.Fn mib_rcvaddr_delete . 312This needs to be done only for addresses that are not automatically handled 313by the system. 314.Pp 315A receive address can be found with 316.Fn mib_find_rcvaddr . 317.Ss INTERFACE STACK TABLE 318The 319.Nm 320module maintains also the interface stack table. Because for complex stacks, 321there is no system supported generic way of getting this information, interface 322type specific modules need to help setting up stack entries. The 323.Nm 324module handles only the top and bottom entries. 325.Pp 326A table entry is created with 327.Fn mib_ifstack_create 328and deleted with 329.Fn mib_ifstack_delete . 330Both functions need the pointers to the interfaces. Entries are automatically 331deleted if any of the interfaces of the entry is destroyed. The functions handle 332both the stack table and the reverse stack table. 333.Sh FILES 334.Bl -tag -width ".It Pa @DEFPATH@mibII_tree.def" -compact 335.It Pa @DEFPATH@mibII_tree.def 336The description of the MIB tree implemented by 337.Nm . 338.It Pa /usr/local/share/snmp/mibs 339.It Pa @MIBSPATH@ 340The various internet MIBs. 341.El 342.Sh SEE ALSO 343.Xr gensnmptree 1 , 344.Xr snmpmod 3 345.Sh STANDARDS 346This implementation conforms to the applicable IETF RFCs. 347.Sh AUTHORS 348.An Hartmut Brandt Aq harti@freebsd.org
| 151 mibif_notify_f xnotify; 152 void *xnotify_data; 153 const struct lmodule *xnotify_mod; 154 struct asn_oid spec_oid; 155}; 156.Ed 157.Pp 158The 159.Nm 160module tries to implement the semantic if 161.Va ifIndex 162as described in RFC-2863. This RFC states, that an interface indexes may not 163be reused. That means, for example, if 164.Pa tun 165is a synthetic interface type and the system creates the interface 166.Pa tun0 , 167destroys this interfaces and again creates a 168.Pa tun 0 , 169then these interfaces must have different interface indexes, because in fact 170they are different interfaces. If, on the other hand, there is a hardware 171interface 172.Pa xl0 173and this interface disappears, because its driver is unloaded and appears 174again, because the driver is loaded again, the interface index must stay 175the same. 176.Nm 177implements this by differentiating between real and synthetic (dynamic) 178interfaces. An interface type can be declared dynamic by calling the function 179.Fn mib_if_set_dyn 180with the name if the interface type (for example 181.Qq tun ). 182For real interfaces, the module keeps the mapping between the interface name 183and its 184.Va ifIndex 185in a special list, if the interface is unloaded. For dynamic interfaces 186a new 187.Va ifIndex 188is generated each time the interface comes into existance. This 189means, that the interface index as seen by SNMP is not the same index 190as used by the system. The SNMP 191.Va ifIndex 192is held in field 193.Va index , 194the system's interface index is 195.Va sysindex . 196.Pp 197A call to 198.Nm mib_refresh_iflist 199causes the entire interface list to be re-created. 200.Pp 201The interface list can be traversed with the functions 202.Fn mib_first_if 203and 204.Fn mib_next_if . 205Be sure not to change the interface list while traversing the list with 206these two calls. 207.Pp 208There are three functions to find an interface by name or index. 209.Fn mib_find_if 210finds an interface by searching for an SNMP 211.Va ifIndex , 212.Fn mib_find_if_sys 213finds an interface by searching for a system interface index and 214.Fn mib_find_if_name 215finds an interface by looking for an interface name. Each of the 216function returns 217.Li NULL 218if the interface cannot be found. 219.Pp 220The function 221.Fn mib_fetch_ifmib 222causes the interface MIB to be refreshed from the kernel. 223.Pp 224The function 225.Fn mib_if_admin 226can be used to change the interface administrative state to up 227(argument is 1) or down (argument is 0). 228.Ss INTERFACE EVENTS 229A module can register itself to receive a notification when a new entry is 230created in the interface list. This is done by calling 231.Fn mib_register_newif . 232A module can register only one function, a second call to 233.Fn mib_register_newif 234causes the registration to be overwritten. The registration can be removed 235with a call to 236.Fn mib_unregister_newif . 237If is unregistered automatically, when the registering module is unloaded. 238.Pp 239A module can also register to events on a specific interface. This is done 240by calling 241.Fn mibif_notify . 242This causes the given callback 243.Fa func 244to be called with the interface pointer, a notification code and 245the user argument 246.Fa uarg 247when any of the following events occur: 248.Bl -tag -width "XXXXX" 249.It Li MIBIF_NOTIFY_DESTROY 250The interface is destroyed. 251.El 252.Pp 253This mechanism can be used to implement interface type specific MIB parts 254in other modules. The registration can be removed with 255.Fn mib_unnotify 256which the return value from 257.Fa mib_notify . 258Any notification registration is removed automatically when the interface 259is destroyed or the registering module is unloaded. 260.Em Note that only one module can register to any given interface . 261.Ss INTERFACE ADDRESSES 262The 263.Nm 264module handles a table of interface IP-addresses. These addresses are held 265in a 266.Bd -literal -offset indent 267struct mibifa { 268 TAILQ_ENTRY(mibifa) link; 269 struct in_addr inaddr; 270 struct in_addr inmask; 271 struct in_addr inbcast; 272 struct asn_oid index; 273 u_int ifindex; 274 u_int flags; 275}; 276.Ed 277.Pp 278The (ordered) list of IP-addresses on a given interface can be traversed by 279calling 280.Fn mib_first_ififa 281and 282.Fn mib_next_ififa . 283The list should not be considered read-only. 284.Ss INTERFACE RECEIVE ADDRESSES 285The internet MIB-2 contains a table of interface receive addresses. These 286addresses are handled in: 287.Bd -literal -offset indent 288struct mibrcvaddr { 289 TAILQ_ENTRY(mibrcvaddr) link; 290 struct asn_oid index; 291 u_int ifindex; 292 u_char addr[ASN_MAXOIDLEN]; 293 size_t addrlen; 294 u_int flags; 295}; 296enum { 297 MIBRCVADDR_VOLATILE = 0x00000001, 298 MIBRCVADDR_BCAST = 0x00000002, 299 MIBRCVADDR_HW = 0x00000004, 300}; 301.Ed 302.Pp 303Note, that the assignment of 304.Li MIBRCVADDR_BCAST 305is based on a list of known interface types. The flags should be handled 306by modules inplementing interface type specific MIBs. 307.Pp 308A receive address can be created with 309.Fn mib_rcvaddr_create 310and deleted with 311.Fn mib_rcvaddr_delete . 312This needs to be done only for addresses that are not automatically handled 313by the system. 314.Pp 315A receive address can be found with 316.Fn mib_find_rcvaddr . 317.Ss INTERFACE STACK TABLE 318The 319.Nm 320module maintains also the interface stack table. Because for complex stacks, 321there is no system supported generic way of getting this information, interface 322type specific modules need to help setting up stack entries. The 323.Nm 324module handles only the top and bottom entries. 325.Pp 326A table entry is created with 327.Fn mib_ifstack_create 328and deleted with 329.Fn mib_ifstack_delete . 330Both functions need the pointers to the interfaces. Entries are automatically 331deleted if any of the interfaces of the entry is destroyed. The functions handle 332both the stack table and the reverse stack table. 333.Sh FILES 334.Bl -tag -width ".It Pa @DEFPATH@mibII_tree.def" -compact 335.It Pa @DEFPATH@mibII_tree.def 336The description of the MIB tree implemented by 337.Nm . 338.It Pa /usr/local/share/snmp/mibs 339.It Pa @MIBSPATH@ 340The various internet MIBs. 341.El 342.Sh SEE ALSO 343.Xr gensnmptree 1 , 344.Xr snmpmod 3 345.Sh STANDARDS 346This implementation conforms to the applicable IETF RFCs. 347.Sh AUTHORS 348.An Hartmut Brandt Aq harti@freebsd.org
|