Add nsswitch.conf.5 to man page build
[dragonfly.git] / share / man / man4 / ifmib.4
1 .\" Copyright 1996 Massachusetts Institute of Technology
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software and
4 .\" its documentation for any purpose and without fee is hereby
5 .\" granted, provided that both the above copyright notice and this
6 .\" permission notice appear in all copies, that both the above
7 .\" copyright notice and this permission notice appear in all
8 .\" supporting documentation, and that the name of M.I.T. not be used
9 .\" in advertising or publicity pertaining to distribution of the
10 .\" software without specific, written prior permission.  M.I.T. makes
11 .\" no representations about the suitability of this software for any
12 .\" purpose.  It is provided "as is" without express or implied
13 .\" warranty.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
16 .\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
19 .\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD: src/share/man/man4/ifmib.4,v 1.8.2.6 2002/10/10 18:21:41 johan Exp $
29 .\" $DragonFly: src/share/man/man4/ifmib.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
30 .\"
31 .Dd November 15, 1996
32 .Dt IFMIB 4
33 .Os
34 .Sh NAME
35 .Nm ifmib
36 .Nd Management Information Base for network interfaces
37 .Sh SYNOPSIS
38 .In sys/types.h
39 .In sys/socket.h
40 .In sys/sysctl.h
41 .In sys/time.h
42 .In net/if.h
43 .In net/if_mib.h
44 .Sh DESCRIPTION
45 The
46 .Nm
47 facility is an application of the
48 .Xr sysctl 3
49 interface to provide management information about network interfaces
50 to client applications such as
51 .Xr netstat 1 ,
52 .Xr slstat 8 ,
53 and
54 .Tn SNMP
55 management agents.  This information is structured as a table, where
56 each row in the table represents a logical network interface (either a
57 hardware device or a software pseudo-device like
58 .Xr lo 4 ) .
59 There are two columns in the table, each containing a single
60 structure: one column contains generic information relevant to all
61 interfaces, and the other contains information specific to the
62 particular class of interface.  (Generally the latter will implement
63 the
64 .Tn SNMP
65 .Tn MIB
66 defined for that particular interface class, if one exists and can be
67 implemented in the kernel.)
68 .Pp
69 The
70 .Nm
71 facility is accessed via the
72 .Dq Li net.link.generic
73 branch of the
74 .Xr sysctl 3
75 MIB.  The manifest constants for each level in the
76 .Xr sysctl 3
77 .Ar name
78 are defined in
79 .Aq Pa net/if_mib.h .
80 A count of interfaces (and thus rows in the table) is given by
81 .Dq Li net.link.generic.system.ifcount
82 (or, using the manifest constants,
83 .Dv CTL_NET ,
84 .Dv PF_LINK ,
85 .Dv NETLINK_GENERIC ,
86 .Dv IFMIB_SYSTEM ,
87 .Dv IFMIB_IFCOUNT ) .
88 A management application searching for a particular interface should
89 start with row 1 and continue through the table row-by-row until the
90 desired interface is found, or the interface count is reached.
91 .Pp
92 The generic interface information, common to all interfaces,
93 can be accessed via the following procedure:
94 .Bd -literal -offset indent
95 int
96 get_ifmib_general(int row, struct ifmibdata *ifmd)
97 {
98         int name[6];
99         size_t len;
100
101         name[0] = CTL_NET;
102         name[1] = PF_LINK;
103         name[2] = NETLINK_GENERIC;
104         name[3] = IFMIB_IFDATA;
105         name[4] = row;
106         name[5] = IFDATA_GENERAL;
107
108         len = sizeof(*ifmd);
109
110         return sysctl(name, 6, ifmd, &len, (void *)0, 0);
111 }
112 .Ed
113 .Pp
114 The fields in
115 .Li struct ifmibdata
116 are as follows:
117 .Bl -tag -width "ifmd_snd_drops"
118 .It Li ifmd_name
119 .Pq Li "char []"
120 the name of the interface, including the unit number
121 .It Li ifmd_pcount
122 .Pq Li int
123 the number of promiscuous listeners
124 .It Li ifmd_flags
125 .Pq Li int
126 the interface's flags (defined in
127 .Aq Pa net/if.h )
128 .It Li ifmd_snd_len
129 .Pq Li int
130 the current instantaneous length of the send queue
131 .It Li ifmd_snd_drops
132 .Pq Li int
133 the number of packets dropped at this interface because the send queue
134 was full
135 .It Li ifmd_data
136 .Pq Li struct if_data
137 more information from a structure defined in
138 .Aq Pa net/if.h
139 (see
140 .Xr if_data 9 )
141 .El
142 .Pp
143 Class-specific information can be retrieved by examining the
144 .Dv IFDATA_LINKSPECIFIC
145 column instead.  Note that the form and length of the structure will
146 depend on the class of interface.  For
147 .Dv IFT_ETHER ,
148 .Dv IFT_ISO88023 ,
149 and
150 .Dv IFT_STARLAN
151 interfaces, the structure is called
152 .Dq Li struct ifmib_iso_8802_3
153 (defined in
154 .Aq Pa net/if_mib.h ) ,
155 and implements a superset of the
156 .Tn "RFC 1650"
157 MIB for Ethernet-like networks.
158 .\" This will eventually be defined in an ethermib(4) page.
159 For
160 .Dv IFT_SLIP ,
161 the structure is a
162 .Dq Li struct sl_softc
163 .Pq Aq Pa net/if_slvar.h .
164 .Sh SEE ALSO
165 .Xr sysctl 3 ,
166 .Xr intro 4 ,
167 .Xr ifnet 9
168 .\" .Xr ethermib 4 ,
169 .Rs
170 .%T "Definitions of Managed Objects for the Ethernet-like Interface Types Using SMIv2"
171 .%A F. Kastenholz
172 .%D August 1994
173 .%O RFC 1650
174 .Re
175 .Sh BUGS
176 Many Ethernet-like interfaces do not yet support the Ethernet MIB;
177 the interfaces known to support it include
178 .Xr ed 4
179 and
180 .Xr de 4 .
181 Regardless, all interfaces automatically support the generic MIB.
182 .Sh HISTORY
183 The
184 .Nm
185 interface first appeared in
186 .Fx 2.2 .