1999-10-21 09:06:11 +00:00
|
|
|
.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
|
|
|
|
.\" All rights reserved.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
1999-10-21 09:06:11 +00:00
|
|
|
.\" Subject to the following obligations and disclaimer of warranty, use and
|
|
|
|
.\" redistribution of this software, in source or object code forms, with or
|
|
|
|
.\" without modifications are expressly permitted by Whistle Communications;
|
|
|
|
.\" provided, however, that:
|
|
|
|
.\" 1. Any and all reproductions of the source or object code must include the
|
|
|
|
.\" copyright notice above and the following disclaimer of warranties; and
|
|
|
|
.\" 2. No rights are granted, in any manner or form, to use Whistle
|
|
|
|
.\" Communications, Inc. trademarks, including the mark "WHISTLE
|
|
|
|
.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
|
|
|
|
.\" such appears in the above copyright notice or in the software.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
1999-10-21 09:06:11 +00:00
|
|
|
.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
|
|
|
|
.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
|
|
|
|
.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
|
|
|
|
.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
|
|
|
|
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
|
|
|
.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
|
|
|
|
.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
|
|
|
|
.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
|
|
|
|
.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
|
|
|
|
.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
|
|
|
|
.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
|
|
.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
|
|
|
|
.\" OF SUCH DAMAGE.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
2000-10-26 15:30:44 +00:00
|
|
|
.\" Authors: Julian Elischer <julian@FreeBSD.org>
|
|
|
|
.\" Archie Cobbs <archie@FreeBSD.org>
|
1999-10-21 09:06:11 +00:00
|
|
|
.\"
|
|
|
|
.\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $
|
2004-07-02 08:52:09 +00:00
|
|
|
.\" $FreeBSD$
|
1999-10-21 09:06:11 +00:00
|
|
|
.\"
|
2004-07-02 06:05:04 +00:00
|
|
|
.Dd July 1, 2004
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dt NETGRAPH 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm netgraph
|
2004-07-02 08:52:09 +00:00
|
|
|
.Nd "graph based kernel networking subsystem"
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2001-07-14 19:41:16 +00:00
|
|
|
.Nm
|
1999-10-21 09:06:11 +00:00
|
|
|
system provides a uniform and modular system for the implementation
|
2004-07-02 08:52:09 +00:00
|
|
|
of kernel objects which perform various networking functions.
|
|
|
|
The objects, known as
|
1999-10-21 09:06:11 +00:00
|
|
|
.Em nodes ,
|
2004-07-02 08:52:09 +00:00
|
|
|
can be arranged into arbitrarily complicated graphs.
|
|
|
|
Nodes have
|
1999-10-21 09:06:11 +00:00
|
|
|
.Em hooks
|
|
|
|
which are used to connect two nodes together, forming the edges in the graph.
|
|
|
|
Nodes communicate along the edges to process data, implement protocols, etc.
|
|
|
|
.Pp
|
|
|
|
The aim of
|
2001-07-14 19:41:16 +00:00
|
|
|
.Nm
|
1999-10-21 09:06:11 +00:00
|
|
|
is to supplement rather than replace the existing kernel networking
|
2003-06-28 23:53:39 +00:00
|
|
|
infrastructure.
|
|
|
|
It provides:
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -bullet -compact
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
A flexible way of combining protocol and link level drivers.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
A modular way to implement new protocols.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
A common framework for kernel entities to inter-communicate.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
A reasonably fast, kernel-based implementation.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Nodes and Types
|
1999-10-21 09:06:11 +00:00
|
|
|
The most fundamental concept in
|
|
|
|
.Nm
|
|
|
|
is that of a
|
|
|
|
.Em node .
|
|
|
|
All nodes implement a number of predefined methods which allow them
|
|
|
|
to interact with other nodes in a well defined manner.
|
|
|
|
.Pp
|
|
|
|
Each node has a
|
|
|
|
.Em type ,
|
|
|
|
which is a static property of the node determined at node creation time.
|
1999-12-21 01:25:21 +00:00
|
|
|
A node's type is described by a unique
|
|
|
|
.Tn ASCII
|
|
|
|
type name.
|
1999-10-21 09:06:11 +00:00
|
|
|
The type implies what the node does and how it may be connected
|
|
|
|
to other nodes.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
In object-oriented language, types are classes, and nodes are instances
|
|
|
|
of their respective class.
|
|
|
|
All node types are subclasses of the generic node
|
1999-10-21 09:06:11 +00:00
|
|
|
type, and hence inherit certain common functionality and capabilities
|
1999-12-21 01:25:21 +00:00
|
|
|
(e.g., the ability to have an
|
|
|
|
.Tn ASCII
|
|
|
|
name).
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
1999-12-21 01:25:21 +00:00
|
|
|
Nodes may be assigned a globally unique
|
|
|
|
.Tn ASCII
|
|
|
|
name which can be
|
1999-10-21 09:06:11 +00:00
|
|
|
used to refer to the node.
|
1999-12-21 01:25:21 +00:00
|
|
|
The name must not contain the characters
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ql .\&
|
1999-12-21 01:25:21 +00:00
|
|
|
or
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ql \&: ,
|
1999-12-21 01:25:21 +00:00
|
|
|
and is limited to
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dv NG_NODESIZ
|
|
|
|
characters (including the terminating
|
|
|
|
.Dv NUL
|
|
|
|
character).
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2006-03-06 17:37:42 +00:00
|
|
|
Each node instance has a unique
|
|
|
|
.Em ID number
|
|
|
|
which is expressed as a 32-bit hexadecimal value.
|
|
|
|
This value may be used to refer to a node when there is no
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
name assigned to it.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Hooks
|
1999-10-21 09:06:11 +00:00
|
|
|
Nodes are connected to other nodes by connecting a pair of
|
|
|
|
.Em hooks ,
|
2004-07-02 08:52:09 +00:00
|
|
|
one from each node.
|
|
|
|
Data flows bidirectionally between nodes along
|
2003-06-28 23:53:39 +00:00
|
|
|
connected pairs of hooks.
|
|
|
|
A node may have as many hooks as it
|
1999-10-21 09:06:11 +00:00
|
|
|
needs, and may assign whatever meaning it wants to a hook.
|
|
|
|
.Pp
|
|
|
|
Hooks have these properties:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -bullet
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
1999-12-21 01:25:21 +00:00
|
|
|
A hook has an
|
|
|
|
.Tn ASCII
|
|
|
|
name which is unique among all hooks
|
1999-10-21 09:06:11 +00:00
|
|
|
on that node (other hooks on other nodes may have the same name).
|
2004-07-02 08:52:09 +00:00
|
|
|
The name must not contain the characters
|
|
|
|
.Ql .\&
|
|
|
|
or
|
|
|
|
.Ql \&: ,
|
1999-12-21 01:25:21 +00:00
|
|
|
and is
|
1999-10-21 09:06:11 +00:00
|
|
|
limited to
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dv NG_HOOKSIZ
|
|
|
|
characters (including the terminating
|
|
|
|
.Dv NUL
|
|
|
|
character).
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2003-06-28 23:53:39 +00:00
|
|
|
A hook is always connected to another hook.
|
|
|
|
That is, hooks are
|
1999-10-21 09:06:11 +00:00
|
|
|
created at the time they are connected, and breaking an edge by
|
|
|
|
removing either hook destroys both hooks.
|
2000-12-12 18:52:14 +00:00
|
|
|
.It
|
|
|
|
A hook can be set into a state where incoming packets are always queued
|
2003-06-28 23:53:39 +00:00
|
|
|
by the input queueing system, rather than being delivered directly.
|
2004-07-02 06:05:04 +00:00
|
|
|
This can be used when the data is sent from an interrupt handler,
|
|
|
|
and processing must be quick so as not to block other interrupts.
|
2001-01-31 20:46:00 +00:00
|
|
|
.It
|
2006-03-05 15:54:22 +00:00
|
|
|
A hook may supply overriding receive data and receive message functions,
|
2001-01-31 20:46:00 +00:00
|
|
|
which should be used for data and messages received through that hook
|
|
|
|
in preference to the general node-wide methods.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
A node may decide to assign special meaning to some hooks.
|
1999-12-21 01:25:21 +00:00
|
|
|
For example, connecting to the hook named
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va debug
|
1999-12-21 01:25:21 +00:00
|
|
|
might trigger
|
1999-10-21 09:06:11 +00:00
|
|
|
the node to start sending debugging information to that hook.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Data Flow
|
1999-10-21 09:06:11 +00:00
|
|
|
Two types of information flow between nodes: data messages and
|
2003-06-28 23:53:39 +00:00
|
|
|
control messages.
|
2004-07-02 08:52:09 +00:00
|
|
|
Data messages are passed in
|
|
|
|
.Vt mbuf chains
|
|
|
|
along the edges
|
2003-06-28 23:53:39 +00:00
|
|
|
in the graph, one edge at a time.
|
2004-07-02 08:52:09 +00:00
|
|
|
The first
|
|
|
|
.Vt mbuf
|
|
|
|
in a chain must have the
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dv M_PKTHDR
|
2004-07-02 08:52:09 +00:00
|
|
|
flag set.
|
2006-03-05 15:54:22 +00:00
|
|
|
Each node decides how to handle data received through one of its hooks.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2004-07-02 06:05:04 +00:00
|
|
|
Along with data, nodes can also receive control messages.
|
|
|
|
There are generic and type-specific control messages.
|
2003-06-28 23:53:39 +00:00
|
|
|
Control messages have a common
|
2006-03-05 15:54:22 +00:00
|
|
|
header format, followed by type-specific data, and are binary structures
|
2003-06-28 23:53:39 +00:00
|
|
|
for efficiency.
|
2004-07-02 08:52:09 +00:00
|
|
|
However, node types may also support conversion of the
|
2006-03-05 15:54:22 +00:00
|
|
|
type-specific data between binary and
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
2004-07-02 08:52:09 +00:00
|
|
|
formats,
|
1999-12-21 01:25:21 +00:00
|
|
|
for debugging and human interface purposes (see the
|
1999-11-30 02:45:32 +00:00
|
|
|
.Dv NGM_ASCII2BINARY
|
|
|
|
and
|
|
|
|
.Dv NGM_BINARY2ASCII
|
2003-06-28 23:53:39 +00:00
|
|
|
generic control messages below).
|
|
|
|
Nodes are not required to support these conversions.
|
1999-11-30 02:45:32 +00:00
|
|
|
.Pp
|
2003-06-28 23:53:39 +00:00
|
|
|
There are three ways to address a control message.
|
|
|
|
If there is a sequence of edges connecting the two nodes, the message
|
1999-12-21 01:25:21 +00:00
|
|
|
may be
|
|
|
|
.Dq source routed
|
|
|
|
by specifying the corresponding sequence
|
2001-07-14 19:41:16 +00:00
|
|
|
of
|
2000-12-12 18:52:14 +00:00
|
|
|
.Tn ASCII
|
|
|
|
hook names as the destination address for the message (relative
|
2003-06-28 23:53:39 +00:00
|
|
|
addressing).
|
|
|
|
If the destination is adjacent to the source, then the source
|
2000-12-12 18:52:14 +00:00
|
|
|
node may simply specify (as a pointer in the code) the hook across which the
|
2003-06-28 23:53:39 +00:00
|
|
|
message should be sent.
|
2006-03-05 15:54:22 +00:00
|
|
|
Otherwise, the recipient node's global
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
name
|
2006-03-06 17:37:42 +00:00
|
|
|
(or equivalent ID-based name) is used as the destination address
|
2003-06-28 23:53:39 +00:00
|
|
|
for the message (absolute addressing).
|
|
|
|
The two types of
|
2000-12-12 18:52:14 +00:00
|
|
|
.Tn ASCII
|
|
|
|
addressing
|
1999-10-21 09:06:11 +00:00
|
|
|
may be combined, by specifying an absolute start node and a sequence
|
2004-07-02 08:52:09 +00:00
|
|
|
of hooks.
|
|
|
|
Only the
|
2001-07-14 19:41:16 +00:00
|
|
|
.Tn ASCII
|
2006-03-05 15:54:22 +00:00
|
|
|
addressing modes are available to control programs outside the kernel;
|
|
|
|
use of direct pointers is limited to kernel modules.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2006-03-06 17:37:42 +00:00
|
|
|
Messages often represent commands that are followed by a reply message
|
2003-06-28 23:53:39 +00:00
|
|
|
in the reverse direction.
|
|
|
|
To facilitate this, the recipient of a
|
1999-12-21 01:25:21 +00:00
|
|
|
control message is supplied with a
|
|
|
|
.Dq return address
|
2001-07-14 19:41:16 +00:00
|
|
|
that is suitable for addressing a reply.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2006-03-05 15:54:22 +00:00
|
|
|
Each control message contains a 32-bit value, called a
|
|
|
|
.Dq typecookie ,
|
2006-03-06 17:37:42 +00:00
|
|
|
indicating the type of the message, i.e.\& how to interpret it.
|
1999-10-21 09:06:11 +00:00
|
|
|
Typically each type defines a unique typecookie for the messages
|
2003-06-28 23:53:39 +00:00
|
|
|
that it understands.
|
|
|
|
However, a node may choose to recognize and
|
2004-07-02 08:52:09 +00:00
|
|
|
implement more than one type of messages.
|
2000-04-30 10:01:11 +00:00
|
|
|
.Pp
|
2000-12-12 18:52:14 +00:00
|
|
|
If a message is delivered to an address that implies that it arrived
|
2004-07-02 08:52:09 +00:00
|
|
|
at that node through a particular hook (as opposed to having been directly
|
|
|
|
addressed using its ID or global name) then that hook is identified to the
|
2003-06-28 23:53:39 +00:00
|
|
|
receiving node.
|
2004-07-02 08:52:09 +00:00
|
|
|
This allows a message to be re-routed or passed on, should
|
2000-12-12 18:52:14 +00:00
|
|
|
a node decide that this is required, in much the same way that data packets
|
2004-07-02 08:52:09 +00:00
|
|
|
are passed around between nodes.
|
|
|
|
A set of standard
|
2000-12-12 18:52:14 +00:00
|
|
|
messages for flow control and link management purposes are
|
|
|
|
defined by the base system that are usually
|
2003-06-28 23:53:39 +00:00
|
|
|
passed around in this manner.
|
|
|
|
Flow control message would usually travel
|
2000-12-12 18:52:14 +00:00
|
|
|
in the opposite direction to the data to which they pertain.
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ss Netgraph is (Usually) Functional
|
1999-10-21 09:06:11 +00:00
|
|
|
In order to minimize latency, most
|
1999-12-21 01:25:21 +00:00
|
|
|
.Nm
|
1999-10-21 09:06:11 +00:00
|
|
|
operations are functional.
|
|
|
|
That is, data and control messages are delivered by making function
|
2003-06-28 23:53:39 +00:00
|
|
|
calls rather than by using queues and mailboxes.
|
|
|
|
For example, if node
|
2004-07-02 08:52:09 +00:00
|
|
|
A wishes to send a data
|
|
|
|
.Vt mbuf
|
|
|
|
to neighboring node B, it calls the
|
1999-10-21 09:06:11 +00:00
|
|
|
generic
|
|
|
|
.Nm
|
2003-06-28 23:53:39 +00:00
|
|
|
data delivery function.
|
|
|
|
This function in turn locates
|
1999-12-21 01:25:21 +00:00
|
|
|
node B and calls B's
|
|
|
|
.Dq receive data
|
2003-06-28 23:53:39 +00:00
|
|
|
method.
|
|
|
|
There are exceptions to this.
|
2000-04-30 10:01:11 +00:00
|
|
|
.Pp
|
2001-01-06 00:46:47 +00:00
|
|
|
Each node has an input queue, and some operations can be considered to
|
2004-07-02 08:52:09 +00:00
|
|
|
be
|
|
|
|
.Em writers
|
|
|
|
in that they alter the state of the node.
|
|
|
|
Obviously, in an SMP
|
2001-01-06 00:46:47 +00:00
|
|
|
world it would be bad if the state of a node were changed while another
|
2003-06-28 23:53:39 +00:00
|
|
|
data packet were transiting the node.
|
|
|
|
For this purpose, the input queue implements a
|
2001-01-06 00:46:47 +00:00
|
|
|
.Em reader/writer
|
|
|
|
semantic so that when there is a writer in the node, all other requests
|
|
|
|
are queued, and while there are readers, a writer, and any following
|
2003-06-28 23:53:39 +00:00
|
|
|
packets are queued.
|
|
|
|
In the case where there is no reason to queue the
|
2002-01-21 12:09:13 +00:00
|
|
|
data, the input method is called directly, as mentioned above.
|
2001-01-06 00:46:47 +00:00
|
|
|
.Pp
|
|
|
|
A node may declare that all requests should be considered as writers,
|
2001-07-14 19:41:16 +00:00
|
|
|
or that requests coming in over a particular hook should be considered to
|
2001-01-06 00:46:47 +00:00
|
|
|
be a writer, or even that packets leaving or entering across a particular
|
|
|
|
hook should always be queued, rather than delivered directly (often useful
|
|
|
|
for interrupt routines who want to get back to the hardware quickly).
|
2002-01-21 12:09:13 +00:00
|
|
|
By default, all control message packets are considered to be writers
|
2004-07-02 08:52:09 +00:00
|
|
|
unless specifically declared to be a reader in their definition.
|
|
|
|
(See
|
|
|
|
.Dv NGM_READONLY
|
|
|
|
in
|
|
|
|
.In ng_message.h . )
|
2000-04-30 10:01:11 +00:00
|
|
|
.Pp
|
|
|
|
While this mode of operation
|
1999-10-21 09:06:11 +00:00
|
|
|
results in good performance, it has a few implications for node
|
|
|
|
developers:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -bullet
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
|
|
|
Whenever a node delivers a data or control message, the node
|
2000-04-30 10:01:11 +00:00
|
|
|
may need to allow for the possibility of receiving a returning
|
|
|
|
message before the original delivery function call returns.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
.Nm Netgraph
|
2004-07-02 06:05:04 +00:00
|
|
|
provides internal synchronization between nodes.
|
|
|
|
Data always enters a
|
|
|
|
.Dq graph
|
|
|
|
at an
|
|
|
|
.Em edge node .
|
|
|
|
An
|
|
|
|
.Em edge node
|
|
|
|
is a node that interfaces between
|
|
|
|
.Nm
|
|
|
|
and some other part of the system.
|
|
|
|
Examples of
|
|
|
|
.Dq edge nodes
|
|
|
|
include device drivers, the
|
|
|
|
.Vt socket , ether , tty ,
|
|
|
|
and
|
|
|
|
.Vt ksocket
|
|
|
|
node type.
|
|
|
|
In these
|
|
|
|
.Em edge nodes ,
|
2004-07-02 08:52:09 +00:00
|
|
|
the calling thread directly executes code in the node, and from that code
|
2004-07-02 06:05:04 +00:00
|
|
|
calls upon the
|
|
|
|
.Nm
|
|
|
|
framework to deliver data across some edge
|
|
|
|
in the graph.
|
|
|
|
From an execution point of view, the calling thread will execute the
|
|
|
|
.Nm
|
|
|
|
framework methods, and if it can acquire a lock to do so,
|
|
|
|
the input methods of the next node.
|
|
|
|
This continues until either the data is discarded or queued for some
|
|
|
|
device or system entity, or the thread is unable to acquire a lock on
|
|
|
|
the next node.
|
|
|
|
In that case, the data is queued for the node, and execution rewinds
|
|
|
|
back to the original calling entity.
|
|
|
|
The queued data will be picked up and processed by either the current
|
|
|
|
holder of the lock when they have completed their operations, or by
|
|
|
|
a special
|
|
|
|
.Nm
|
|
|
|
thread that is activated when there are such items
|
|
|
|
queued.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It
|
2004-07-02 08:52:09 +00:00
|
|
|
It is possible for an infinite loop to occur if the graph contains cycles.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
So far, these issues have not proven problematical in practice.
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ss Interaction with Other Parts of the Kernel
|
1999-10-21 09:06:11 +00:00
|
|
|
A node may have a hidden interaction with other components of the
|
|
|
|
kernel outside of the
|
|
|
|
.Nm
|
|
|
|
subsystem, such as device hardware,
|
2004-07-02 08:52:09 +00:00
|
|
|
kernel protocol stacks, etc.
|
|
|
|
In fact, one of the benefits of
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
|
|
|
is the ability to join disparate kernel networking entities together in a
|
|
|
|
consistent communication framework.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
An example is the
|
|
|
|
.Vt socket
|
|
|
|
node type which is both a
|
|
|
|
.Nm
|
|
|
|
node and a
|
1999-10-21 09:06:11 +00:00
|
|
|
.Xr socket 2
|
2004-07-02 08:52:09 +00:00
|
|
|
in the protocol family
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dv PF_NETGRAPH .
|
|
|
|
Socket nodes allow user processes to participate in
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm .
|
1999-10-21 09:06:11 +00:00
|
|
|
Other nodes communicate with socket nodes using the usual methods, and the
|
|
|
|
node hides the fact that it is also passing information to and from a
|
|
|
|
cooperating user process.
|
|
|
|
.Pp
|
|
|
|
Another example is a device driver that presents
|
|
|
|
a node interface to the hardware.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Node Methods
|
1999-10-21 09:06:11 +00:00
|
|
|
Nodes are notified of the following actions via function calls
|
2004-07-02 08:52:09 +00:00
|
|
|
to the following node methods,
|
1999-10-21 09:06:11 +00:00
|
|
|
and may accept or reject that action (by returning the appropriate
|
|
|
|
error code):
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width 2n
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Creation of a new node
|
2004-07-02 06:05:04 +00:00
|
|
|
The constructor for the type is called.
|
|
|
|
If creation of a new node is allowed, constructor method may allocate any
|
|
|
|
special resources it needs.
|
|
|
|
For nodes that correspond to hardware, this is typically done during the
|
|
|
|
device attach routine.
|
|
|
|
Often a global
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
name corresponding to the
|
1999-10-21 09:06:11 +00:00
|
|
|
device name is assigned here as well.
|
|
|
|
.It Creation of a new hook
|
|
|
|
The hook is created and tentatively
|
2001-07-14 19:41:16 +00:00
|
|
|
linked to the node, and the node is told about the name that will be
|
2004-07-02 08:52:09 +00:00
|
|
|
used to describe this hook.
|
|
|
|
The node sets up any special data structures
|
1999-10-21 09:06:11 +00:00
|
|
|
it needs, or may reject the connection, based on the name of the hook.
|
|
|
|
.It Successful connection of two hooks
|
|
|
|
After both ends have accepted their
|
|
|
|
hooks, and the links have been made, the nodes get a chance to
|
2004-07-02 08:52:09 +00:00
|
|
|
find out who their peer is across the link, and can then decide to reject
|
|
|
|
the connection.
|
|
|
|
Tear-down is automatic.
|
|
|
|
This is also the time at which
|
2001-07-14 19:41:16 +00:00
|
|
|
a node may decide whether to set a particular hook (or its peer) into
|
2004-07-02 08:52:09 +00:00
|
|
|
the
|
2001-08-25 21:58:58 +00:00
|
|
|
.Em queueing
|
2000-12-12 18:52:14 +00:00
|
|
|
mode.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Destruction of a hook
|
2004-07-02 08:52:09 +00:00
|
|
|
The node is notified of a broken connection.
|
|
|
|
The node may consider some hooks
|
1999-10-21 09:06:11 +00:00
|
|
|
to be critical to operation and others to be expendable: the disconnection
|
|
|
|
of one hook may be an acceptable event while for another it
|
2004-07-02 08:52:09 +00:00
|
|
|
may effect a total shutdown for the node.
|
2004-07-02 06:05:04 +00:00
|
|
|
.It Preshutdown of a node
|
|
|
|
This method is called before real shutdown, which is discussed below.
|
|
|
|
While in this method, the node is fully operational and can send a
|
|
|
|
.Dq goodbye
|
|
|
|
message to its peers, or it can exclude itself from the chain and reconnect
|
|
|
|
its peers together, like the
|
|
|
|
.Xr ng_tee 4
|
|
|
|
node type does.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Shutdown of a node
|
|
|
|
This method allows a node to clean up
|
|
|
|
and to ensure that any actions that need to be performed
|
2004-07-02 08:52:09 +00:00
|
|
|
at this time are taken.
|
|
|
|
The method is called by the generic (i.e., superclass)
|
2001-01-31 20:46:00 +00:00
|
|
|
node destructor which will get rid of the generic components of the node.
|
1999-10-21 09:06:11 +00:00
|
|
|
Some nodes (usually associated with a piece of hardware) may be
|
|
|
|
.Em persistent
|
|
|
|
in that a shutdown breaks all edges and resets the node,
|
2004-07-02 08:52:09 +00:00
|
|
|
but does not remove it.
|
|
|
|
In this case, the shutdown method should not
|
2004-07-20 17:15:38 +00:00
|
|
|
free its resources, but rather, clean up and then call the
|
2005-01-12 10:14:43 +00:00
|
|
|
.Fn NG_NODE_REVIVE
|
2004-07-20 17:15:38 +00:00
|
|
|
macro to signal the generic code that the shutdown is aborted.
|
2004-07-02 08:52:09 +00:00
|
|
|
In the case where the shutdown is started by the node itself due to hardware
|
|
|
|
removal or unloading (via
|
|
|
|
.Fn ng_rmnode_self ) ,
|
|
|
|
it should set the
|
2004-07-20 17:15:38 +00:00
|
|
|
.Dv NGF_REALLY_DIE
|
2001-04-15 19:53:47 +00:00
|
|
|
flag to signal to its own shutdown method that it is not to persist.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Sending and Receiving Data
|
2000-12-12 18:52:14 +00:00
|
|
|
Two other methods are also supported by all nodes:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width 2n
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Receive data message
|
2001-01-06 00:46:47 +00:00
|
|
|
A
|
2004-07-02 08:52:09 +00:00
|
|
|
.Nm
|
|
|
|
.Em queueable request item ,
|
2002-01-21 12:09:13 +00:00
|
|
|
usually referred to as an
|
2001-01-31 20:46:00 +00:00
|
|
|
.Em item ,
|
2004-07-02 06:05:04 +00:00
|
|
|
is received by this function.
|
2004-07-02 08:52:09 +00:00
|
|
|
The item contains a pointer to an
|
|
|
|
.Vt mbuf .
|
2001-01-06 00:46:47 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
The node is notified on which hook the item has arrived,
|
1999-10-21 09:06:11 +00:00
|
|
|
and can use this information in its processing decision.
|
2001-07-14 19:41:16 +00:00
|
|
|
The receiving node must always
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NG_FREE_M
|
2004-07-02 08:52:09 +00:00
|
|
|
the
|
|
|
|
.Vt mbuf chain
|
|
|
|
on completion or error, or pass it on to another node
|
1999-10-21 09:06:11 +00:00
|
|
|
(or kernel module) which will then be responsible for freeing it.
|
2004-07-02 08:52:09 +00:00
|
|
|
Similarly, the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Em item
|
|
|
|
must be freed if it is not to be passed on to another node, by using the
|
|
|
|
.Fn NG_FREE_ITEM
|
2004-07-02 06:05:04 +00:00
|
|
|
macro.
|
2004-07-02 08:52:09 +00:00
|
|
|
If the item still holds references to
|
|
|
|
.Vt mbufs
|
|
|
|
at the time of
|
2002-01-21 12:09:13 +00:00
|
|
|
freeing then they will also be appropriately freed.
|
2004-07-02 08:52:09 +00:00
|
|
|
Therefore, if there is any chance that the
|
|
|
|
.Vt mbuf
|
|
|
|
will be
|
2002-01-21 12:09:13 +00:00
|
|
|
changed or freed separately from the item, it is very important
|
2004-07-02 06:05:04 +00:00
|
|
|
that it be retrieved using the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NGI_GET_M
|
2004-07-02 06:05:04 +00:00
|
|
|
macro that also removes the reference within the item.
|
|
|
|
(Or multiple frees of the same object will occur.)
|
2001-01-06 00:46:47 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
If it is only required to examine the contents of the
|
|
|
|
.Vt mbufs ,
|
2004-07-02 06:05:04 +00:00
|
|
|
then it is possible to use the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NGI_M
|
2004-07-02 08:52:09 +00:00
|
|
|
macro to both read and rewrite
|
|
|
|
.Vt mbuf
|
|
|
|
pointer inside the item.
|
2004-07-02 06:05:04 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
If developer needs to pass any meta information along with the
|
|
|
|
.Vt mbuf chain ,
|
2004-07-02 06:05:04 +00:00
|
|
|
he should use
|
|
|
|
.Xr mbuf_tags 9
|
|
|
|
framework.
|
|
|
|
.Bf -symbolic
|
2004-07-02 08:52:09 +00:00
|
|
|
Note that old
|
2004-07-02 06:05:04 +00:00
|
|
|
.Nm
|
2004-07-02 08:52:09 +00:00
|
|
|
specific meta-data format is obsoleted now.
|
2004-07-02 06:05:04 +00:00
|
|
|
.Ef
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2001-08-25 21:57:02 +00:00
|
|
|
The receiving node may decide to defer the data by queueing it in the
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
2004-07-02 08:52:09 +00:00
|
|
|
NETISR system (see below).
|
|
|
|
It achieves this by setting the
|
2000-12-12 18:52:14 +00:00
|
|
|
.Dv HK_QUEUE
|
|
|
|
flag in the flags word of the hook on which that data will arrive.
|
2001-07-14 19:41:16 +00:00
|
|
|
The infrastructure will respect that bit and queue the data for delivery at
|
2004-07-02 08:52:09 +00:00
|
|
|
a later time, rather than deliver it directly.
|
|
|
|
A node may decide to set
|
2000-12-12 18:52:14 +00:00
|
|
|
the bit on the
|
|
|
|
.Em peer
|
2004-07-02 06:05:04 +00:00
|
|
|
node, so that its own output packets are queued.
|
2001-01-31 20:46:00 +00:00
|
|
|
.Pp
|
|
|
|
The node may elect to nominate a different receive data function
|
2004-07-02 08:52:09 +00:00
|
|
|
for data received on a particular hook, to simplify coding.
|
|
|
|
It uses the
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_HOOK_SET_RCVDATA hook fn
|
2004-07-02 08:52:09 +00:00
|
|
|
macro to do this.
|
|
|
|
The function receives the same arguments in every way
|
2001-01-31 20:46:00 +00:00
|
|
|
other than it will receive all (and only) packets from that hook.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Receive control message
|
|
|
|
This method is called when a control message is addressed to the node.
|
2001-01-06 00:46:47 +00:00
|
|
|
As with the received data, an
|
|
|
|
.Em item
|
2002-01-21 12:09:13 +00:00
|
|
|
is received, with a pointer to the control message.
|
2001-07-14 19:41:16 +00:00
|
|
|
The message can be examined using the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NGI_MSG
|
|
|
|
macro, or completely extracted from the item using the
|
|
|
|
.Fn NGI_GET_MSG
|
|
|
|
which also removes the reference within the item.
|
|
|
|
If the Item still holds a reference to the message when it is freed
|
2001-07-14 19:41:16 +00:00
|
|
|
(using the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NG_FREE_ITEM
|
2004-07-02 08:52:09 +00:00
|
|
|
macro), then the message will also be freed appropriately.
|
|
|
|
If the
|
|
|
|
reference has been removed, the node must free the message itself using the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NG_FREE_MSG
|
|
|
|
macro.
|
1999-10-21 09:06:11 +00:00
|
|
|
A return address is always supplied, giving the address of the node
|
|
|
|
that originated the message so a reply message can be sent anytime later.
|
2001-01-06 00:46:47 +00:00
|
|
|
The return address is retrieved from the
|
|
|
|
.Em item
|
|
|
|
using the
|
|
|
|
.Fn NGI_RETADDR
|
2001-07-14 19:41:16 +00:00
|
|
|
macro and is of type
|
2004-07-02 08:52:09 +00:00
|
|
|
.Vt ng_ID_t .
|
2001-01-06 00:46:47 +00:00
|
|
|
All control messages and replies are
|
2004-07-02 08:52:09 +00:00
|
|
|
allocated with the
|
|
|
|
.Xr malloc 9
|
1999-10-21 09:06:11 +00:00
|
|
|
type
|
2001-01-06 00:46:47 +00:00
|
|
|
.Dv M_NETGRAPH_MSG ,
|
2004-07-02 08:52:09 +00:00
|
|
|
however it is more convenient to use the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NG_MKMESSAGE
|
|
|
|
and
|
|
|
|
.Fn NG_MKRESPONSE
|
|
|
|
macros to allocate and fill out a message.
|
2001-07-14 19:41:16 +00:00
|
|
|
Messages must be freed using the
|
2001-01-06 00:46:47 +00:00
|
|
|
.Fn NG_FREE_MSG
|
|
|
|
macro.
|
2000-04-30 10:01:11 +00:00
|
|
|
.Pp
|
|
|
|
If the message was delivered via a specific hook, that hook will
|
|
|
|
also be made known, which allows the use of such things as flow-control
|
|
|
|
messages, and status change messages, where the node may want to forward
|
|
|
|
the message out another hook to that on which it arrived.
|
2001-01-31 20:46:00 +00:00
|
|
|
.Pp
|
|
|
|
The node may elect to nominate a different receive message function
|
2004-07-02 08:52:09 +00:00
|
|
|
for messages received on a particular hook, to simplify coding.
|
|
|
|
It uses the
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_HOOK_SET_RCVMSG hook fn
|
2004-07-02 08:52:09 +00:00
|
|
|
macro to do this.
|
|
|
|
The function receives the same arguments in every way
|
2001-01-31 20:46:00 +00:00
|
|
|
other than it will receive all (and only) messages from that hook.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Much use has been made of reference counts, so that nodes being
|
2004-07-02 08:52:09 +00:00
|
|
|
freed of all references are automatically freed, and this behaviour
|
1999-10-21 09:06:11 +00:00
|
|
|
has been tested and debugged to present a consistent and trustworthy
|
1999-12-21 01:25:21 +00:00
|
|
|
framework for the
|
|
|
|
.Dq type module
|
|
|
|
writer to use.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Addressing
|
2001-07-14 19:41:16 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
|
|
|
framework provides an unambiguous and simple to use method of specifically
|
2004-07-02 08:52:09 +00:00
|
|
|
addressing any single node in the graph.
|
|
|
|
The naming of a node is
|
1999-10-21 09:06:11 +00:00
|
|
|
independent of its type, in that another node, or external component
|
2001-07-14 19:41:16 +00:00
|
|
|
need not know anything about the node's type in order to address it so as
|
2004-07-02 08:52:09 +00:00
|
|
|
to send it a generic message type.
|
|
|
|
Node and hook names should be
|
1999-10-21 09:06:11 +00:00
|
|
|
chosen so as to make addresses meaningful.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
Addresses are either absolute or relative.
|
|
|
|
An absolute address begins
|
|
|
|
with a node name or ID, followed by a colon, followed by a sequence of hook
|
|
|
|
names separated by periods.
|
|
|
|
This addresses the node reached by starting
|
1999-10-21 09:06:11 +00:00
|
|
|
at the named node and following the specified sequence of hooks.
|
|
|
|
A relative address includes only the sequence of hook names, implicitly
|
|
|
|
starting hook traversal at the local node.
|
|
|
|
.Pp
|
|
|
|
There are a couple of special possibilities for the node name.
|
1999-12-21 01:25:21 +00:00
|
|
|
The name
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ql .\&
|
1999-12-21 01:25:21 +00:00
|
|
|
(referred to as
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ql .: )
|
1999-12-21 01:25:21 +00:00
|
|
|
always refers to the local node.
|
1999-10-21 09:06:11 +00:00
|
|
|
Also, nodes that have no global name may be addressed by their ID numbers,
|
2004-07-02 08:52:09 +00:00
|
|
|
by enclosing the hexadecimal representation of the ID number within
|
|
|
|
the square brackets.
|
|
|
|
Here are some examples of valid
|
|
|
|
.Nm
|
|
|
|
addresses:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
\&.:
|
|
|
|
[3f]:
|
|
|
|
foo:
|
|
|
|
\&.:hook1
|
|
|
|
foo:hook1.hook2
|
|
|
|
[d80]:hook1
|
1999-10-21 09:06:11 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
The following set of nodes might be created for a site with
|
1999-10-21 09:06:11 +00:00
|
|
|
a single physical frame relay line having two active logical DLCI channels,
|
2004-07-02 08:52:09 +00:00
|
|
|
with RFC 1490 frames on DLCI 16 and PPP frames over DLCI 20:
|
1999-10-21 09:06:11 +00:00
|
|
|
.Bd -literal
|
|
|
|
[type SYNC ] [type FRAME] [type RFC1490]
|
|
|
|
[ "Frame1" ](uplink)<-->(data)[<un-named>](dlci16)<-->(mux)[<un-named> ]
|
|
|
|
[ A ] [ B ](dlci20)<---+ [ C ]
|
|
|
|
|
|
|
|
|
| [ type PPP ]
|
|
|
|
+>(mux)[<un-named>]
|
|
|
|
[ D ]
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
One could always send a control message to node C from anywhere
|
|
|
|
by using the name
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li Frame1:uplink.dlci16 .
|
2000-04-30 10:01:11 +00:00
|
|
|
In this case, node C would also be notified that the message
|
2001-07-14 19:41:16 +00:00
|
|
|
reached it via its hook
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va mux .
|
2001-07-14 19:41:16 +00:00
|
|
|
Similarly,
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li Frame1:uplink.dlci20
|
1999-10-21 09:06:11 +00:00
|
|
|
could reliably be used to reach node D, and node A could refer
|
|
|
|
to node B as
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li .:uplink ,
|
1999-10-21 09:06:11 +00:00
|
|
|
or simply
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li uplink .
|
1999-10-21 09:06:11 +00:00
|
|
|
Conversely, B can refer to A as
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li data .
|
1999-10-21 09:06:11 +00:00
|
|
|
The address
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li mux.data
|
1999-10-21 09:06:11 +00:00
|
|
|
could be used by both nodes C and D to address a message to node A.
|
|
|
|
.Pp
|
|
|
|
Note that this is only for
|
|
|
|
.Em control messages .
|
2000-04-30 10:01:11 +00:00
|
|
|
In each of these cases, where a relative addressing mode is
|
|
|
|
used, the recipient is notified of the hook on which the
|
2001-07-14 19:41:16 +00:00
|
|
|
message arrived, as well as
|
2000-04-30 10:01:11 +00:00
|
|
|
the originating node.
|
2002-01-21 12:09:13 +00:00
|
|
|
This allows the option of hop-by-hop distribution of messages and
|
2000-04-30 10:01:11 +00:00
|
|
|
state information.
|
2001-07-14 19:41:16 +00:00
|
|
|
Data messages are
|
2000-04-30 10:01:11 +00:00
|
|
|
.Em only
|
|
|
|
routed one hop at a time, by specifying the departing
|
|
|
|
hook, with each node making
|
2004-07-02 08:52:09 +00:00
|
|
|
the next routing decision.
|
|
|
|
So when B receives a frame on hook
|
|
|
|
.Va data ,
|
1999-10-21 09:06:11 +00:00
|
|
|
it decodes the frame relay header to determine the DLCI,
|
|
|
|
and then forwards the unwrapped frame to either C or D.
|
2000-12-12 18:52:14 +00:00
|
|
|
.Pp
|
|
|
|
In a similar way, flow control messages may be routed in the reverse
|
2004-07-02 08:52:09 +00:00
|
|
|
direction to outgoing data.
|
|
|
|
For example a
|
|
|
|
.Dq "buffer nearly full"
|
|
|
|
message from
|
|
|
|
.Dq Li Frame1:
|
|
|
|
would be passed to node B
|
2000-12-12 18:52:14 +00:00
|
|
|
which might decide to send similar messages to both nodes
|
2004-07-02 08:52:09 +00:00
|
|
|
C and D.
|
2001-07-14 19:41:16 +00:00
|
|
|
The nodes would use
|
2004-07-02 08:52:09 +00:00
|
|
|
.Em "direct hook pointer"
|
|
|
|
addressing to route the messages.
|
|
|
|
The message may have travelled from
|
|
|
|
.Dq Li Frame1:
|
|
|
|
to B
|
2000-12-12 18:52:14 +00:00
|
|
|
as a synchronous reply, saving time and cycles.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
A similar graph might be used to represent multi-link PPP running
|
|
|
|
over an ISDN line:
|
|
|
|
.Bd -literal
|
|
|
|
[ type BRI ](B1)<--->(link1)[ type MPP ]
|
|
|
|
[ "ISDN1" ](B2)<--->(link2)[ (no name) ]
|
|
|
|
[ ](D) <-+
|
|
|
|
|
|
|
|
|
+----------------+
|
|
|
|
|
|
|
|
|
+->(switch)[ type Q.921 ](term1)<---->(datalink)[ type Q.931 ]
|
|
|
|
[ (no name) ] [ (no name) ]
|
|
|
|
.Ed
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Netgraph Structures
|
2001-07-14 19:41:16 +00:00
|
|
|
Structures are defined in
|
2004-07-02 08:52:09 +00:00
|
|
|
.In netgraph/netgraph.h
|
2002-01-21 12:09:13 +00:00
|
|
|
(for kernel structures only of interest to nodes)
|
2001-01-06 00:46:47 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.In netgraph/ng_message.h
|
2001-01-06 00:46:47 +00:00
|
|
|
(for message definitions also of interest to user programs).
|
2001-01-09 15:20:58 +00:00
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
The two basic object types that are of interest to node authors are
|
2001-01-08 05:34:06 +00:00
|
|
|
.Em nodes
|
|
|
|
and
|
|
|
|
.Em hooks .
|
|
|
|
These two objects have the following
|
|
|
|
properties that are also of interest to the node writers.
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It Vt "struct ng_node"
|
|
|
|
Node authors should always use the following
|
|
|
|
.Ic typedef
|
|
|
|
to declare
|
2001-01-08 05:34:06 +00:00
|
|
|
their pointers, and should never actually declare the structure.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fd "typedef struct ng_node *node_p;"
|
2001-01-08 05:34:06 +00:00
|
|
|
.Pp
|
|
|
|
The following properties are associated with a node, and can be
|
|
|
|
accessed in the following manner:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It Validity
|
2001-01-08 05:34:06 +00:00
|
|
|
A driver or interrupt routine may want to check whether
|
2004-07-02 08:52:09 +00:00
|
|
|
the node is still valid.
|
|
|
|
It is assumed that the caller holds a reference
|
2001-01-08 05:34:06 +00:00
|
|
|
on the node so it will not have been freed, however it may have been
|
2004-07-02 08:52:09 +00:00
|
|
|
disabled or otherwise shut down.
|
|
|
|
Using the
|
|
|
|
.Fn NG_NODE_IS_VALID node
|
|
|
|
macro will return this state.
|
|
|
|
Eventually it should be almost impossible
|
2001-01-08 05:34:06 +00:00
|
|
|
for code to run in an invalid node but at this time that work has not been
|
|
|
|
completed.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Node ID Pq Vt ng_ID_t
|
2001-07-14 19:41:16 +00:00
|
|
|
This property can be retrieved using the macro
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fn NG_NODE_ID node .
|
|
|
|
.It Node name
|
|
|
|
Optional globally unique name,
|
|
|
|
.Dv NUL
|
|
|
|
terminated string.
|
|
|
|
If there
|
2001-01-06 00:46:47 +00:00
|
|
|
is a value in here, it is the name of the node.
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
if (NG_NODE_NAME(node)[0] != '\e0') ...
|
|
|
|
|
|
|
|
if (strcmp(NG_NODE_NAME(node), "fred") == 0) ...
|
|
|
|
.Ed
|
|
|
|
.It A node dependent opaque cookie
|
|
|
|
Anything of the pointer type can be placed here.
|
|
|
|
The macros
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_NODE_SET_PRIVATE node value
|
2001-01-08 05:34:06 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fn NG_NODE_PRIVATE node
|
|
|
|
set and retrieve this property, respectively.
|
|
|
|
.It Number of hooks
|
|
|
|
The
|
|
|
|
.Fn NG_NODE_NUMHOOKS node
|
|
|
|
macro is used
|
2001-01-08 05:34:06 +00:00
|
|
|
to retrieve this value.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Hooks
|
2001-01-08 05:34:06 +00:00
|
|
|
The node may have a number of hooks.
|
|
|
|
A traversal method is provided to allow all the hooks to be
|
|
|
|
tested for some condition.
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_NODE_FOREACH_HOOK node fn arg rethook
|
2004-07-02 08:52:09 +00:00
|
|
|
where
|
|
|
|
.Fa fn
|
|
|
|
is a function that will be called for each hook
|
2001-01-08 05:34:06 +00:00
|
|
|
with the form
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn fn hook arg
|
2004-07-02 08:52:09 +00:00
|
|
|
and returning 0 to terminate the search.
|
|
|
|
If the search is terminated, then
|
|
|
|
.Fa rethook
|
2001-01-08 05:34:06 +00:00
|
|
|
will be set to the hook at which the search was terminated.
|
2001-01-06 00:46:47 +00:00
|
|
|
.El
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Vt "struct ng_hook"
|
|
|
|
Node authors should always use the following
|
|
|
|
.Ic typedef
|
|
|
|
to declare
|
2001-01-08 05:34:06 +00:00
|
|
|
their hook pointers.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fd "typedef struct ng_hook *hook_p;"
|
2001-01-08 05:34:06 +00:00
|
|
|
.Pp
|
|
|
|
The following properties are associated with a hook, and can be
|
|
|
|
accessed in the following manner:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It A hook dependent opaque cookie
|
|
|
|
Anything of the pointer type can be placed here.
|
|
|
|
The macros
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_HOOK_SET_PRIVATE hook value
|
2001-01-08 05:34:06 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fn NG_HOOK_PRIVATE hook
|
|
|
|
set and retrieve this property, respectively.
|
|
|
|
.It \&An associate node
|
|
|
|
The macro
|
|
|
|
.Fn NG_HOOK_NODE hook
|
|
|
|
finds the associated node.
|
|
|
|
.It A peer hook Pq Vt hook_p
|
|
|
|
The other hook in this connected pair.
|
|
|
|
The
|
|
|
|
.Fn NG_HOOK_PEER hook
|
|
|
|
macro finds the peer.
|
|
|
|
.It References
|
|
|
|
The
|
|
|
|
.Fn NG_HOOK_REF hook
|
2001-01-08 05:34:06 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fn NG_HOOK_UNREF hook
|
|
|
|
macros
|
2001-01-08 05:34:06 +00:00
|
|
|
increment and decrement the hook reference count accordingly.
|
2001-01-30 20:51:52 +00:00
|
|
|
After decrement you should always assume the hook has been freed
|
|
|
|
unless you have another reference still valid.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Override receive functions
|
2001-01-31 20:46:00 +00:00
|
|
|
The
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_HOOK_SET_RCVDATA hook fn
|
2001-01-31 20:46:00 +00:00
|
|
|
and
|
2001-02-01 16:38:02 +00:00
|
|
|
.Fn NG_HOOK_SET_RCVMSG hook fn
|
2004-07-02 08:52:09 +00:00
|
|
|
macros can be used to set override methods that will be used in preference
|
|
|
|
to the generic receive data and receive message functions.
|
|
|
|
To unset these, use the macros to set them to
|
|
|
|
.Dv NULL .
|
|
|
|
They will only be used for data and
|
2001-01-31 20:46:00 +00:00
|
|
|
messages received on the hook on which they are set.
|
2001-01-06 00:46:47 +00:00
|
|
|
.El
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2001-01-06 00:46:47 +00:00
|
|
|
The maintenance of the names, reference counts, and linked list
|
1999-10-21 09:06:11 +00:00
|
|
|
of hooks for each node is handled automatically by the
|
|
|
|
.Nm
|
|
|
|
subsystem.
|
|
|
|
Typically a node's private info contains a back-pointer to the node or hook
|
2001-01-06 00:46:47 +00:00
|
|
|
structure, which counts as a new reference that must be included
|
2004-07-02 08:52:09 +00:00
|
|
|
in the reference count for the node.
|
|
|
|
When the node constructor is called,
|
2001-01-06 00:46:47 +00:00
|
|
|
there is already a reference for this calculated in, so that
|
|
|
|
when the node is destroyed, it should remember to do a
|
2001-01-08 05:34:06 +00:00
|
|
|
.Fn NG_NODE_UNREF
|
2001-01-06 00:46:47 +00:00
|
|
|
on the node.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
From a hook you can obtain the corresponding node, and from
|
2001-01-08 05:34:06 +00:00
|
|
|
a node, it is possible to traverse all the active hooks.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
A current example of how to define a node can always be seen in
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pa src/sys/netgraph/ng_sample.c
|
2001-01-06 00:46:47 +00:00
|
|
|
and should be used as a starting point for new node writers.
|
2001-01-09 15:20:58 +00:00
|
|
|
.El
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Netgraph Message Structure
|
1999-10-21 09:06:11 +00:00
|
|
|
Control messages have the following structure:
|
|
|
|
.Bd -literal
|
2003-11-12 13:24:03 +00:00
|
|
|
#define NG_CMDSTRSIZ 32 /* Max command string (including nul) */
|
1999-10-21 09:06:11 +00:00
|
|
|
|
|
|
|
struct ng_mesg {
|
|
|
|
struct ng_msghdr {
|
|
|
|
u_char version; /* Must equal NG_VERSION */
|
|
|
|
u_char spare; /* Pad to 2 bytes */
|
|
|
|
u_short arglen; /* Length of cmd/resp data */
|
|
|
|
u_long flags; /* Message status flags */
|
|
|
|
u_long token; /* Reply should have the same token */
|
|
|
|
u_long typecookie; /* Node type understanding this message */
|
|
|
|
u_long cmd; /* Command identifier */
|
2003-11-12 13:24:03 +00:00
|
|
|
u_char cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */
|
1999-10-21 09:06:11 +00:00
|
|
|
} header;
|
|
|
|
char data[0]; /* Start of cmd/resp data */
|
|
|
|
};
|
|
|
|
|
2000-12-18 20:03:32 +00:00
|
|
|
#define NG_ABI_VERSION 5 /* Netgraph kernel ABI version */
|
|
|
|
#define NG_VERSION 4 /* Netgraph message version */
|
1999-10-21 09:06:11 +00:00
|
|
|
#define NGF_ORIG 0x0000 /* Command */
|
|
|
|
#define NGF_RESP 0x0001 /* Response */
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
Control messages have the fixed header shown above, followed by a
|
1999-10-21 09:06:11 +00:00
|
|
|
variable length data section which depends on the type cookie
|
2004-07-02 08:52:09 +00:00
|
|
|
and the command.
|
|
|
|
Each field is explained below:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Va version
|
|
|
|
Indicates the version of the
|
|
|
|
.Nm
|
|
|
|
message protocol itself.
|
|
|
|
The current version is
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dv NG_VERSION .
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Va arglen
|
1999-10-21 09:06:11 +00:00
|
|
|
This is the length of any extra arguments, which begin at
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va data .
|
|
|
|
.It Va flags
|
1999-10-21 09:06:11 +00:00
|
|
|
Indicates whether this is a command or a response control message.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Va token
|
1999-10-21 09:06:11 +00:00
|
|
|
The
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va token
|
1999-10-21 09:06:11 +00:00
|
|
|
is a means by which a sender can match a reply message to the
|
|
|
|
corresponding command message; the reply always has the same token.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Va typecookie
|
1999-10-21 09:06:11 +00:00
|
|
|
The corresponding node type's unique 32-bit value.
|
2004-07-02 08:52:09 +00:00
|
|
|
If a node does not recognize the type cookie it must reject the message
|
1999-10-21 09:06:11 +00:00
|
|
|
by returning
|
|
|
|
.Er EINVAL .
|
|
|
|
.Pp
|
|
|
|
Each type should have an include file that defines the commands,
|
|
|
|
argument format, and cookie for its own messages.
|
|
|
|
The typecookie
|
|
|
|
insures that the same header file was included by both sender and
|
|
|
|
receiver; when an incompatible change in the header file is made,
|
|
|
|
the typecookie
|
|
|
|
.Em must
|
|
|
|
be changed.
|
2004-07-02 08:52:09 +00:00
|
|
|
The de-facto method for generating unique type cookies is to take the
|
|
|
|
seconds from the Epoch at the time the header file is written
|
1999-10-21 09:06:11 +00:00
|
|
|
(i.e., the output of
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Nm date Fl u Li +%s ) .
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
There is a predefined typecookie
|
|
|
|
.Dv NGM_GENERIC_COOKIE
|
1999-12-21 01:25:21 +00:00
|
|
|
for the
|
2004-07-02 08:52:09 +00:00
|
|
|
.Vt generic
|
1999-12-21 01:25:21 +00:00
|
|
|
node type, and
|
1999-10-21 09:06:11 +00:00
|
|
|
a corresponding set of generic messages which all nodes understand.
|
|
|
|
The handling of these messages is automatic.
|
2004-07-18 02:42:38 +00:00
|
|
|
.It Va cmd
|
2004-07-02 08:52:09 +00:00
|
|
|
The identifier for the message command.
|
|
|
|
This is type specific,
|
1999-10-21 09:06:11 +00:00
|
|
|
and is defined in the same header file as the typecookie.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Va cmdstr
|
1999-12-21 01:25:21 +00:00
|
|
|
Room for a short human readable version of
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va command
|
1999-12-21 01:25:21 +00:00
|
|
|
(for debugging purposes only).
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
Some modules may choose to implement messages from more than one
|
|
|
|
of the header files and thus recognize more than one type cookie.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Control Message ASCII Form
|
2004-07-02 08:52:09 +00:00
|
|
|
Control messages are in binary format for efficiency.
|
|
|
|
However, for
|
1999-11-30 02:45:32 +00:00
|
|
|
debugging and human interface purposes, and if the node type supports
|
1999-12-21 01:25:21 +00:00
|
|
|
it, control messages may be converted to and from an equivalent
|
|
|
|
.Tn ASCII
|
2004-07-02 08:52:09 +00:00
|
|
|
form.
|
|
|
|
The
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
form is similar to the binary form, with two exceptions:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
The
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va cmdstr
|
1999-12-21 01:25:21 +00:00
|
|
|
header field must contain the
|
|
|
|
.Tn ASCII
|
|
|
|
name of the command, corresponding to the
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va cmd
|
1999-11-30 02:45:32 +00:00
|
|
|
header field.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
|
|
|
The arguments field contains a
|
|
|
|
.Dv NUL Ns
|
|
|
|
-terminated
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
string version of the message arguments.
|
1999-11-30 02:45:32 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2002-01-21 12:09:13 +00:00
|
|
|
In general, the arguments field of a control message can be any
|
2004-07-02 08:52:09 +00:00
|
|
|
arbitrary C data type.
|
|
|
|
.Nm Netgraph
|
|
|
|
includes parsing routines to support
|
1999-12-21 01:25:21 +00:00
|
|
|
some pre-defined datatypes in
|
|
|
|
.Tn ASCII
|
|
|
|
with this simple syntax:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -bullet
|
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Integer types are represented by base 8, 10, or 16 numbers.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Strings are enclosed in double quotes and respect the normal
|
|
|
|
C language backslash escapes.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
IP addresses have the obvious form.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Arrays are enclosed in square brackets, with the elements listed
|
2004-07-02 08:52:09 +00:00
|
|
|
consecutively starting at index zero.
|
|
|
|
An element may have an optional index and equals sign
|
|
|
|
.Pq Ql =
|
|
|
|
preceding it.
|
|
|
|
Whenever an element
|
1999-11-30 02:45:32 +00:00
|
|
|
does not have an explicit index, the index is implicitly the previous
|
|
|
|
element's index plus one.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Structures are enclosed in curly braces, and each field is specified
|
2001-07-14 19:41:16 +00:00
|
|
|
in the form
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ar fieldname Ns = Ns Ar value .
|
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Any array element or structure field whose value is equal to its
|
1999-12-21 01:25:21 +00:00
|
|
|
.Dq default value
|
2004-07-02 08:52:09 +00:00
|
|
|
may be omitted.
|
|
|
|
For integer types, the default value
|
1999-11-30 02:45:32 +00:00
|
|
|
is usually zero; for string types, the empty string.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
1999-11-30 02:45:32 +00:00
|
|
|
Array elements and structure fields may be specified in any order.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Each node type may define its own arbitrary types by providing
|
1999-12-21 01:25:21 +00:00
|
|
|
the necessary routines to parse and unparse.
|
|
|
|
.Tn ASCII
|
|
|
|
forms defined
|
2004-07-02 08:52:09 +00:00
|
|
|
for a specific node type are documented in the corresponding man page.
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Generic Control Messages
|
1999-10-21 09:06:11 +00:00
|
|
|
There are a number of standard predefined messages that will work
|
|
|
|
for any node, as they are supported directly by the framework itself.
|
|
|
|
These are defined in
|
2004-07-02 08:52:09 +00:00
|
|
|
.In netgraph/ng_message.h
|
1999-10-21 09:06:11 +00:00
|
|
|
along with the basic layout of messages and other similar information.
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width indent
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Dv NGM_CONNECT
|
|
|
|
Connect to another node, using the supplied hook names on either end.
|
|
|
|
.It Dv NGM_MKPEER
|
|
|
|
Construct a node of the given type and then connect to it using the
|
|
|
|
supplied hook names.
|
|
|
|
.It Dv NGM_SHUTDOWN
|
|
|
|
The target node should disconnect from all its neighbours and shut down.
|
|
|
|
Persistent nodes such as those representing physical hardware
|
1999-10-30 20:30:19 +00:00
|
|
|
might not disappear from the node namespace, but only reset themselves.
|
1999-10-21 09:06:11 +00:00
|
|
|
The node must disconnect all of its hooks.
|
|
|
|
This may result in neighbors shutting themselves down, and possibly a
|
|
|
|
cascading shutdown of the entire connected graph.
|
|
|
|
.It Dv NGM_NAME
|
2004-07-02 08:52:09 +00:00
|
|
|
Assign a name to a node.
|
|
|
|
Nodes can exist without having a name, and this
|
1999-10-21 09:06:11 +00:00
|
|
|
is the default for nodes created using the
|
|
|
|
.Dv NGM_MKPEER
|
2004-07-02 08:52:09 +00:00
|
|
|
method.
|
|
|
|
Such nodes can only be addressed relatively or by their ID number.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Dv NGM_RMHOOK
|
|
|
|
Ask the node to break a hook connection to one of its neighbours.
|
1999-12-21 01:25:21 +00:00
|
|
|
Both nodes will have their
|
|
|
|
.Dq disconnect
|
|
|
|
method invoked.
|
1999-10-21 09:06:11 +00:00
|
|
|
Either node may elect to totally shut down as a result.
|
|
|
|
.It Dv NGM_NODEINFO
|
2004-07-02 08:52:09 +00:00
|
|
|
Asks the target node to describe itself.
|
|
|
|
The four returned fields
|
1999-10-21 09:06:11 +00:00
|
|
|
are the node name (if named), the node type, the node ID and the
|
2004-07-02 08:52:09 +00:00
|
|
|
number of hooks attached.
|
|
|
|
The ID is an internal number unique to that node.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Dv NGM_LISTHOOKS
|
|
|
|
This returns the information given by
|
|
|
|
.Dv NGM_NODEINFO ,
|
2001-07-14 19:41:16 +00:00
|
|
|
but in addition
|
1999-10-30 20:30:19 +00:00
|
|
|
includes an array of fields describing each link, and the description for
|
1999-10-21 09:06:11 +00:00
|
|
|
the node at the far end of that link.
|
|
|
|
.It Dv NGM_LISTNAMES
|
|
|
|
This returns an array of node descriptions (as for
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dv NGM_NODEINFO )
|
1999-10-21 09:06:11 +00:00
|
|
|
where each entry of the array describes a named node.
|
|
|
|
All named nodes will be described.
|
|
|
|
.It Dv NGM_LISTNODES
|
|
|
|
This is the same as
|
|
|
|
.Dv NGM_LISTNAMES
|
|
|
|
except that all nodes are listed regardless of whether they have a name or not.
|
|
|
|
.It Dv NGM_LISTTYPES
|
2004-07-02 08:52:09 +00:00
|
|
|
This returns a list of all currently installed
|
|
|
|
.Nm
|
|
|
|
types.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It Dv NGM_TEXT_STATUS
|
|
|
|
The node may return a text formatted status message.
|
|
|
|
The status information is determined entirely by the node type.
|
2004-07-02 08:52:09 +00:00
|
|
|
It is the only
|
|
|
|
.Dq generic
|
|
|
|
message
|
1999-10-21 09:06:11 +00:00
|
|
|
that requires any support within the node itself and as such the node may
|
2004-07-02 08:52:09 +00:00
|
|
|
elect to not support this message.
|
|
|
|
The text response must be less than
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dv NG_TEXTRESPONSE
|
2004-07-02 08:52:09 +00:00
|
|
|
bytes in length (presently 1024).
|
|
|
|
This can be used to return general
|
1999-10-21 09:06:11 +00:00
|
|
|
status information in human readable form.
|
1999-11-30 02:45:32 +00:00
|
|
|
.It Dv NGM_BINARY2ASCII
|
1999-12-21 01:25:21 +00:00
|
|
|
This message converts a binary control message to its
|
|
|
|
.Tn ASCII
|
|
|
|
form.
|
1999-11-30 02:45:32 +00:00
|
|
|
The entire control message to be converted is contained within the
|
|
|
|
arguments field of the
|
2001-02-28 17:38:53 +00:00
|
|
|
.Dv NGM_BINARY2ASCII
|
2004-07-02 08:52:09 +00:00
|
|
|
message itself.
|
|
|
|
If successful, the reply will contain the same control
|
1999-12-21 01:25:21 +00:00
|
|
|
message in
|
|
|
|
.Tn ASCII
|
|
|
|
form.
|
1999-11-30 02:45:32 +00:00
|
|
|
A node will typically only know how to translate messages that it
|
1999-11-30 06:47:54 +00:00
|
|
|
itself understands, so the target node of the
|
1999-11-30 02:45:32 +00:00
|
|
|
.Dv NGM_BINARY2ASCII
|
|
|
|
is often the same node that would actually receive that message.
|
|
|
|
.It Dv NGM_ASCII2BINARY
|
|
|
|
The opposite of
|
|
|
|
.Dv NGM_BINARY2ASCII .
|
1999-12-21 01:25:21 +00:00
|
|
|
The entire control message to be converted, in
|
|
|
|
.Tn ASCII
|
|
|
|
form, is contained
|
1999-11-30 02:45:32 +00:00
|
|
|
in the arguments section of the
|
|
|
|
.Dv NGM_ASCII2BINARY
|
|
|
|
and need only have the
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va flags , cmdstr ,
|
1999-11-30 02:45:32 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va arglen
|
|
|
|
header fields filled in, plus the
|
|
|
|
.Dv NUL Ns
|
|
|
|
-terminated string version of
|
|
|
|
the arguments in the arguments field.
|
|
|
|
If successful, the reply
|
1999-11-30 02:45:32 +00:00
|
|
|
contains the binary version of the control message.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
2003-06-28 23:53:39 +00:00
|
|
|
.Ss Flow Control Messages
|
2000-12-12 18:52:14 +00:00
|
|
|
In addition to the control messages that affect nodes with respect to the
|
2001-07-14 19:41:16 +00:00
|
|
|
graph, there are also a number of
|
2004-07-02 08:52:09 +00:00
|
|
|
.Em flow control
|
|
|
|
messages defined.
|
|
|
|
At present these are
|
|
|
|
.Em not
|
2000-12-12 18:52:14 +00:00
|
|
|
handled automatically by the system, so
|
|
|
|
nodes need to handle them if they are going to be used in a graph utilising
|
2003-06-28 23:53:39 +00:00
|
|
|
flow control, and will be in the likely path of these messages.
|
2004-07-02 08:52:09 +00:00
|
|
|
The default action of a node that does not understand these messages should
|
2003-06-28 23:53:39 +00:00
|
|
|
be to pass them onto the next node.
|
|
|
|
Hopefully some helper functions will assist in this eventually.
|
|
|
|
These messages are also defined in
|
2004-07-02 08:52:09 +00:00
|
|
|
.In netgraph/ng_message.h
|
2000-12-12 18:52:14 +00:00
|
|
|
and have a separate cookie
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dv NG_FLOW_COOKIE
|
2003-06-28 23:53:39 +00:00
|
|
|
to help identify them.
|
|
|
|
They will not be covered in depth here.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh INITIALIZATION
|
|
|
|
The base
|
|
|
|
.Nm
|
|
|
|
code may either be statically compiled
|
|
|
|
into the kernel or else loaded dynamically as a KLD via
|
|
|
|
.Xr kldload 8 .
|
|
|
|
In the former case, include
|
2000-12-29 09:18:45 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
.D1 Cd "options NETGRAPH"
|
2000-12-29 09:18:45 +00:00
|
|
|
.Pp
|
2003-06-28 23:53:39 +00:00
|
|
|
in your kernel configuration file.
|
|
|
|
You may also include selected
|
1999-10-21 09:06:11 +00:00
|
|
|
node types in the kernel compilation, for example:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pp
|
|
|
|
.D1 Cd "options NETGRAPH"
|
|
|
|
.D1 Cd "options NETGRAPH_SOCKET"
|
|
|
|
.D1 Cd "options NETGRAPH_ECHO"
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
Once the
|
|
|
|
.Nm
|
|
|
|
subsystem is loaded, individual node types may be loaded at any time
|
|
|
|
as KLD modules via
|
|
|
|
.Xr kldload 8 .
|
|
|
|
Moreover,
|
|
|
|
.Nm
|
|
|
|
knows how to automatically do this; when a request to create a new
|
|
|
|
node of unknown type
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ar type
|
1999-10-21 09:06:11 +00:00
|
|
|
is made,
|
|
|
|
.Nm
|
|
|
|
will attempt to load the KLD module
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pa ng_ Ns Ao Ar type Ac Ns Pa .ko .
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
Types can also be installed at boot time, as certain device drivers
|
2004-07-02 08:52:09 +00:00
|
|
|
may want to export each instance of the device as a
|
|
|
|
.Nm
|
|
|
|
node.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
In general, new types can be installed at any time from within the
|
|
|
|
kernel by calling
|
1999-12-21 01:25:21 +00:00
|
|
|
.Fn ng_newtype ,
|
1999-10-21 09:06:11 +00:00
|
|
|
supplying a pointer to the type's
|
2004-07-02 08:52:09 +00:00
|
|
|
.Vt "struct ng_type"
|
1999-10-21 09:06:11 +00:00
|
|
|
structure.
|
|
|
|
.Pp
|
|
|
|
The
|
1999-12-21 01:25:21 +00:00
|
|
|
.Fn NETGRAPH_INIT
|
1999-10-21 09:06:11 +00:00
|
|
|
macro automates this process by using a linker set.
|
|
|
|
.Sh EXISTING NODE TYPES
|
2003-06-28 23:53:39 +00:00
|
|
|
Several node types currently exist.
|
|
|
|
Each is fully documented in its own man page:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width indent
|
1999-10-21 09:06:11 +00:00
|
|
|
.It SOCKET
|
|
|
|
The socket type implements two new sockets in the new protocol domain
|
|
|
|
.Dv PF_NETGRAPH .
|
|
|
|
The new sockets protocols are
|
|
|
|
.Dv NG_DATA
|
|
|
|
and
|
|
|
|
.Dv NG_CONTROL ,
|
|
|
|
both of type
|
|
|
|
.Dv SOCK_DGRAM .
|
|
|
|
Typically one of each is associated with a socket node.
|
2003-06-28 23:53:39 +00:00
|
|
|
When both sockets have closed, the node will shut down.
|
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dv NG_DATA
|
|
|
|
socket is used for sending and receiving data, while the
|
|
|
|
.Dv NG_CONTROL
|
|
|
|
socket is used for sending and receiving control messages.
|
|
|
|
Data and control messages are passed using the
|
|
|
|
.Xr sendto 2
|
|
|
|
and
|
|
|
|
.Xr recvfrom 2
|
2004-07-02 08:52:09 +00:00
|
|
|
system calls, using a
|
|
|
|
.Vt "struct sockaddr_ng"
|
1999-10-21 09:06:11 +00:00
|
|
|
socket address.
|
|
|
|
.It HOLE
|
1999-12-21 01:25:21 +00:00
|
|
|
Responds only to generic messages and is a
|
|
|
|
.Dq black hole
|
2004-07-02 08:52:09 +00:00
|
|
|
for data.
|
|
|
|
Useful for testing.
|
|
|
|
Always accepts new hooks.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It ECHO
|
|
|
|
Responds only to generic messages and always echoes data back through the
|
2004-07-02 08:52:09 +00:00
|
|
|
hook from which it arrived.
|
|
|
|
Returns any non-generic messages as their own response.
|
|
|
|
Useful for testing.
|
|
|
|
Always accepts new hooks.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It TEE
|
1999-12-21 01:25:21 +00:00
|
|
|
This node is useful for
|
|
|
|
.Dq snooping .
|
|
|
|
It has 4 hooks:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va left , right , left2right ,
|
1999-10-21 09:06:11 +00:00
|
|
|
and
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va right2left .
|
|
|
|
Data entering from the
|
|
|
|
.Va right
|
|
|
|
is passed to the
|
|
|
|
.Va left
|
|
|
|
and duplicated on
|
|
|
|
.Va right2left ,
|
|
|
|
and data entering from the
|
|
|
|
.Va left
|
|
|
|
is passed to the
|
|
|
|
.Va right
|
|
|
|
and duplicated on
|
|
|
|
.Va left2right .
|
1999-10-21 09:06:11 +00:00
|
|
|
Data entering from
|
2004-07-02 08:52:09 +00:00
|
|
|
.Va left2right
|
|
|
|
is sent to the
|
|
|
|
.Va right
|
|
|
|
and data from
|
|
|
|
.Va right2left
|
|
|
|
to
|
|
|
|
.Va left .
|
1999-10-21 09:06:11 +00:00
|
|
|
.It RFC1490 MUX
|
|
|
|
Encapsulates/de-encapsulates frames encoded according to RFC 1490.
|
1999-12-21 01:25:21 +00:00
|
|
|
Has a hook for the encapsulated packets
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pq Va downstream
|
1999-12-21 01:25:21 +00:00
|
|
|
and one hook
|
1999-10-21 09:06:11 +00:00
|
|
|
for each protocol (i.e., IP, PPP, etc.).
|
|
|
|
.It FRAME RELAY MUX
|
|
|
|
Encapsulates/de-encapsulates Frame Relay frames.
|
1999-12-21 01:25:21 +00:00
|
|
|
Has a hook for the encapsulated packets
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pq Va downstream
|
1999-12-21 01:25:21 +00:00
|
|
|
and one hook
|
1999-10-21 09:06:11 +00:00
|
|
|
for each DLCI.
|
|
|
|
.It FRAME RELAY LMI
|
|
|
|
Automatically handles frame relay
|
1999-12-21 01:25:21 +00:00
|
|
|
.Dq LMI
|
|
|
|
(link management interface) operations and packets.
|
1999-10-30 20:30:19 +00:00
|
|
|
Automatically probes and detects which of several LMI standards
|
1999-10-21 09:06:11 +00:00
|
|
|
is in use at the exchange.
|
|
|
|
.It TTY
|
2004-07-02 08:52:09 +00:00
|
|
|
This node is also a line discipline.
|
|
|
|
It simply converts between
|
|
|
|
.Vt mbuf
|
|
|
|
frames and sequential serial data, allowing a TTY to appear as a
|
|
|
|
.Nm
|
|
|
|
node.
|
|
|
|
It has a programmable
|
1999-12-21 01:25:21 +00:00
|
|
|
.Dq hotkey
|
|
|
|
character.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It ASYNC
|
|
|
|
This node encapsulates and de-encapsulates asynchronous frames
|
2004-07-02 08:52:09 +00:00
|
|
|
according to RFC 1662.
|
|
|
|
This is used in conjunction with the TTY node
|
1999-10-21 09:06:11 +00:00
|
|
|
type for supporting PPP links over asynchronous serial lines.
|
2004-07-02 06:05:04 +00:00
|
|
|
.It ETHERNET
|
|
|
|
This node is attached to every Ethernet interface in the system.
|
|
|
|
It allows capturing raw Ethernet frames from the network, as well as
|
|
|
|
sending frames out of the interface.
|
1999-10-21 09:06:11 +00:00
|
|
|
.It INTERFACE
|
2004-07-02 08:52:09 +00:00
|
|
|
This node is also a system networking interface.
|
|
|
|
It has hooks representing
|
1999-10-21 09:06:11 +00:00
|
|
|
each protocol family (IP, AppleTalk, IPX, etc.) and appears in the output of
|
|
|
|
.Xr ifconfig 8 .
|
|
|
|
The interfaces are named
|
2004-07-02 08:52:09 +00:00
|
|
|
.Dq Li ng0 ,
|
|
|
|
.Dq Li ng1 ,
|
1999-10-21 09:06:11 +00:00
|
|
|
etc.
|
2000-12-12 18:52:14 +00:00
|
|
|
.It ONE2MANY
|
2004-07-02 08:52:09 +00:00
|
|
|
This node implements a simple round-robin multiplexer.
|
|
|
|
It can be used
|
2000-12-12 18:52:14 +00:00
|
|
|
for example to make several LAN ports act together to get a higher speed
|
|
|
|
link between two machines.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It Various PPP related nodes
|
|
|
|
There is a full multilink PPP implementation that runs in
|
|
|
|
.Nm .
|
2001-07-14 19:41:16 +00:00
|
|
|
The
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pa net/mpd
|
2001-07-14 19:41:16 +00:00
|
|
|
port can use these modules to make a very low latency high
|
2004-07-02 08:52:09 +00:00
|
|
|
capacity PPP system.
|
|
|
|
It also supports
|
|
|
|
.Tn PPTP
|
|
|
|
VPNs using the PPTP node.
|
2000-12-12 18:52:14 +00:00
|
|
|
.It PPPOE
|
2004-07-02 08:52:09 +00:00
|
|
|
A server and client side implementation of PPPoE.
|
|
|
|
Used in conjunction with
|
2001-07-14 19:41:16 +00:00
|
|
|
either
|
2000-12-12 18:52:14 +00:00
|
|
|
.Xr ppp 8
|
2001-07-14 19:41:16 +00:00
|
|
|
or the
|
2004-07-02 08:52:09 +00:00
|
|
|
.Pa net/mpd
|
|
|
|
port.
|
2000-12-12 18:52:14 +00:00
|
|
|
.It BRIDGE
|
2004-07-02 08:52:09 +00:00
|
|
|
This node, together with the Ethernet nodes, allows a very flexible
|
2000-12-12 18:52:14 +00:00
|
|
|
bridging system to be implemented.
|
|
|
|
.It KSOCKET
|
|
|
|
This intriguing node looks like a socket to the system but diverts
|
2004-07-02 08:52:09 +00:00
|
|
|
all data to and from the
|
|
|
|
.Nm
|
|
|
|
system for further processing.
|
|
|
|
This allows
|
2001-07-14 19:41:16 +00:00
|
|
|
such things as UDP tunnels to be almost trivially implemented from the
|
2000-12-12 18:52:14 +00:00
|
|
|
command line.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
2000-12-12 18:52:14 +00:00
|
|
|
.Pp
|
|
|
|
Refer to the section at the end of this man page for more nodes types.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh NOTES
|
1999-10-30 20:30:19 +00:00
|
|
|
Whether a named node exists can be checked by trying to send a control message
|
1999-10-21 09:06:11 +00:00
|
|
|
to it (e.g.,
|
2001-08-10 17:35:21 +00:00
|
|
|
.Dv NGM_NODEINFO ) .
|
1999-10-21 09:06:11 +00:00
|
|
|
If it does not exist,
|
|
|
|
.Er ENOENT
|
|
|
|
will be returned.
|
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
All data messages are
|
|
|
|
.Vt mbuf chains
|
|
|
|
with the
|
|
|
|
.Dv M_PKTHDR
|
|
|
|
flag set.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
Nodes are responsible for freeing what they allocate.
|
|
|
|
There are three exceptions:
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
.Vt Mbufs
|
|
|
|
sent across a data link are never to be freed by the sender.
|
|
|
|
In the
|
2001-01-06 00:46:47 +00:00
|
|
|
case of error, they should be considered freed.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
2004-07-02 06:05:04 +00:00
|
|
|
Messages sent using one of
|
|
|
|
.Fn NG_SEND_MSG_*
|
|
|
|
family macros are freed by the recipient.
|
|
|
|
As in the case above, the addresses
|
2001-07-14 19:41:16 +00:00
|
|
|
associated with the message are freed by whatever allocated them so the
|
1999-10-21 09:06:11 +00:00
|
|
|
recipient should copy them if it wants to keep that information.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It
|
|
|
|
Both control messages and data are delivered and queued with a
|
|
|
|
.Nm
|
2001-01-06 00:46:47 +00:00
|
|
|
.Em item .
|
2001-07-14 19:41:16 +00:00
|
|
|
The item must be freed using
|
2004-07-02 08:52:09 +00:00
|
|
|
.Fn NG_FREE_ITEM item
|
2001-01-06 00:46:47 +00:00
|
|
|
or passed on to another node.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Sh FILES
|
2004-07-02 08:52:09 +00:00
|
|
|
.Bl -tag -width indent
|
|
|
|
.It In netgraph/netgraph.h
|
1999-10-30 20:30:19 +00:00
|
|
|
Definitions for use solely within the kernel by
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
|
|
|
nodes.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It In netgraph/ng_message.h
|
2001-07-14 19:41:16 +00:00
|
|
|
Definitions needed by any file that needs to deal with
|
|
|
|
.Nm
|
1999-10-21 09:06:11 +00:00
|
|
|
messages.
|
2004-07-02 08:52:09 +00:00
|
|
|
.It In netgraph/ng_socket.h
|
2001-07-14 19:41:16 +00:00
|
|
|
Definitions needed to use
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
2004-07-02 08:52:09 +00:00
|
|
|
.Vt socket
|
|
|
|
type nodes.
|
|
|
|
.It In netgraph/ng_ Ns Ao Ar type Ac Ns Pa .h
|
2001-07-14 19:41:16 +00:00
|
|
|
Definitions needed to use
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm
|
2004-07-02 08:52:09 +00:00
|
|
|
.Ar type
|
1999-10-21 09:06:11 +00:00
|
|
|
nodes, including the type cookie definition.
|
2003-03-03 22:48:49 +00:00
|
|
|
.It Pa /boot/kernel/netgraph.ko
|
2004-07-02 08:52:09 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
subsystem loadable KLD module.
|
|
|
|
.It Pa /boot/kernel/ng_ Ns Ao Ar type Ac Ns Pa .ko
|
|
|
|
Loadable KLD module for node type
|
|
|
|
.Ar type .
|
|
|
|
.It Pa src/sys/netgraph/ng_sample.c
|
|
|
|
Skeleton
|
|
|
|
.Nm
|
|
|
|
node.
|
2001-01-19 14:15:40 +00:00
|
|
|
Use this as a starting point for new node types.
|
1999-10-21 09:06:11 +00:00
|
|
|
.El
|
|
|
|
.Sh USER MODE SUPPORT
|
|
|
|
There is a library for supporting user-mode programs that wish
|
2004-07-02 08:52:09 +00:00
|
|
|
to interact with the
|
|
|
|
.Nm
|
|
|
|
system.
|
|
|
|
See
|
1999-10-21 09:06:11 +00:00
|
|
|
.Xr netgraph 3
|
|
|
|
for details.
|
|
|
|
.Pp
|
|
|
|
Two user-mode support programs,
|
|
|
|
.Xr ngctl 8
|
|
|
|
and
|
|
|
|
.Xr nghook 8 ,
|
|
|
|
are available to assist manual configuration and debugging.
|
|
|
|
.Pp
|
|
|
|
There are a few useful techniques for debugging new node types.
|
|
|
|
First, implementing new node types in user-mode first
|
|
|
|
makes debugging easier.
|
|
|
|
The
|
2004-07-02 08:52:09 +00:00
|
|
|
.Vt tee
|
1999-10-21 09:06:11 +00:00
|
|
|
node type is also useful for debugging, especially in conjunction with
|
|
|
|
.Xr ngctl 8
|
|
|
|
and
|
|
|
|
.Xr nghook 8 .
|
2000-12-12 18:52:14 +00:00
|
|
|
.Pp
|
2004-07-02 08:52:09 +00:00
|
|
|
Also look in
|
|
|
|
.Pa /usr/share/examples/netgraph
|
|
|
|
for solutions to several
|
2001-07-14 19:41:16 +00:00
|
|
|
common networking problems, solved using
|
2000-12-12 18:52:14 +00:00
|
|
|
.Nm .
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr socket 2 ,
|
|
|
|
.Xr netgraph 3 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_async 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_atm 4 ,
|
|
|
|
.Xr ng_atmllc 4 ,
|
|
|
|
.Xr ng_atmpif 4 ,
|
|
|
|
.Xr ng_bluetooth 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_bpf 4 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr ng_bridge 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_bt3c 4 ,
|
|
|
|
.Xr ng_btsocket 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_cisco 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_device 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_echo 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_eiface 4 ,
|
|
|
|
.Xr ng_etf 4 ,
|
2000-12-12 18:52:14 +00:00
|
|
|
.Xr ng_ether 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_fec 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_frame_relay 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_gif 4 ,
|
|
|
|
.Xr ng_gif_demux 4 ,
|
|
|
|
.Xr ng_h4 4 ,
|
|
|
|
.Xr ng_hci 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_hole 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_hub 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_iface 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_ip_input 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_ksocket 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_l2cap 4 ,
|
|
|
|
.Xr ng_l2tp 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_lmi 4 ,
|
|
|
|
.Xr ng_mppc 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_netflow 4 ,
|
|
|
|
.Xr ng_one2many 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_ppp 4 ,
|
|
|
|
.Xr ng_pppoe 4 ,
|
2000-12-12 18:52:14 +00:00
|
|
|
.Xr ng_pptpgre 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_rfc1490 4 ,
|
|
|
|
.Xr ng_socket 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_split 4 ,
|
|
|
|
.Xr ng_sppp 4 ,
|
|
|
|
.Xr ng_sscfu 4 ,
|
|
|
|
.Xr ng_sscop 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_tee 4 ,
|
|
|
|
.Xr ng_tty 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_ubt 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_UI 4 ,
|
2005-01-12 10:22:58 +00:00
|
|
|
.Xr ng_uni 4 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr ng_vjc 4 ,
|
2004-12-18 15:27:17 +00:00
|
|
|
.Xr ng_vlan 4 ,
|
1999-10-21 09:06:11 +00:00
|
|
|
.Xr ngctl 8 ,
|
2000-05-04 17:54:37 +00:00
|
|
|
.Xr nghook 8
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2001-08-10 13:45:36 +00:00
|
|
|
system was designed and first implemented at Whistle Communications, Inc.\&
|
2000-02-29 18:32:26 +00:00
|
|
|
in a version of
|
1999-12-21 01:25:21 +00:00
|
|
|
.Fx 2.2
|
|
|
|
customized for the Whistle InterJet.
|
2000-02-29 18:32:26 +00:00
|
|
|
It first made its debut in the main tree in
|
|
|
|
.Fx 3.4 .
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh AUTHORS
|
2000-11-22 09:35:58 +00:00
|
|
|
.An -nosplit
|
2000-10-26 15:30:44 +00:00
|
|
|
.An Julian Elischer Aq julian@FreeBSD.org ,
|
1999-12-21 01:25:21 +00:00
|
|
|
with contributions by
|
2000-10-26 15:30:44 +00:00
|
|
|
.An Archie Cobbs Aq archie@FreeBSD.org .
|