]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/man/man4/netgraph.4
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / man / man4 / netgraph.4
1 .\" Copyright (c) 1996-1999 Whistle Communications, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" Subject to the following obligations and disclaimer of warranty, use and
5 .\" redistribution of this software, in source or object code forms, with or
6 .\" without modifications are expressly permitted by Whistle Communications;
7 .\" provided, however, that:
8 .\" 1. Any and all reproductions of the source or object code must include the
9 .\"    copyright notice above and the following disclaimer of warranties; and
10 .\" 2. No rights are granted, in any manner or form, to use Whistle
11 .\"    Communications, Inc. trademarks, including the mark "WHISTLE
12 .\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
13 .\"    such appears in the above copyright notice or in the software.
14 .\"
15 .\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
16 .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
17 .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
18 .\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
20 .\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
21 .\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
22 .\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
23 .\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
24 .\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
25 .\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26 .\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
27 .\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
31 .\" OF SUCH DAMAGE.
32 .\"
33 .\" Authors: Julian Elischer <julian@FreeBSD.org>
34 .\"          Archie Cobbs <archie@FreeBSD.org>
35 .\"
36 .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $
37 .\" $FreeBSD$
38 .\"
39 .Dd May 25, 2008
40 .Dt NETGRAPH 4
41 .Os
42 .Sh NAME
43 .Nm netgraph
44 .Nd "graph based kernel networking subsystem"
45 .Sh DESCRIPTION
46 The
47 .Nm
48 system provides a uniform and modular system for the implementation
49 of kernel objects which perform various networking functions.
50 The objects, known as
51 .Em nodes ,
52 can be arranged into arbitrarily complicated graphs.
53 Nodes have
54 .Em hooks
55 which are used to connect two nodes together, forming the edges in the graph.
56 Nodes communicate along the edges to process data, implement protocols, etc.
57 .Pp
58 The aim of
59 .Nm
60 is to supplement rather than replace the existing kernel networking
61 infrastructure.
62 It provides:
63 .Pp
64 .Bl -bullet -compact
65 .It
66 A flexible way of combining protocol and link level drivers.
67 .It
68 A modular way to implement new protocols.
69 .It
70 A common framework for kernel entities to inter-communicate.
71 .It
72 A reasonably fast, kernel-based implementation.
73 .El
74 .Ss Nodes and Types
75 The most fundamental concept in
76 .Nm
77 is that of a
78 .Em node .
79 All nodes implement a number of predefined methods which allow them
80 to interact with other nodes in a well defined manner.
81 .Pp
82 Each node has a
83 .Em type ,
84 which is a static property of the node determined at node creation time.
85 A node's type is described by a unique
86 .Tn ASCII
87 type name.
88 The type implies what the node does and how it may be connected
89 to other nodes.
90 .Pp
91 In object-oriented language, types are classes, and nodes are instances
92 of their respective class.
93 All node types are subclasses of the generic node
94 type, and hence inherit certain common functionality and capabilities
95 (e.g., the ability to have an
96 .Tn ASCII
97 name).
98 .Pp
99 Nodes may be assigned a globally unique
100 .Tn ASCII
101 name which can be
102 used to refer to the node.
103 The name must not contain the characters
104 .Ql .\&
105 or
106 .Ql \&: ,
107 and is limited to
108 .Dv NG_NODESIZ
109 characters (including the terminating
110 .Dv NUL
111 character).
112 .Pp
113 Each node instance has a unique
114 .Em ID number
115 which is expressed as a 32-bit hexadecimal value.
116 This value may be used to refer to a node when there is no
117 .Tn ASCII
118 name assigned to it.
119 .Ss Hooks
120 Nodes are connected to other nodes by connecting a pair of
121 .Em hooks ,
122 one from each node.
123 Data flows bidirectionally between nodes along
124 connected pairs of hooks.
125 A node may have as many hooks as it
126 needs, and may assign whatever meaning it wants to a hook.
127 .Pp
128 Hooks have these properties:
129 .Bl -bullet
130 .It
131 A hook has an
132 .Tn ASCII
133 name which is unique among all hooks
134 on that node (other hooks on other nodes may have the same name).
135 The name must not contain the characters
136 .Ql .\&
137 or
138 .Ql \&: ,
139 and is
140 limited to
141 .Dv NG_HOOKSIZ
142 characters (including the terminating
143 .Dv NUL
144 character).
145 .It
146 A hook is always connected to another hook.
147 That is, hooks are
148 created at the time they are connected, and breaking an edge by
149 removing either hook destroys both hooks.
150 .It
151 A hook can be set into a state where incoming packets are always queued
152 by the input queueing system, rather than being delivered directly.
153 This can be used when the data is sent from an interrupt handler,
154 and processing must be quick so as not to block other interrupts.
155 .It
156 A hook may supply overriding receive data and receive message functions,
157 which should be used for data and messages received through that hook
158 in preference to the general node-wide methods.
159 .El
160 .Pp
161 A node may decide to assign special meaning to some hooks.
162 For example, connecting to the hook named
163 .Va debug
164 might trigger
165 the node to start sending debugging information to that hook.
166 .Ss Data Flow
167 Two types of information flow between nodes: data messages and
168 control messages.
169 Data messages are passed in
170 .Vt mbuf chains
171 along the edges
172 in the graph, one edge at a time.
173 The first
174 .Vt mbuf
175 in a chain must have the
176 .Dv M_PKTHDR
177 flag set.
178 Each node decides how to handle data received through one of its hooks.
179 .Pp
180 Along with data, nodes can also receive control messages.
181 There are generic and type-specific control messages.
182 Control messages have a common
183 header format, followed by type-specific data, and are binary structures
184 for efficiency.
185 However, node types may also support conversion of the
186 type-specific data between binary and
187 .Tn ASCII
188 formats,
189 for debugging and human interface purposes (see the
190 .Dv NGM_ASCII2BINARY
191 and
192 .Dv NGM_BINARY2ASCII
193 generic control messages below).
194 Nodes are not required to support these conversions.
195 .Pp
196 There are three ways to address a control message.
197 If there is a sequence of edges connecting the two nodes, the message
198 may be
199 .Dq source routed
200 by specifying the corresponding sequence
201 of
202 .Tn ASCII
203 hook names as the destination address for the message (relative
204 addressing).
205 If the destination is adjacent to the source, then the source
206 node may simply specify (as a pointer in the code) the hook across which the
207 message should be sent.
208 Otherwise, the recipient node's global
209 .Tn ASCII
210 name
211 (or equivalent ID-based name) is used as the destination address
212 for the message (absolute addressing).
213 The two types of
214 .Tn ASCII
215 addressing
216 may be combined, by specifying an absolute start node and a sequence
217 of hooks.
218 Only the
219 .Tn ASCII
220 addressing modes are available to control programs outside the kernel;
221 use of direct pointers is limited to kernel modules.
222 .Pp
223 Messages often represent commands that are followed by a reply message
224 in the reverse direction.
225 To facilitate this, the recipient of a
226 control message is supplied with a
227 .Dq return address
228 that is suitable for addressing a reply.
229 .Pp
230 Each control message contains a 32-bit value, called a
231 .Dq typecookie ,
232 indicating the type of the message, i.e.\& how to interpret it.
233 Typically each type defines a unique typecookie for the messages
234 that it understands.
235 However, a node may choose to recognize and
236 implement more than one type of messages.
237 .Pp
238 If a message is delivered to an address that implies that it arrived
239 at that node through a particular hook (as opposed to having been directly
240 addressed using its ID or global name) then that hook is identified to the
241 receiving node.
242 This allows a message to be re-routed or passed on, should
243 a node decide that this is required, in much the same way that data packets
244 are passed around between nodes.
245 A set of standard
246 messages for flow control and link management purposes are
247 defined by the base system that are usually
248 passed around in this manner.
249 Flow control message would usually travel
250 in the opposite direction to the data to which they pertain.
251 .Ss Netgraph is (Usually) Functional
252 In order to minimize latency, most
253 .Nm
254 operations are functional.
255 That is, data and control messages are delivered by making function
256 calls rather than by using queues and mailboxes.
257 For example, if node
258 A wishes to send a data
259 .Vt mbuf
260 to neighboring node B, it calls the
261 generic
262 .Nm
263 data delivery function.
264 This function in turn locates
265 node B and calls B's
266 .Dq receive data
267 method.
268 There are exceptions to this.
269 .Pp
270 Each node has an input queue, and some operations can be considered to
271 be
272 .Em writers
273 in that they alter the state of the node.
274 Obviously, in an SMP
275 world it would be bad if the state of a node were changed while another
276 data packet were transiting the node.
277 For this purpose, the input queue implements a
278 .Em reader/writer
279 semantic so that when there is a writer in the node, all other requests
280 are queued, and while there are readers, a writer, and any following
281 packets are queued.
282 In the case where there is no reason to queue the
283 data, the input method is called directly, as mentioned above.
284 .Pp
285 A node may declare that all requests should be considered as writers,
286 or that requests coming in over a particular hook should be considered to
287 be a writer, or even that packets leaving or entering across a particular
288 hook should always be queued, rather than delivered directly (often useful
289 for interrupt routines who want to get back to the hardware quickly).
290 By default, all control message packets are considered to be writers
291 unless specifically declared to be a reader in their definition.
292 (See
293 .Dv NGM_READONLY
294 in
295 .In ng_message.h . )
296 .Pp
297 While this mode of operation
298 results in good performance, it has a few implications for node
299 developers:
300 .Bl -bullet
301 .It
302 Whenever a node delivers a data or control message, the node
303 may need to allow for the possibility of receiving a returning
304 message before the original delivery function call returns.
305 .It
306 .Nm Netgraph
307 provides internal synchronization between nodes.
308 Data always enters a
309 .Dq graph
310 at an
311 .Em edge node .
312 An
313 .Em edge node
314 is a node that interfaces between
315 .Nm
316 and some other part of the system.
317 Examples of
318 .Dq edge nodes
319 include device drivers, the
320 .Vt socket , ether , tty ,
321 and
322 .Vt ksocket
323 node type.
324 In these
325 .Em edge nodes ,
326 the calling thread directly executes code in the node, and from that code
327 calls upon the
328 .Nm
329 framework to deliver data across some edge
330 in the graph.
331 From an execution point of view, the calling thread will execute the
332 .Nm
333 framework methods, and if it can acquire a lock to do so,
334 the input methods of the next node.
335 This continues until either the data is discarded or queued for some
336 device or system entity, or the thread is unable to acquire a lock on
337 the next node.
338 In that case, the data is queued for the node, and execution rewinds
339 back to the original calling entity.
340 The queued data will be picked up and processed by either the current
341 holder of the lock when they have completed their operations, or by
342 a special
343 .Nm
344 thread that is activated when there are such items
345 queued.
346 .It
347 It is possible for an infinite loop to occur if the graph contains cycles.
348 .El
349 .Pp
350 So far, these issues have not proven problematical in practice.
351 .Ss Interaction with Other Parts of the Kernel
352 A node may have a hidden interaction with other components of the
353 kernel outside of the
354 .Nm
355 subsystem, such as device hardware,
356 kernel protocol stacks, etc.
357 In fact, one of the benefits of
358 .Nm
359 is the ability to join disparate kernel networking entities together in a
360 consistent communication framework.
361 .Pp
362 An example is the
363 .Vt socket
364 node type which is both a
365 .Nm
366 node and a
367 .Xr socket 2
368 in the protocol family
369 .Dv PF_NETGRAPH .
370 Socket nodes allow user processes to participate in
371 .Nm .
372 Other nodes communicate with socket nodes using the usual methods, and the
373 node hides the fact that it is also passing information to and from a
374 cooperating user process.
375 .Pp
376 Another example is a device driver that presents
377 a node interface to the hardware.
378 .Ss Node Methods
379 Nodes are notified of the following actions via function calls
380 to the following node methods,
381 and may accept or reject that action (by returning the appropriate
382 error code):
383 .Bl -tag -width 2n
384 .It Creation of a new node
385 The constructor for the type is called.
386 If creation of a new node is allowed, constructor method may allocate any
387 special resources it needs.
388 For nodes that correspond to hardware, this is typically done during the
389 device attach routine.
390 Often a global
391 .Tn ASCII
392 name corresponding to the
393 device name is assigned here as well.
394 .It Creation of a new hook
395 The hook is created and tentatively
396 linked to the node, and the node is told about the name that will be
397 used to describe this hook.
398 The node sets up any special data structures
399 it needs, or may reject the connection, based on the name of the hook.
400 .It Successful connection of two hooks
401 After both ends have accepted their
402 hooks, and the links have been made, the nodes get a chance to
403 find out who their peer is across the link, and can then decide to reject
404 the connection.
405 Tear-down is automatic.
406 This is also the time at which
407 a node may decide whether to set a particular hook (or its peer) into
408 the
409 .Em queueing
410 mode.
411 .It Destruction of a hook
412 The node is notified of a broken connection.
413 The node may consider some hooks
414 to be critical to operation and others to be expendable: the disconnection
415 of one hook may be an acceptable event while for another it
416 may effect a total shutdown for the node.
417 .It Preshutdown of a node
418 This method is called before real shutdown, which is discussed below.
419 While in this method, the node is fully operational and can send a
420 .Dq goodbye
421 message to its peers, or it can exclude itself from the chain and reconnect
422 its peers together, like the
423 .Xr ng_tee 4
424 node type does.
425 .It Shutdown of a node
426 This method allows a node to clean up
427 and to ensure that any actions that need to be performed
428 at this time are taken.
429 The method is called by the generic (i.e., superclass)
430 node destructor which will get rid of the generic components of the node.
431 Some nodes (usually associated with a piece of hardware) may be
432 .Em persistent
433 in that a shutdown breaks all edges and resets the node,
434 but does not remove it.
435 In this case, the shutdown method should not
436 free its resources, but rather, clean up and then call the
437 .Fn NG_NODE_REVIVE
438 macro to signal the generic code that the shutdown is aborted.
439 In the case where the shutdown is started by the node itself due to hardware
440 removal or unloading (via
441 .Fn ng_rmnode_self ) ,
442 it should set the
443 .Dv NGF_REALLY_DIE
444 flag to signal to its own shutdown method that it is not to persist.
445 .El
446 .Ss Sending and Receiving Data
447 Two other methods are also supported by all nodes:
448 .Bl -tag -width 2n
449 .It Receive data message
450 A
451 .Nm
452 .Em queueable request item ,
453 usually referred to as an
454 .Em item ,
455 is received by this function.
456 The item contains a pointer to an
457 .Vt mbuf .
458 .Pp
459 The node is notified on which hook the item has arrived,
460 and can use this information in its processing decision.
461 The receiving node must always
462 .Fn NG_FREE_M
463 the
464 .Vt mbuf chain
465 on completion or error, or pass it on to another node
466 (or kernel module) which will then be responsible for freeing it.
467 Similarly, the
468 .Em item
469 must be freed if it is not to be passed on to another node, by using the
470 .Fn NG_FREE_ITEM
471 macro.
472 If the item still holds references to
473 .Vt mbufs
474 at the time of
475 freeing then they will also be appropriately freed.
476 Therefore, if there is any chance that the
477 .Vt mbuf
478 will be
479 changed or freed separately from the item, it is very important
480 that it be retrieved using the
481 .Fn NGI_GET_M
482 macro that also removes the reference within the item.
483 (Or multiple frees of the same object will occur.)
484 .Pp
485 If it is only required to examine the contents of the
486 .Vt mbufs ,
487 then it is possible to use the
488 .Fn NGI_M
489 macro to both read and rewrite
490 .Vt mbuf
491 pointer inside the item.
492 .Pp
493 If developer needs to pass any meta information along with the
494 .Vt mbuf chain ,
495 he should use
496 .Xr mbuf_tags 9
497 framework.
498 .Bf -symbolic
499 Note that old
500 .Nm
501 specific meta-data format is obsoleted now.
502 .Ef
503 .Pp
504 The receiving node may decide to defer the data by queueing it in the
505 .Nm
506 NETISR system (see below).
507 It achieves this by setting the
508 .Dv HK_QUEUE
509 flag in the flags word of the hook on which that data will arrive.
510 The infrastructure will respect that bit and queue the data for delivery at
511 a later time, rather than deliver it directly.
512 A node may decide to set
513 the bit on the
514 .Em peer
515 node, so that its own output packets are queued.
516 .Pp
517 The node may elect to nominate a different receive data function
518 for data received on a particular hook, to simplify coding.
519 It uses the
520 .Fn NG_HOOK_SET_RCVDATA hook fn
521 macro to do this.
522 The function receives the same arguments in every way
523 other than it will receive all (and only) packets from that hook.
524 .It Receive control message
525 This method is called when a control message is addressed to the node.
526 As with the received data, an
527 .Em item
528 is received, with a pointer to the control message.
529 The message can be examined using the
530 .Fn NGI_MSG
531 macro, or completely extracted from the item using the
532 .Fn NGI_GET_MSG
533 which also removes the reference within the item.
534 If the item still holds a reference to the message when it is freed
535 (using the
536 .Fn NG_FREE_ITEM
537 macro), then the message will also be freed appropriately.
538 If the
539 reference has been removed, the node must free the message itself using the
540 .Fn NG_FREE_MSG
541 macro.
542 A return address is always supplied, giving the address of the node
543 that originated the message so a reply message can be sent anytime later.
544 The return address is retrieved from the
545 .Em item
546 using the
547 .Fn NGI_RETADDR
548 macro and is of type
549 .Vt ng_ID_t .
550 All control messages and replies are
551 allocated with the
552 .Xr malloc 9
553 type
554 .Dv M_NETGRAPH_MSG ,
555 however it is more convenient to use the
556 .Fn NG_MKMESSAGE
557 and
558 .Fn NG_MKRESPONSE
559 macros to allocate and fill out a message.
560 Messages must be freed using the
561 .Fn NG_FREE_MSG
562 macro.
563 .Pp
564 If the message was delivered via a specific hook, that hook will
565 also be made known, which allows the use of such things as flow-control
566 messages, and status change messages, where the node may want to forward
567 the message out another hook to that on which it arrived.
568 .Pp
569 The node may elect to nominate a different receive message function
570 for messages received on a particular hook, to simplify coding.
571 It uses the
572 .Fn NG_HOOK_SET_RCVMSG hook fn
573 macro to do this.
574 The function receives the same arguments in every way
575 other than it will receive all (and only) messages from that hook.
576 .El
577 .Pp
578 Much use has been made of reference counts, so that nodes being
579 freed of all references are automatically freed, and this behaviour
580 has been tested and debugged to present a consistent and trustworthy
581 framework for the
582 .Dq type module
583 writer to use.
584 .Ss Addressing
585 The
586 .Nm
587 framework provides an unambiguous and simple to use method of specifically
588 addressing any single node in the graph.
589 The naming of a node is
590 independent of its type, in that another node, or external component
591 need not know anything about the node's type in order to address it so as
592 to send it a generic message type.
593 Node and hook names should be
594 chosen so as to make addresses meaningful.
595 .Pp
596 Addresses are either absolute or relative.
597 An absolute address begins
598 with a node name or ID, followed by a colon, followed by a sequence of hook
599 names separated by periods.
600 This addresses the node reached by starting
601 at the named node and following the specified sequence of hooks.
602 A relative address includes only the sequence of hook names, implicitly
603 starting hook traversal at the local node.
604 .Pp
605 There are a couple of special possibilities for the node name.
606 The name
607 .Ql .\&
608 (referred to as
609 .Ql .: )
610 always refers to the local node.
611 Also, nodes that have no global name may be addressed by their ID numbers,
612 by enclosing the hexadecimal representation of the ID number within
613 the square brackets.
614 Here are some examples of valid
615 .Nm
616 addresses:
617 .Bd -literal -offset indent
618 \&.:
619 [3f]:
620 foo:
621 \&.:hook1
622 foo:hook1.hook2
623 [d80]:hook1
624 .Ed
625 .Pp
626 The following set of nodes might be created for a site with
627 a single physical frame relay line having two active logical DLCI channels,
628 with RFC 1490 frames on DLCI 16 and PPP frames over DLCI 20:
629 .Bd -literal
630 [type SYNC ]                  [type FRAME]                 [type RFC1490]
631 [ "Frame1" ](uplink)<-->(data)[<un-named>](dlci16)<-->(mux)[<un-named>  ]
632 [    A     ]                  [    B     ](dlci20)<---+    [     C      ]
633                                                       |
634                                                       |      [ type PPP ]
635                                                       +>(mux)[<un-named>]
636                                                              [    D     ]
637 .Ed
638 .Pp
639 One could always send a control message to node C from anywhere
640 by using the name
641 .Dq Li Frame1:uplink.dlci16 .
642 In this case, node C would also be notified that the message
643 reached it via its hook
644 .Va mux .
645 Similarly,
646 .Dq Li Frame1:uplink.dlci20
647 could reliably be used to reach node D, and node A could refer
648 to node B as
649 .Dq Li .:uplink ,
650 or simply
651 .Dq Li uplink .
652 Conversely, B can refer to A as
653 .Dq Li data .
654 The address
655 .Dq Li mux.data
656 could be used by both nodes C and D to address a message to node A.
657 .Pp
658 Note that this is only for
659 .Em control messages .
660 In each of these cases, where a relative addressing mode is
661 used, the recipient is notified of the hook on which the
662 message arrived, as well as
663 the originating node.
664 This allows the option of hop-by-hop distribution of messages and
665 state information.
666 Data messages are
667 .Em only
668 routed one hop at a time, by specifying the departing
669 hook, with each node making
670 the next routing decision.
671 So when B receives a frame on hook
672 .Va data ,
673 it decodes the frame relay header to determine the DLCI,
674 and then forwards the unwrapped frame to either C or D.
675 .Pp
676 In a similar way, flow control messages may be routed in the reverse
677 direction to outgoing data.
678 For example a
679 .Dq "buffer nearly full"
680 message from
681 .Dq Li Frame1:
682 would be passed to node B
683 which might decide to send similar messages to both nodes
684 C and D.
685 The nodes would use
686 .Em "direct hook pointer"
687 addressing to route the messages.
688 The message may have travelled from
689 .Dq Li Frame1:
690 to B
691 as a synchronous reply, saving time and cycles.
692 .Ss Netgraph Structures
693 Structures are defined in
694 .In netgraph/netgraph.h
695 (for kernel structures only of interest to nodes)
696 and
697 .In netgraph/ng_message.h
698 (for message definitions also of interest to user programs).
699 .Pp
700 The two basic object types that are of interest to node authors are
701 .Em nodes
702 and
703 .Em hooks .
704 These two objects have the following
705 properties that are also of interest to the node writers.
706 .Bl -tag -width 2n
707 .It Vt "struct ng_node"
708 Node authors should always use the following
709 .Ic typedef
710 to declare
711 their pointers, and should never actually declare the structure.
712 .Pp
713 .Fd "typedef struct ng_node *node_p;"
714 .Pp
715 The following properties are associated with a node, and can be
716 accessed in the following manner:
717 .Bl -tag -width 2n
718 .It Validity
719 A driver or interrupt routine may want to check whether
720 the node is still valid.
721 It is assumed that the caller holds a reference
722 on the node so it will not have been freed, however it may have been
723 disabled or otherwise shut down.
724 Using the
725 .Fn NG_NODE_IS_VALID node
726 macro will return this state.
727 Eventually it should be almost impossible
728 for code to run in an invalid node but at this time that work has not been
729 completed.
730 .It Node ID Pq Vt ng_ID_t
731 This property can be retrieved using the macro
732 .Fn NG_NODE_ID node .
733 .It Node name
734 Optional globally unique name,
735 .Dv NUL
736 terminated string.
737 If there
738 is a value in here, it is the name of the node.
739 .Bd -literal -offset indent
740 if (NG_NODE_NAME(node)[0] != '\e0') ...
741
742 if (strcmp(NG_NODE_NAME(node), "fred") == 0) ...
743 .Ed
744 .It A node dependent opaque cookie
745 Anything of the pointer type can be placed here.
746 The macros
747 .Fn NG_NODE_SET_PRIVATE node value
748 and
749 .Fn NG_NODE_PRIVATE node
750 set and retrieve this property, respectively.
751 .It Number of hooks
752 The
753 .Fn NG_NODE_NUMHOOKS node
754 macro is used
755 to retrieve this value.
756 .It Hooks
757 The node may have a number of hooks.
758 A traversal method is provided to allow all the hooks to be
759 tested for some condition.
760 .Fn NG_NODE_FOREACH_HOOK node fn arg rethook
761 where
762 .Fa fn
763 is a function that will be called for each hook
764 with the form
765 .Fn fn hook arg
766 and returning 0 to terminate the search.
767 If the search is terminated, then
768 .Fa rethook
769 will be set to the hook at which the search was terminated.
770 .El
771 .It Vt "struct ng_hook"
772 Node authors should always use the following
773 .Ic typedef
774 to declare
775 their hook pointers.
776 .Pp
777 .Fd "typedef struct ng_hook *hook_p;"
778 .Pp
779 The following properties are associated with a hook, and can be
780 accessed in the following manner:
781 .Bl -tag -width 2n
782 .It A hook dependent opaque cookie
783 Anything of the pointer type can be placed here.
784 The macros
785 .Fn NG_HOOK_SET_PRIVATE hook value
786 and
787 .Fn NG_HOOK_PRIVATE hook
788 set and retrieve this property, respectively.
789 .It \&An associate node
790 The macro
791 .Fn NG_HOOK_NODE hook
792 finds the associated node.
793 .It A peer hook Pq Vt hook_p
794 The other hook in this connected pair.
795 The
796 .Fn NG_HOOK_PEER hook
797 macro finds the peer.
798 .It References
799 The
800 .Fn NG_HOOK_REF hook
801 and
802 .Fn NG_HOOK_UNREF hook
803 macros
804 increment and decrement the hook reference count accordingly.
805 After decrement you should always assume the hook has been freed
806 unless you have another reference still valid.
807 .It Override receive functions
808 The
809 .Fn NG_HOOK_SET_RCVDATA hook fn
810 and
811 .Fn NG_HOOK_SET_RCVMSG hook fn
812 macros can be used to set override methods that will be used in preference
813 to the generic receive data and receive message functions.
814 To unset these, use the macros to set them to
815 .Dv NULL .
816 They will only be used for data and
817 messages received on the hook on which they are set.
818 .El
819 .Pp
820 The maintenance of the names, reference counts, and linked list
821 of hooks for each node is handled automatically by the
822 .Nm
823 subsystem.
824 Typically a node's private info contains a back-pointer to the node or hook
825 structure, which counts as a new reference that must be included
826 in the reference count for the node.
827 When the node constructor is called,
828 there is already a reference for this calculated in, so that
829 when the node is destroyed, it should remember to do a
830 .Fn NG_NODE_UNREF
831 on the node.
832 .Pp
833 From a hook you can obtain the corresponding node, and from
834 a node, it is possible to traverse all the active hooks.
835 .Pp
836 A current example of how to define a node can always be seen in
837 .Pa src/sys/netgraph/ng_sample.c
838 and should be used as a starting point for new node writers.
839 .El
840 .Ss Netgraph Message Structure
841 Control messages have the following structure:
842 .Bd -literal
843 #define NG_CMDSTRSIZ    32      /* Max command string (including nul) */
844
845 struct ng_mesg {
846   struct ng_msghdr {
847     u_char      version;        /* Must equal NG_VERSION */
848     u_char      spare;          /* Pad to 2 bytes */
849     u_short     arglen;         /* Length of cmd/resp data */
850     u_long      flags;          /* Message status flags */
851     u_long      token;          /* Reply should have the same token */
852     u_long      typecookie;     /* Node type understanding this message */
853     u_long      cmd;            /* Command identifier */
854     u_char      cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */
855   } header;
856   char  data[0];                /* Start of cmd/resp data */
857 };
858
859 #define NG_ABI_VERSION  5               /* Netgraph kernel ABI version */
860 #define NG_VERSION      4               /* Netgraph message version */
861 #define NGF_ORIG        0x0000          /* Command */
862 #define NGF_RESP        0x0001          /* Response */
863 .Ed
864 .Pp
865 Control messages have the fixed header shown above, followed by a
866 variable length data section which depends on the type cookie
867 and the command.
868 Each field is explained below:
869 .Bl -tag -width indent
870 .It Va version
871 Indicates the version of the
872 .Nm
873 message protocol itself.
874 The current version is
875 .Dv NG_VERSION .
876 .It Va arglen
877 This is the length of any extra arguments, which begin at
878 .Va data .
879 .It Va flags
880 Indicates whether this is a command or a response control message.
881 .It Va token
882 The
883 .Va token
884 is a means by which a sender can match a reply message to the
885 corresponding command message; the reply always has the same token.
886 .It Va typecookie
887 The corresponding node type's unique 32-bit value.
888 If a node does not recognize the type cookie it must reject the message
889 by returning
890 .Er EINVAL .
891 .Pp
892 Each type should have an include file that defines the commands,
893 argument format, and cookie for its own messages.
894 The typecookie
895 ensures that the same header file was included by both sender and
896 receiver; when an incompatible change in the header file is made,
897 the typecookie
898 .Em must
899 be changed.
900 The de-facto method for generating unique type cookies is to take the
901 seconds from the Epoch at the time the header file is written
902 (i.e., the output of
903 .Dq Nm date Fl u Li +%s ) .
904 .Pp
905 There is a predefined typecookie
906 .Dv NGM_GENERIC_COOKIE
907 for the
908 .Vt generic
909 node type, and
910 a corresponding set of generic messages which all nodes understand.
911 The handling of these messages is automatic.
912 .It Va cmd
913 The identifier for the message command.
914 This is type specific,
915 and is defined in the same header file as the typecookie.
916 .It Va cmdstr
917 Room for a short human readable version of
918 .Va command
919 (for debugging purposes only).
920 .El
921 .Pp
922 Some modules may choose to implement messages from more than one
923 of the header files and thus recognize more than one type cookie.
924 .Ss Control Message ASCII Form
925 Control messages are in binary format for efficiency.
926 However, for
927 debugging and human interface purposes, and if the node type supports
928 it, control messages may be converted to and from an equivalent
929 .Tn ASCII
930 form.
931 The
932 .Tn ASCII
933 form is similar to the binary form, with two exceptions:
934 .Bl -enum
935 .It
936 The
937 .Va cmdstr
938 header field must contain the
939 .Tn ASCII
940 name of the command, corresponding to the
941 .Va cmd
942 header field.
943 .It
944 The arguments field contains a
945 .Dv NUL Ns
946 -terminated
947 .Tn ASCII
948 string version of the message arguments.
949 .El
950 .Pp
951 In general, the arguments field of a control message can be any
952 arbitrary C data type.
953 .Nm Netgraph
954 includes parsing routines to support
955 some pre-defined datatypes in
956 .Tn ASCII
957 with this simple syntax:
958 .Bl -bullet
959 .It
960 Integer types are represented by base 8, 10, or 16 numbers.
961 .It
962 Strings are enclosed in double quotes and respect the normal
963 C language backslash escapes.
964 .It
965 IP addresses have the obvious form.
966 .It
967 Arrays are enclosed in square brackets, with the elements listed
968 consecutively starting at index zero.
969 An element may have an optional index and equals sign
970 .Pq Ql =
971 preceding it.
972 Whenever an element
973 does not have an explicit index, the index is implicitly the previous
974 element's index plus one.
975 .It
976 Structures are enclosed in curly braces, and each field is specified
977 in the form
978 .Ar fieldname Ns = Ns Ar value .
979 .It
980 Any array element or structure field whose value is equal to its
981 .Dq default value
982 may be omitted.
983 For integer types, the default value
984 is usually zero; for string types, the empty string.
985 .It
986 Array elements and structure fields may be specified in any order.
987 .El
988 .Pp
989 Each node type may define its own arbitrary types by providing
990 the necessary routines to parse and unparse.
991 .Tn ASCII
992 forms defined
993 for a specific node type are documented in the corresponding man page.
994 .Ss Generic Control Messages
995 There are a number of standard predefined messages that will work
996 for any node, as they are supported directly by the framework itself.
997 These are defined in
998 .In netgraph/ng_message.h
999 along with the basic layout of messages and other similar information.
1000 .Bl -tag -width indent
1001 .It Dv NGM_CONNECT
1002 Connect to another node, using the supplied hook names on either end.
1003 .It Dv NGM_MKPEER
1004 Construct a node of the given type and then connect to it using the
1005 supplied hook names.
1006 .It Dv NGM_SHUTDOWN
1007 The target node should disconnect from all its neighbours and shut down.
1008 Persistent nodes such as those representing physical hardware
1009 might not disappear from the node namespace, but only reset themselves.
1010 The node must disconnect all of its hooks.
1011 This may result in neighbors shutting themselves down, and possibly a
1012 cascading shutdown of the entire connected graph.
1013 .It Dv NGM_NAME
1014 Assign a name to a node.
1015 Nodes can exist without having a name, and this
1016 is the default for nodes created using the
1017 .Dv NGM_MKPEER
1018 method.
1019 Such nodes can only be addressed relatively or by their ID number.
1020 .It Dv NGM_RMHOOK
1021 Ask the node to break a hook connection to one of its neighbours.
1022 Both nodes will have their
1023 .Dq disconnect
1024 method invoked.
1025 Either node may elect to totally shut down as a result.
1026 .It Dv NGM_NODEINFO
1027 Asks the target node to describe itself.
1028 The four returned fields
1029 are the node name (if named), the node type, the node ID and the
1030 number of hooks attached.
1031 The ID is an internal number unique to that node.
1032 .It Dv NGM_LISTHOOKS
1033 This returns the information given by
1034 .Dv NGM_NODEINFO ,
1035 but in addition
1036 includes an array of fields describing each link, and the description for
1037 the node at the far end of that link.
1038 .It Dv NGM_LISTNAMES
1039 This returns an array of node descriptions (as for
1040 .Dv NGM_NODEINFO )
1041 where each entry of the array describes a named node.
1042 All named nodes will be described.
1043 .It Dv NGM_LISTNODES
1044 This is the same as
1045 .Dv NGM_LISTNAMES
1046 except that all nodes are listed regardless of whether they have a name or not.
1047 .It Dv NGM_LISTTYPES
1048 This returns a list of all currently installed
1049 .Nm
1050 types.
1051 .It Dv NGM_TEXT_STATUS
1052 The node may return a text formatted status message.
1053 The status information is determined entirely by the node type.
1054 It is the only
1055 .Dq generic
1056 message
1057 that requires any support within the node itself and as such the node may
1058 elect to not support this message.
1059 The text response must be less than
1060 .Dv NG_TEXTRESPONSE
1061 bytes in length (presently 1024).
1062 This can be used to return general
1063 status information in human readable form.
1064 .It Dv NGM_BINARY2ASCII
1065 This message converts a binary control message to its
1066 .Tn ASCII
1067 form.
1068 The entire control message to be converted is contained within the
1069 arguments field of the
1070 .Dv NGM_BINARY2ASCII
1071 message itself.
1072 If successful, the reply will contain the same control
1073 message in
1074 .Tn ASCII
1075 form.
1076 A node will typically only know how to translate messages that it
1077 itself understands, so the target node of the
1078 .Dv NGM_BINARY2ASCII
1079 is often the same node that would actually receive that message.
1080 .It Dv NGM_ASCII2BINARY
1081 The opposite of
1082 .Dv NGM_BINARY2ASCII .
1083 The entire control message to be converted, in
1084 .Tn ASCII
1085 form, is contained
1086 in the arguments section of the
1087 .Dv NGM_ASCII2BINARY
1088 and need only have the
1089 .Va flags , cmdstr ,
1090 and
1091 .Va arglen
1092 header fields filled in, plus the
1093 .Dv NUL Ns
1094 -terminated string version of
1095 the arguments in the arguments field.
1096 If successful, the reply
1097 contains the binary version of the control message.
1098 .El
1099 .Ss Flow Control Messages
1100 In addition to the control messages that affect nodes with respect to the
1101 graph, there are also a number of
1102 .Em flow control
1103 messages defined.
1104 At present these are
1105 .Em not
1106 handled automatically by the system, so
1107 nodes need to handle them if they are going to be used in a graph utilising
1108 flow control, and will be in the likely path of these messages.
1109 The default action of a node that does not understand these messages should
1110 be to pass them onto the next node.
1111 Hopefully some helper functions will assist in this eventually.
1112 These messages are also defined in
1113 .In netgraph/ng_message.h
1114 and have a separate cookie
1115 .Dv NG_FLOW_COOKIE
1116 to help identify them.
1117 They will not be covered in depth here.
1118 .Sh INITIALIZATION
1119 The base
1120 .Nm
1121 code may either be statically compiled
1122 into the kernel or else loaded dynamically as a KLD via
1123 .Xr kldload 8 .
1124 In the former case, include
1125 .Pp
1126 .D1 Cd "options NETGRAPH"
1127 .Pp
1128 in your kernel configuration file.
1129 You may also include selected
1130 node types in the kernel compilation, for example:
1131 .Pp
1132 .D1 Cd "options NETGRAPH"
1133 .D1 Cd "options NETGRAPH_SOCKET"
1134 .D1 Cd "options NETGRAPH_ECHO"
1135 .Pp
1136 Once the
1137 .Nm
1138 subsystem is loaded, individual node types may be loaded at any time
1139 as KLD modules via
1140 .Xr kldload 8 .
1141 Moreover,
1142 .Nm
1143 knows how to automatically do this; when a request to create a new
1144 node of unknown type
1145 .Ar type
1146 is made,
1147 .Nm
1148 will attempt to load the KLD module
1149 .Pa ng_ Ns Ao Ar type Ac Ns Pa .ko .
1150 .Pp
1151 Types can also be installed at boot time, as certain device drivers
1152 may want to export each instance of the device as a
1153 .Nm
1154 node.
1155 .Pp
1156 In general, new types can be installed at any time from within the
1157 kernel by calling
1158 .Fn ng_newtype ,
1159 supplying a pointer to the type's
1160 .Vt "struct ng_type"
1161 structure.
1162 .Pp
1163 The
1164 .Fn NETGRAPH_INIT
1165 macro automates this process by using a linker set.
1166 .Sh EXISTING NODE TYPES
1167 Several node types currently exist.
1168 Each is fully documented in its own man page:
1169 .Bl -tag -width indent
1170 .It SOCKET
1171 The socket type implements two new sockets in the new protocol domain
1172 .Dv PF_NETGRAPH .
1173 The new sockets protocols are
1174 .Dv NG_DATA
1175 and
1176 .Dv NG_CONTROL ,
1177 both of type
1178 .Dv SOCK_DGRAM .
1179 Typically one of each is associated with a socket node.
1180 When both sockets have closed, the node will shut down.
1181 The
1182 .Dv NG_DATA
1183 socket is used for sending and receiving data, while the
1184 .Dv NG_CONTROL
1185 socket is used for sending and receiving control messages.
1186 Data and control messages are passed using the
1187 .Xr sendto 2
1188 and
1189 .Xr recvfrom 2
1190 system calls, using a
1191 .Vt "struct sockaddr_ng"
1192 socket address.
1193 .It HOLE
1194 Responds only to generic messages and is a
1195 .Dq black hole
1196 for data.
1197 Useful for testing.
1198 Always accepts new hooks.
1199 .It ECHO
1200 Responds only to generic messages and always echoes data back through the
1201 hook from which it arrived.
1202 Returns any non-generic messages as their own response.
1203 Useful for testing.
1204 Always accepts new hooks.
1205 .It TEE
1206 This node is useful for
1207 .Dq snooping .
1208 It has 4 hooks:
1209 .Va left , right , left2right ,
1210 and
1211 .Va right2left .
1212 Data entering from the
1213 .Va right
1214 is passed to the
1215 .Va left
1216 and duplicated on
1217 .Va right2left ,
1218 and data entering from the
1219 .Va left
1220 is passed to the
1221 .Va right
1222 and duplicated on
1223 .Va left2right .
1224 Data entering from
1225 .Va left2right
1226 is sent to the
1227 .Va right
1228 and data from
1229 .Va right2left
1230 to
1231 .Va left .
1232 .It RFC1490 MUX
1233 Encapsulates/de-encapsulates frames encoded according to RFC 1490.
1234 Has a hook for the encapsulated packets
1235 .Pq Va downstream
1236 and one hook
1237 for each protocol (i.e., IP, PPP, etc.).
1238 .It FRAME RELAY MUX
1239 Encapsulates/de-encapsulates Frame Relay frames.
1240 Has a hook for the encapsulated packets
1241 .Pq Va downstream
1242 and one hook
1243 for each DLCI.
1244 .It FRAME RELAY LMI
1245 Automatically handles frame relay
1246 .Dq LMI
1247 (link management interface) operations and packets.
1248 Automatically probes and detects which of several LMI standards
1249 is in use at the exchange.
1250 .It TTY
1251 This node is also a line discipline.
1252 It simply converts between
1253 .Vt mbuf
1254 frames and sequential serial data, allowing a TTY to appear as a
1255 .Nm
1256 node.
1257 It has a programmable
1258 .Dq hotkey
1259 character.
1260 .It ASYNC
1261 This node encapsulates and de-encapsulates asynchronous frames
1262 according to RFC 1662.
1263 This is used in conjunction with the TTY node
1264 type for supporting PPP links over asynchronous serial lines.
1265 .It ETHERNET
1266 This node is attached to every Ethernet interface in the system.
1267 It allows capturing raw Ethernet frames from the network, as well as
1268 sending frames out of the interface.
1269 .It INTERFACE
1270 This node is also a system networking interface.
1271 It has hooks representing
1272 each protocol family (IP, AppleTalk, IPX, etc.) and appears in the output of
1273 .Xr ifconfig 8 .
1274 The interfaces are named
1275 .Dq Li ng0 ,
1276 .Dq Li ng1 ,
1277 etc.
1278 .It ONE2MANY
1279 This node implements a simple round-robin multiplexer.
1280 It can be used
1281 for example to make several LAN ports act together to get a higher speed
1282 link between two machines.
1283 .It Various PPP related nodes
1284 There is a full multilink PPP implementation that runs in
1285 .Nm .
1286 The
1287 .Pa net/mpd
1288 port can use these modules to make a very low latency high
1289 capacity PPP system.
1290 It also supports
1291 .Tn PPTP
1292 VPNs using the PPTP node.
1293 .It PPPOE
1294 A server and client side implementation of PPPoE.
1295 Used in conjunction with
1296 either
1297 .Xr ppp 8
1298 or the
1299 .Pa net/mpd
1300 port.
1301 .It BRIDGE
1302 This node, together with the Ethernet nodes, allows a very flexible
1303 bridging system to be implemented.
1304 .It KSOCKET
1305 This intriguing node looks like a socket to the system but diverts
1306 all data to and from the
1307 .Nm
1308 system for further processing.
1309 This allows
1310 such things as UDP tunnels to be almost trivially implemented from the
1311 command line.
1312 .El
1313 .Pp
1314 Refer to the section at the end of this man page for more nodes types.
1315 .Sh NOTES
1316 Whether a named node exists can be checked by trying to send a control message
1317 to it (e.g.,
1318 .Dv NGM_NODEINFO ) .
1319 If it does not exist,
1320 .Er ENOENT
1321 will be returned.
1322 .Pp
1323 All data messages are
1324 .Vt mbuf chains
1325 with the
1326 .Dv M_PKTHDR
1327 flag set.
1328 .Pp
1329 Nodes are responsible for freeing what they allocate.
1330 There are three exceptions:
1331 .Bl -enum
1332 .It
1333 .Vt Mbufs
1334 sent across a data link are never to be freed by the sender.
1335 In the
1336 case of error, they should be considered freed.
1337 .It
1338 Messages sent using one of
1339 .Fn NG_SEND_MSG_*
1340 family macros are freed by the recipient.
1341 As in the case above, the addresses
1342 associated with the message are freed by whatever allocated them so the
1343 recipient should copy them if it wants to keep that information.
1344 .It
1345 Both control messages and data are delivered and queued with a
1346 .Nm
1347 .Em item .
1348 The item must be freed using
1349 .Fn NG_FREE_ITEM item
1350 or passed on to another node.
1351 .El
1352 .Sh FILES
1353 .Bl -tag -width indent
1354 .It In netgraph/netgraph.h
1355 Definitions for use solely within the kernel by
1356 .Nm
1357 nodes.
1358 .It In netgraph/ng_message.h
1359 Definitions needed by any file that needs to deal with
1360 .Nm
1361 messages.
1362 .It In netgraph/ng_socket.h
1363 Definitions needed to use
1364 .Nm
1365 .Vt socket
1366 type nodes.
1367 .It In netgraph/ng_ Ns Ao Ar type Ac Ns Pa .h
1368 Definitions needed to use
1369 .Nm
1370 .Ar type
1371 nodes, including the type cookie definition.
1372 .It Pa /boot/kernel/netgraph.ko
1373 The
1374 .Nm
1375 subsystem loadable KLD module.
1376 .It Pa /boot/kernel/ng_ Ns Ao Ar type Ac Ns Pa .ko
1377 Loadable KLD module for node type
1378 .Ar type .
1379 .It Pa src/sys/netgraph/ng_sample.c
1380 Skeleton
1381 .Nm
1382 node.
1383 Use this as a starting point for new node types.
1384 .El
1385 .Sh USER MODE SUPPORT
1386 There is a library for supporting user-mode programs that wish
1387 to interact with the
1388 .Nm
1389 system.
1390 See
1391 .Xr netgraph 3
1392 for details.
1393 .Pp
1394 Two user-mode support programs,
1395 .Xr ngctl 8
1396 and
1397 .Xr nghook 8 ,
1398 are available to assist manual configuration and debugging.
1399 .Pp
1400 There are a few useful techniques for debugging new node types.
1401 First, implementing new node types in user-mode first
1402 makes debugging easier.
1403 The
1404 .Vt tee
1405 node type is also useful for debugging, especially in conjunction with
1406 .Xr ngctl 8
1407 and
1408 .Xr nghook 8 .
1409 .Pp
1410 Also look in
1411 .Pa /usr/share/examples/netgraph
1412 for solutions to several
1413 common networking problems, solved using
1414 .Nm .
1415 .Sh SEE ALSO
1416 .Xr socket 2 ,
1417 .Xr netgraph 3 ,
1418 .Xr ng_async 4 ,
1419 .Xr ng_atm 4 ,
1420 .Xr ng_atmllc 4 ,
1421 .Xr ng_bluetooth 4 ,
1422 .Xr ng_bpf 4 ,
1423 .Xr ng_bridge 4 ,
1424 .Xr ng_bt3c 4 ,
1425 .Xr ng_btsocket 4 ,
1426 .Xr ng_cisco 4 ,
1427 .Xr ng_device 4 ,
1428 .Xr ng_echo 4 ,
1429 .Xr ng_eiface 4 ,
1430 .Xr ng_etf 4 ,
1431 .Xr ng_ether 4 ,
1432 .Xr ng_fec 4 ,
1433 .Xr ng_frame_relay 4 ,
1434 .Xr ng_gif 4 ,
1435 .Xr ng_gif_demux 4 ,
1436 .Xr ng_h4 4 ,
1437 .Xr ng_hci 4 ,
1438 .Xr ng_hole 4 ,
1439 .Xr ng_hub 4 ,
1440 .Xr ng_iface 4 ,
1441 .Xr ng_ip_input 4 ,
1442 .Xr ng_ksocket 4 ,
1443 .Xr ng_l2cap 4 ,
1444 .Xr ng_l2tp 4 ,
1445 .Xr ng_lmi 4 ,
1446 .Xr ng_mppc 4 ,
1447 .Xr ng_netflow 4 ,
1448 .Xr ng_one2many 4 ,
1449 .Xr ng_ppp 4 ,
1450 .Xr ng_pppoe 4 ,
1451 .Xr ng_pptpgre 4 ,
1452 .Xr ng_rfc1490 4 ,
1453 .Xr ng_socket 4 ,
1454 .Xr ng_split 4 ,
1455 .Xr ng_sppp 4 ,
1456 .Xr ng_sscfu 4 ,
1457 .Xr ng_sscop 4 ,
1458 .Xr ng_tee 4 ,
1459 .Xr ng_tty 4 ,
1460 .Xr ng_ubt 4 ,
1461 .Xr ng_UI 4 ,
1462 .Xr ng_uni 4 ,
1463 .Xr ng_vjc 4 ,
1464 .Xr ng_vlan 4 ,
1465 .Xr ngctl 8 ,
1466 .Xr nghook 8
1467 .Sh HISTORY
1468 The
1469 .Nm
1470 system was designed and first implemented at Whistle Communications, Inc.\&
1471 in a version of
1472 .Fx 2.2
1473 customized for the Whistle InterJet.
1474 It first made its debut in the main tree in
1475 .Fx 3.4 .
1476 .Sh AUTHORS
1477 .An -nosplit
1478 .An Julian Elischer Aq julian@FreeBSD.org ,
1479 with contributions by
1480 .An Archie Cobbs Aq archie@FreeBSD.org .