summaryrefslogtreecommitdiffstats
path: root/sys/modules/netgraph
diff options
context:
space:
mode:
Diffstat (limited to 'sys/modules/netgraph')
-rw-r--r--sys/modules/netgraph/Makefile7
-rw-r--r--sys/modules/netgraph/Makefile.inc7
-rw-r--r--sys/modules/netgraph/UI/Makefile9
-rw-r--r--sys/modules/netgraph/UI/ng_UI.486
-rw-r--r--sys/modules/netgraph/UI/ng_UI.886
-rw-r--r--sys/modules/netgraph/async/Makefile9
-rw-r--r--sys/modules/netgraph/async/ng_async.4160
-rw-r--r--sys/modules/netgraph/async/ng_async.8160
-rw-r--r--sys/modules/netgraph/bpf/Makefile11
-rw-r--r--sys/modules/netgraph/bpf/ng_bpf.4143
-rw-r--r--sys/modules/netgraph/bpf/ng_bpf.8143
-rw-r--r--sys/modules/netgraph/cisco/Makefile33
-rw-r--r--sys/modules/netgraph/cisco/ng_cisco.4160
-rw-r--r--sys/modules/netgraph/cisco/ng_cisco.8160
-rw-r--r--sys/modules/netgraph/echo/Makefile9
-rw-r--r--sys/modules/netgraph/echo/ng_echo.467
-rw-r--r--sys/modules/netgraph/echo/ng_echo.867
-rw-r--r--sys/modules/netgraph/frame_relay/Makefile9
-rw-r--r--sys/modules/netgraph/frame_relay/ng_frame_relay.493
-rw-r--r--sys/modules/netgraph/frame_relay/ng_frame_relay.893
-rw-r--r--sys/modules/netgraph/hole/Makefile9
-rw-r--r--sys/modules/netgraph/hole/ng_hole.467
-rw-r--r--sys/modules/netgraph/hole/ng_hole.867
-rw-r--r--sys/modules/netgraph/iface/Makefile35
-rw-r--r--sys/modules/netgraph/iface/ng_iface.4126
-rw-r--r--sys/modules/netgraph/iface/ng_iface.8126
-rw-r--r--sys/modules/netgraph/ksocket/Makefile8
-rw-r--r--sys/modules/netgraph/ksocket/ng_ksocket.4178
-rw-r--r--sys/modules/netgraph/ksocket/ng_ksocket.8178
-rw-r--r--sys/modules/netgraph/lmi/Makefile9
-rw-r--r--sys/modules/netgraph/lmi/ng_lmi.4130
-rw-r--r--sys/modules/netgraph/lmi/ng_lmi.8130
-rw-r--r--sys/modules/netgraph/netgraph/Makefile8
-rw-r--r--sys/modules/netgraph/netgraph/netgraph.4980
-rw-r--r--sys/modules/netgraph/ppp/Makefile9
-rw-r--r--sys/modules/netgraph/ppp/ng_ppp.4379
-rw-r--r--sys/modules/netgraph/ppp/ng_ppp.8379
-rw-r--r--sys/modules/netgraph/pppoe/Makefile9
-rw-r--r--sys/modules/netgraph/pppoe/ng_pppoe.4399
-rw-r--r--sys/modules/netgraph/pppoe/ng_pppoe.8399
-rw-r--r--sys/modules/netgraph/pptpgre/Makefile9
-rw-r--r--sys/modules/netgraph/pptpgre/ng_pptpgre.4136
-rw-r--r--sys/modules/netgraph/pptpgre/ng_pptpgre.8136
-rw-r--r--sys/modules/netgraph/rfc1490/Makefile9
-rw-r--r--sys/modules/netgraph/rfc1490/ng_rfc1490.4109
-rw-r--r--sys/modules/netgraph/rfc1490/ng_rfc1490.8109
-rw-r--r--sys/modules/netgraph/socket/Makefile9
-rw-r--r--sys/modules/netgraph/socket/ng_socket.4173
-rw-r--r--sys/modules/netgraph/socket/ng_socket.8173
-rw-r--r--sys/modules/netgraph/tee/Makefile9
-rw-r--r--sys/modules/netgraph/tee/ng_tee.4117
-rw-r--r--sys/modules/netgraph/tee/ng_tee.8117
-rw-r--r--sys/modules/netgraph/tty/Makefile9
-rw-r--r--sys/modules/netgraph/tty/ng_tty.4131
-rw-r--r--sys/modules/netgraph/tty/ng_tty.8131
-rw-r--r--sys/modules/netgraph/vjc/Makefile11
-rw-r--r--sys/modules/netgraph/vjc/ng_vjc.4210
-rw-r--r--sys/modules/netgraph/vjc/ng_vjc.8210
58 files changed, 6945 insertions, 0 deletions
diff --git a/sys/modules/netgraph/Makefile b/sys/modules/netgraph/Makefile
new file mode 100644
index 0000000..69a9f2b
--- /dev/null
+++ b/sys/modules/netgraph/Makefile
@@ -0,0 +1,7 @@
+# $Whistle: Makefile,v 1.5 1999/01/24 06:48:37 archie Exp $
+# $FreeBSD$
+
+SUBDIR= async bpf cisco echo frame_relay hole iface ksocket lmi netgraph \
+ ppp pppoe pptpgre rfc1490 socket tee tty UI vjc
+
+.include <bsd.subdir.mk>
diff --git a/sys/modules/netgraph/Makefile.inc b/sys/modules/netgraph/Makefile.inc
new file mode 100644
index 0000000..16ca171
--- /dev/null
+++ b/sys/modules/netgraph/Makefile.inc
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# $Whistle: Makefile.inc,v 1.4 1999/01/19 23:46:16 archie Exp $
+
+.PATH: ${.CURDIR}/../../../netgraph
+CFLAGS+= -Wall
+
+.include "../Makefile.inc"
diff --git a/sys/modules/netgraph/UI/Makefile b/sys/modules/netgraph/UI/Makefile
new file mode 100644
index 0000000..cf7542f
--- /dev/null
+++ b/sys/modules/netgraph/UI/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:20 archie Exp $
+
+KMOD= ng_UI
+SRCS= ng_UI.c
+MAN8= ng_UI.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/UI/ng_UI.4 b/sys/modules/netgraph/UI/ng_UI.4
new file mode 100644
index 0000000..74b6832
--- /dev/null
+++ b/sys/modules/netgraph/UI/ng_UI.4
@@ -0,0 +1,86 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_UI.8,v 1.4 1999/01/25 02:37:56 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_UI 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_UI
+.Nd UI netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_UI.h>
+.Sh DESCRIPTION
+The
+.Nm UI
+node type has two hooks,
+.Dv upstream
+and
+.Dv downstream .
+Packets received on
+.Dv downstream
+must have 0x03 (indicating unnumbered information) as their first byte;
+if not the packet is dropped. This byte is then stripped and the
+remainder of the packet sent out on
+.Dv upstream .
+.Pp
+Conversely, packets received on
+.Dv upstream
+will have a 0x03 byte prepended to them before being forwarded out on the
+.Dv downstream
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv downstream
+Downstream connection. Packets on this side of the node have a 0x03 as
+their first byte.
+.It Dv upstream
+Upstream connection. Packets on this side of the node have the
+initial 0x03 byte stripped off.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/UI/ng_UI.8 b/sys/modules/netgraph/UI/ng_UI.8
new file mode 100644
index 0000000..74b6832
--- /dev/null
+++ b/sys/modules/netgraph/UI/ng_UI.8
@@ -0,0 +1,86 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_UI.8,v 1.4 1999/01/25 02:37:56 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_UI 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_UI
+.Nd UI netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_UI.h>
+.Sh DESCRIPTION
+The
+.Nm UI
+node type has two hooks,
+.Dv upstream
+and
+.Dv downstream .
+Packets received on
+.Dv downstream
+must have 0x03 (indicating unnumbered information) as their first byte;
+if not the packet is dropped. This byte is then stripped and the
+remainder of the packet sent out on
+.Dv upstream .
+.Pp
+Conversely, packets received on
+.Dv upstream
+will have a 0x03 byte prepended to them before being forwarded out on the
+.Dv downstream
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv downstream
+Downstream connection. Packets on this side of the node have a 0x03 as
+their first byte.
+.It Dv upstream
+Upstream connection. Packets on this side of the node have the
+initial 0x03 byte stripped off.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/async/Makefile b/sys/modules/netgraph/async/Makefile
new file mode 100644
index 0000000..507d0e4
--- /dev/null
+++ b/sys/modules/netgraph/async/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:20 archie Exp $
+
+KMOD= ng_async
+SRCS= ng_async.c
+MAN8= ng_async.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/async/ng_async.4 b/sys/modules/netgraph/async/ng_async.4
new file mode 100644
index 0000000..7c061c9
--- /dev/null
+++ b/sys/modules/netgraph/async/ng_async.4
@@ -0,0 +1,160 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ASYNC 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_async
+.Nd asynchronous framing netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_async.h>
+.Sh DESCRIPTION
+The
+.Nm async
+node type performs conversion between synchronous frames and
+asynchronous frames, as defined for the PPP protocol in RFC 1662.
+Asynchronous framing uses flag bytes and octet-stuffing
+to simulate a frame oriented connection over an octet-oriented
+asynchronous serial line.
+.Pp
+The node transmits and receives asynchronous data on the
+.Dv async
+hook. Mbuf boundaries of incoming data are ignored.
+Once a complete packet has been received, it is decoded and
+stripped of all framing bytes, and transmitted out the
+.Dv sync
+hook as a single frame.
+.Pp
+Synchronous frames are transmitted and received on the
+.Dv sync
+hook.
+Packets received on this hook are encoded as asynchronous frames
+and sent out on
+.Dv async .
+Received packets should start with the address and control fields,
+or the PPP protocol field if address and control field compression
+is employed, and contain no checksum field. If the first four bytes are
+.Dv "0xff 0x03 0xc0 0x21"
+(an LCP protocol frame) then complete control character escaping
+is enabled for that frame (in PPP, LCP packets are always sent with
+no address and control field compression and all control characters
+escaped).
+.Pp
+This node supports ``flag sharing'' for packets transmitted on
+.Dv async .
+This is an optimization where the trailing flag byte
+of one frame is shared with the opening flag byte of the next.
+Flag sharing between frames is disabled after one second of transmit
+idle time.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv async
+Asynchronous connection.
+Typically this hook would be connected to a
+.Xr ng_tty 8
+node, which handles transmission of serial data over a tty device.
+.It Dv sync
+Synchronous connection. This hook sends and receives synchronous frames.
+For PPP, these frames should contain address, control, and protocol fields,
+but no checksum field.
+Typically this hook would be connected to an individual link hook of a
+.Xr ng_ppp 8
+type node.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_ASYNC_CMD_GET_STATS
+This command returns a
+.Dv "struct ng_async_stat"
+containing node statistics for packet, octet, and error counts.
+.It Dv NGM_ASYNC_CMD_CLR_STATS
+Clears the node statistics.
+.It Dv NGM_ASYNC_CMD_SET_CONFIG
+Sets the node configuration, which is described by a
+.Dv "struct ng_async_cfg" :
+.Bd -literal -offset 4n
+struct ng_async_cfg {
+ u_char enabled; /* Turn encoding on/off */
+ u_int16_t amru; /* Max receive async frame len */
+ u_int16_t smru; /* Max receive sync frame len */
+ u_int32_t accm; /* ACCM encoding */
+};
+.Ed
+.Pp
+The
+.Dv enabled
+field enables or disables all encoding/decoding functions (default disabled).
+When disabled, the node operates in simple ``pass through'' mode.
+The
+.Dv amru
+and
+.Dv smru
+fields are the asynchronous and synchronous MRU (maximum receive unit) values,
+respectively. These both default to 1600; note that the async MRU
+applies to the incoming frame length after asynchronous decoding.
+The
+.Dv accm
+field is the asynchronous character control map, which controls the escaping
+of characters 0x00 thorough 0x1f (default 0xffffffff).
+.It Dv NGM_ASYNC_CMD_GET_CONFIG
+This command returns the current configuration structure.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 8 ,
+.Xr ng_tty 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A W. Simpson
+.%T "PPP in HDLC-link Framing"
+.%O RFC 1662
+.Re
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/async/ng_async.8 b/sys/modules/netgraph/async/ng_async.8
new file mode 100644
index 0000000..7c061c9
--- /dev/null
+++ b/sys/modules/netgraph/async/ng_async.8
@@ -0,0 +1,160 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ASYNC 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_async
+.Nd asynchronous framing netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_async.h>
+.Sh DESCRIPTION
+The
+.Nm async
+node type performs conversion between synchronous frames and
+asynchronous frames, as defined for the PPP protocol in RFC 1662.
+Asynchronous framing uses flag bytes and octet-stuffing
+to simulate a frame oriented connection over an octet-oriented
+asynchronous serial line.
+.Pp
+The node transmits and receives asynchronous data on the
+.Dv async
+hook. Mbuf boundaries of incoming data are ignored.
+Once a complete packet has been received, it is decoded and
+stripped of all framing bytes, and transmitted out the
+.Dv sync
+hook as a single frame.
+.Pp
+Synchronous frames are transmitted and received on the
+.Dv sync
+hook.
+Packets received on this hook are encoded as asynchronous frames
+and sent out on
+.Dv async .
+Received packets should start with the address and control fields,
+or the PPP protocol field if address and control field compression
+is employed, and contain no checksum field. If the first four bytes are
+.Dv "0xff 0x03 0xc0 0x21"
+(an LCP protocol frame) then complete control character escaping
+is enabled for that frame (in PPP, LCP packets are always sent with
+no address and control field compression and all control characters
+escaped).
+.Pp
+This node supports ``flag sharing'' for packets transmitted on
+.Dv async .
+This is an optimization where the trailing flag byte
+of one frame is shared with the opening flag byte of the next.
+Flag sharing between frames is disabled after one second of transmit
+idle time.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv async
+Asynchronous connection.
+Typically this hook would be connected to a
+.Xr ng_tty 8
+node, which handles transmission of serial data over a tty device.
+.It Dv sync
+Synchronous connection. This hook sends and receives synchronous frames.
+For PPP, these frames should contain address, control, and protocol fields,
+but no checksum field.
+Typically this hook would be connected to an individual link hook of a
+.Xr ng_ppp 8
+type node.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_ASYNC_CMD_GET_STATS
+This command returns a
+.Dv "struct ng_async_stat"
+containing node statistics for packet, octet, and error counts.
+.It Dv NGM_ASYNC_CMD_CLR_STATS
+Clears the node statistics.
+.It Dv NGM_ASYNC_CMD_SET_CONFIG
+Sets the node configuration, which is described by a
+.Dv "struct ng_async_cfg" :
+.Bd -literal -offset 4n
+struct ng_async_cfg {
+ u_char enabled; /* Turn encoding on/off */
+ u_int16_t amru; /* Max receive async frame len */
+ u_int16_t smru; /* Max receive sync frame len */
+ u_int32_t accm; /* ACCM encoding */
+};
+.Ed
+.Pp
+The
+.Dv enabled
+field enables or disables all encoding/decoding functions (default disabled).
+When disabled, the node operates in simple ``pass through'' mode.
+The
+.Dv amru
+and
+.Dv smru
+fields are the asynchronous and synchronous MRU (maximum receive unit) values,
+respectively. These both default to 1600; note that the async MRU
+applies to the incoming frame length after asynchronous decoding.
+The
+.Dv accm
+field is the asynchronous character control map, which controls the escaping
+of characters 0x00 thorough 0x1f (default 0xffffffff).
+.It Dv NGM_ASYNC_CMD_GET_CONFIG
+This command returns the current configuration structure.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 8 ,
+.Xr ng_tty 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A W. Simpson
+.%T "PPP in HDLC-link Framing"
+.%O RFC 1662
+.Re
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/bpf/Makefile b/sys/modules/netgraph/bpf/Makefile
new file mode 100644
index 0000000..704b98a
--- /dev/null
+++ b/sys/modules/netgraph/bpf/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/12/03 01:44:28 archie Exp $
+
+KMOD= ng_bpf
+SRCS= ng_bpf.c bpf_filter.c
+MAN8= ng_bpf.8
+KMODDEPS= netgraph
+
+.PATH: ${.CURDIR}/../../../net
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/bpf/ng_bpf.4 b/sys/modules/netgraph/bpf/ng_bpf.4
new file mode 100644
index 0000000..e9079ea
--- /dev/null
+++ b/sys/modules/netgraph/bpf/ng_bpf.4
@@ -0,0 +1,143 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $
+.\"
+.Dd December 2, 1999
+.Dt NG_BPF 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_bpf
+.Nd Berkeley packet filter netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/bpf.h>
+.Fd #include <netgraph/ng_bpf.h>
+.Sh DESCRIPTION
+The
+.Nm bpf
+node type allows Berkeley Packet Filter (see
+.Xr bpf 8 )
+filters to be applied to data travelling through a Netgraph network.
+Each node allows an arbitrary number of connections to arbitrarily
+named hooks. With each hook is associated a
+.Xf bpf 8
+filter program which is applied to incoming data only, a destination hook
+for matching packets, a destination hook for non-matching packets,
+and various statistics counters.
+.Pp
+A
+.Xr bpf 8
+program returns an unsigned integer, which is normally interpreted as
+the length of the prefix of the packet to return. In the context of this
+node type, returning zero is considered a non-match, in which case the
+entire packet is delivered out the non-match destination hook.
+Returning a value greater than zero causes the packet to be truncated
+to that length and delivered out the match destination hook.
+Either or both destination hooks may be the empty string, or may
+not exist, in which case the packet is dropped.
+.Pp
+New hooks are initially configured to drop all packets.
+A new filter may be installed using the
+.Dv NGM_BPF_SET_FILTER
+control message.
+.Sh HOOKS
+This node type supports any number of hooks having arbitrary names.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_BPF_SET_FILTER
+This command sets the filter program that will be applied to incoming
+data on a hook. The following structure must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ngm_bpf_hookprog {
+ char thisHook[NG_HOOKLEN+1]; /* name of hook */
+ char ifMatch[NG_HOOKLEN+1]; /* match dest hook */
+ char ifNotMatch[NG_HOOKLEN+1]; /* !match dest hook */
+ int32_t bpf_prog_len; /* #isns in program */
+ struct bpf_insn bpf_prog[0]; /* bpf program */
+};
+.Ed
+.Pp
+The hook to be updated is specified in
+.Dv thisHook .
+The BPF program is the sequence of instructions in the
+.Dv bpf_prog
+array; there must be
+.Dv bpf_prog_len
+of them.
+Matching and non-matching incoming packets are delivered out the hooks named
+.Dv ifMatch
+and
+.Dv ifNotMatch ,
+respectively. The program must be a valid
+.Xr bpf 8
+program or else
+.Er EINVAL
+is returned.
+.It Dv NGM_BPF_GET_FILTER
+This command takes an ASCII string argument, the hook name, and returns the
+corresponding
+.Dv "struct ngm_bpf_hookprog"
+as shown above.
+.It Dv NGM_BPF_GET_STATS
+This command takes an ASCII string argument, the hook name, and returns the
+statistics associated with the hook as a
+.Dv "struct ng_bpf_hookstat" .
+.It Dv NGM_BPF_CLR_STATS
+This command takes an ASCII string argument, the hook name, and clears the
+statistics associated with the hook.
+.It Dv NGM_BPF_GETCLR_STATS
+This command is identical to
+.Dv NGM_BPF_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+When built as a loadable kernel module, this module includes the file
+.Dv "net/bpf_filter.c" .
+Although loading the module should fail if
+.Dv "net/bpf_filter.c"
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr bpf 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/bpf/ng_bpf.8 b/sys/modules/netgraph/bpf/ng_bpf.8
new file mode 100644
index 0000000..e9079ea
--- /dev/null
+++ b/sys/modules/netgraph/bpf/ng_bpf.8
@@ -0,0 +1,143 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $
+.\"
+.Dd December 2, 1999
+.Dt NG_BPF 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_bpf
+.Nd Berkeley packet filter netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/bpf.h>
+.Fd #include <netgraph/ng_bpf.h>
+.Sh DESCRIPTION
+The
+.Nm bpf
+node type allows Berkeley Packet Filter (see
+.Xr bpf 8 )
+filters to be applied to data travelling through a Netgraph network.
+Each node allows an arbitrary number of connections to arbitrarily
+named hooks. With each hook is associated a
+.Xf bpf 8
+filter program which is applied to incoming data only, a destination hook
+for matching packets, a destination hook for non-matching packets,
+and various statistics counters.
+.Pp
+A
+.Xr bpf 8
+program returns an unsigned integer, which is normally interpreted as
+the length of the prefix of the packet to return. In the context of this
+node type, returning zero is considered a non-match, in which case the
+entire packet is delivered out the non-match destination hook.
+Returning a value greater than zero causes the packet to be truncated
+to that length and delivered out the match destination hook.
+Either or both destination hooks may be the empty string, or may
+not exist, in which case the packet is dropped.
+.Pp
+New hooks are initially configured to drop all packets.
+A new filter may be installed using the
+.Dv NGM_BPF_SET_FILTER
+control message.
+.Sh HOOKS
+This node type supports any number of hooks having arbitrary names.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_BPF_SET_FILTER
+This command sets the filter program that will be applied to incoming
+data on a hook. The following structure must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ngm_bpf_hookprog {
+ char thisHook[NG_HOOKLEN+1]; /* name of hook */
+ char ifMatch[NG_HOOKLEN+1]; /* match dest hook */
+ char ifNotMatch[NG_HOOKLEN+1]; /* !match dest hook */
+ int32_t bpf_prog_len; /* #isns in program */
+ struct bpf_insn bpf_prog[0]; /* bpf program */
+};
+.Ed
+.Pp
+The hook to be updated is specified in
+.Dv thisHook .
+The BPF program is the sequence of instructions in the
+.Dv bpf_prog
+array; there must be
+.Dv bpf_prog_len
+of them.
+Matching and non-matching incoming packets are delivered out the hooks named
+.Dv ifMatch
+and
+.Dv ifNotMatch ,
+respectively. The program must be a valid
+.Xr bpf 8
+program or else
+.Er EINVAL
+is returned.
+.It Dv NGM_BPF_GET_FILTER
+This command takes an ASCII string argument, the hook name, and returns the
+corresponding
+.Dv "struct ngm_bpf_hookprog"
+as shown above.
+.It Dv NGM_BPF_GET_STATS
+This command takes an ASCII string argument, the hook name, and returns the
+statistics associated with the hook as a
+.Dv "struct ng_bpf_hookstat" .
+.It Dv NGM_BPF_CLR_STATS
+This command takes an ASCII string argument, the hook name, and clears the
+statistics associated with the hook.
+.It Dv NGM_BPF_GETCLR_STATS
+This command is identical to
+.Dv NGM_BPF_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+When built as a loadable kernel module, this module includes the file
+.Dv "net/bpf_filter.c" .
+Although loading the module should fail if
+.Dv "net/bpf_filter.c"
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr bpf 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/cisco/Makefile b/sys/modules/netgraph/cisco/Makefile
new file mode 100644
index 0000000..ba91dab
--- /dev/null
+++ b/sys/modules/netgraph/cisco/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:20 archie Exp $
+
+KMOD= ng_cisco
+SRCS= ng_cisco.c opt_inet.h opt_atalk.h opt_ipx.h
+MAN8= ng_cisco.8
+KMODDEPS= netgraph
+
+IFACE_INET?= 1 # 0/1 - requires INET configured in kernel
+IFACE_NETATALK?= 0 # 0/1 - requires NETATALK configured in kernel
+IFACE_IPX?= 0 # 0/1 - requires IPX configured in kernel
+
+CFLAGS+= ${PROTOS}
+
+opt_inet.h:
+ touch opt_inet.h
+.if ${IFACE_INET} > 0
+ echo "#define INET 1" > opt_inet.h
+.endif
+
+opt_atalk.h:
+ touch opt_atalk.h
+.if ${IFACE_NETATALK} > 0
+ echo "#define NETATALK ${IFACE_NETATALK}" > opt_atalk.h
+.endif
+
+opt_ipx.h:
+ touch opt_ipx.h
+.if ${IFACE_IPX} > 0
+ echo "#define IPX ${IFACE_IPX}" > opt_ipx.h
+.endif
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/cisco/ng_cisco.4 b/sys/modules/netgraph/cisco/ng_cisco.4
new file mode 100644
index 0000000..26370cd
--- /dev/null
+++ b/sys/modules/netgraph/cisco/ng_cisco.4
@@ -0,0 +1,160 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_cisco.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_CISCO 8
+.Os FreeBSD 3
+.Sh NAME
+.Nm ng_cisco
+.Nd Cisco HDLC protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netinet/in.h>
+.Fd #include <netgraph/ng_cisco.h>
+.Sh DESCRIPTION
+The
+.Nm cisco
+node type performs encapsulation and de-encapsulation of packets
+using the Cisco HDLC protocol. This is a fairly simple
+protocol for the transmission of packets across
+high speed synchronous lines. Each packet is prepended with
+an Ethertype, indicating the protocol. There is also a
+``keep alive'' and an ``inquire'' capability.
+.Pp
+The
+.Dv downstream
+hook should connect to the synchronous line. On the other side
+of the node are the
+.Dv inet ,
+.Dv atalk ,
+and
+.Dv ipx
+hooks, which transmit and receive raw IP, AppleTalk, and IPX packets,
+respectively. Typically these hooks would connect to the corresponding
+hooks on an
+.Xr ng_iface 8
+type node.
+.Sh IP Configuration
+In order to function properly for IP traffic, the node must be informed
+of the local IP address and netmask setting. This is because the protocol
+includes an ``inquire'' packet which we must be prepared to answer.
+There are two ways to accomplish this, manually and automatically.
+.Pp
+Whenever such an inquire packet is received, the node sends a
+.Dv NGM_CISCO_GET_IPADDR
+control message to the peer node connected to the
+.Dv inet
+hook (if any).
+If the peer responds, then that response is used. This is the automatic method.
+.Pp
+If the peer does not respond, the node falls back on its cached value
+for the IP address and netmask. This cached value can be set at any time
+with a
+.Dv NGM_CISCO_SET_IPADDR
+message, and this is the manual method.
+.Pp
+If the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 8
+node, as is usually the case, then configuration is automatic as the
+.Xr ng_iface 8
+understands the
+.Dv NGM_CISCO_GET_IPADDR
+message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazio
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv inet
+IP hook.
+.It Dv atalk
+AppleTalk hook.
+.It Dv ipx
+IPX hook
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_CISCO_SET_IPADDR
+This command takes an array of two
+.Dv "struct in_addr"
+arguments. The first is the IP address of the corresponding interface
+and the second is the netmask.
+.It Dv NGM_CISCO_GET_IPADDR
+This command returns the IP configuration in the same format used by
+.Dv NGM_CISCO_SET_IPADDR .
+This command is also
+.Em sent
+by this node type to the
+.Dv inet
+peer whenever an IP address inquiry packet is received.
+.It Dv NGM_CISCO_GET_STATUS
+Returns a
+.Dv "struct ngciscostat" :
+.Bd -literal -offset 4n
+struct ngciscostat {
+ u_int32_t seq_retries; /* # unack'd retries */
+ u_int32_t keepalive_period; /* in seconds */
+};
+.Ed
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Not all of the functionality has been implemented. For example,
+the node does not support querying the remote end for its IP address
+and netmask.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A D. Perkins
+.%T "Requirements for an Internet Standard Point-to-Point Protocol"
+.%O RFC 1547
+.Re
+.Sh LEGAL
+Cisco is a trademark of Cisco Systems, Inc.
+.Sh AUTHORS
+Julian Elischer <julian@whistle.com>,
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/cisco/ng_cisco.8 b/sys/modules/netgraph/cisco/ng_cisco.8
new file mode 100644
index 0000000..26370cd
--- /dev/null
+++ b/sys/modules/netgraph/cisco/ng_cisco.8
@@ -0,0 +1,160 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_cisco.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_CISCO 8
+.Os FreeBSD 3
+.Sh NAME
+.Nm ng_cisco
+.Nd Cisco HDLC protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netinet/in.h>
+.Fd #include <netgraph/ng_cisco.h>
+.Sh DESCRIPTION
+The
+.Nm cisco
+node type performs encapsulation and de-encapsulation of packets
+using the Cisco HDLC protocol. This is a fairly simple
+protocol for the transmission of packets across
+high speed synchronous lines. Each packet is prepended with
+an Ethertype, indicating the protocol. There is also a
+``keep alive'' and an ``inquire'' capability.
+.Pp
+The
+.Dv downstream
+hook should connect to the synchronous line. On the other side
+of the node are the
+.Dv inet ,
+.Dv atalk ,
+and
+.Dv ipx
+hooks, which transmit and receive raw IP, AppleTalk, and IPX packets,
+respectively. Typically these hooks would connect to the corresponding
+hooks on an
+.Xr ng_iface 8
+type node.
+.Sh IP Configuration
+In order to function properly for IP traffic, the node must be informed
+of the local IP address and netmask setting. This is because the protocol
+includes an ``inquire'' packet which we must be prepared to answer.
+There are two ways to accomplish this, manually and automatically.
+.Pp
+Whenever such an inquire packet is received, the node sends a
+.Dv NGM_CISCO_GET_IPADDR
+control message to the peer node connected to the
+.Dv inet
+hook (if any).
+If the peer responds, then that response is used. This is the automatic method.
+.Pp
+If the peer does not respond, the node falls back on its cached value
+for the IP address and netmask. This cached value can be set at any time
+with a
+.Dv NGM_CISCO_SET_IPADDR
+message, and this is the manual method.
+.Pp
+If the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 8
+node, as is usually the case, then configuration is automatic as the
+.Xr ng_iface 8
+understands the
+.Dv NGM_CISCO_GET_IPADDR
+message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazio
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv inet
+IP hook.
+.It Dv atalk
+AppleTalk hook.
+.It Dv ipx
+IPX hook
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_CISCO_SET_IPADDR
+This command takes an array of two
+.Dv "struct in_addr"
+arguments. The first is the IP address of the corresponding interface
+and the second is the netmask.
+.It Dv NGM_CISCO_GET_IPADDR
+This command returns the IP configuration in the same format used by
+.Dv NGM_CISCO_SET_IPADDR .
+This command is also
+.Em sent
+by this node type to the
+.Dv inet
+peer whenever an IP address inquiry packet is received.
+.It Dv NGM_CISCO_GET_STATUS
+Returns a
+.Dv "struct ngciscostat" :
+.Bd -literal -offset 4n
+struct ngciscostat {
+ u_int32_t seq_retries; /* # unack'd retries */
+ u_int32_t keepalive_period; /* in seconds */
+};
+.Ed
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Not all of the functionality has been implemented. For example,
+the node does not support querying the remote end for its IP address
+and netmask.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A D. Perkins
+.%T "Requirements for an Internet Standard Point-to-Point Protocol"
+.%O RFC 1547
+.Re
+.Sh LEGAL
+Cisco is a trademark of Cisco Systems, Inc.
+.Sh AUTHORS
+Julian Elischer <julian@whistle.com>,
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/echo/Makefile b/sys/modules/netgraph/echo/Makefile
new file mode 100644
index 0000000..0c33d2f
--- /dev/null
+++ b/sys/modules/netgraph/echo/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:20 archie Exp $
+
+KMOD= ng_echo
+SRCS= ng_echo.c
+MAN8= ng_echo.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/echo/ng_echo.4 b/sys/modules/netgraph/echo/ng_echo.4
new file mode 100644
index 0000000..7e22a6f
--- /dev/null
+++ b/sys/modules/netgraph/echo/ng_echo.4
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_echo.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ECHO 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_echo
+.Nd netgraph echo node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_echo.h>
+.Sh DESCRIPTION
+The
+.Nm echo
+node type reflects all data and control messages back to the sender.
+This node type is used for testing and debugging.
+.Sh HOOKS
+.Nm Echo
+nodes accept any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Any other control messages are reflected back to the sender.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_hole 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/echo/ng_echo.8 b/sys/modules/netgraph/echo/ng_echo.8
new file mode 100644
index 0000000..7e22a6f
--- /dev/null
+++ b/sys/modules/netgraph/echo/ng_echo.8
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_echo.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ECHO 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_echo
+.Nd netgraph echo node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_echo.h>
+.Sh DESCRIPTION
+The
+.Nm echo
+node type reflects all data and control messages back to the sender.
+This node type is used for testing and debugging.
+.Sh HOOKS
+.Nm Echo
+nodes accept any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Any other control messages are reflected back to the sender.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_hole 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/frame_relay/Makefile b/sys/modules/netgraph/frame_relay/Makefile
new file mode 100644
index 0000000..3c0117a
--- /dev/null
+++ b/sys/modules/netgraph/frame_relay/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/01/19 19:39:21 archie Exp $
+
+KMOD= ng_frame_relay
+SRCS= ng_frame_relay.c
+MAN8= ng_frame_relay.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/frame_relay/ng_frame_relay.4 b/sys/modules/netgraph/frame_relay/ng_frame_relay.4
new file mode 100644
index 0000000..fc9ef0f
--- /dev/null
+++ b/sys/modules/netgraph/frame_relay/ng_frame_relay.4
@@ -0,0 +1,93 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_frame_relay.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_FRAME_RELAY 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_frame_relay
+.Nd Frame relay netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_frame_relay.h>
+.Sh DESCRIPTION
+The
+.Nm frame_relay
+node type performs encapsulation, de-encapsulation, and multiplexing
+of packets using the frame relay protocol. It supports up to 1024 DLCI's.
+The LMI protocol is handled by a separate node type (see
+.Xr ng_lmi 8 ).
+.Pp
+The
+.Dv downstream
+hook should be connected to the synchronous line, i.e., the switch.
+Then hooks
+.Dv dlci0 ,
+.Dv dlci1 ,
+through
+.Dv dlci1023
+are available to connect to each of the DLCI channels.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv dlciX
+Here X is a decimal number from 0 to 1023. This hook corresponds
+to the DLCI X frame relay virtual channel.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Technically, frames on DLCI X should not be transmitted to the switch
+until the LMI protocol entity on both ends has configured DLCI X as active.
+The
+.Nm frame_relay
+node type ignores this restriction, and will always pass data received
+on a DLCI hook to
+.Dv downstream .
+Instead, it should query the LMI node first.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_lmi 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/frame_relay/ng_frame_relay.8 b/sys/modules/netgraph/frame_relay/ng_frame_relay.8
new file mode 100644
index 0000000..fc9ef0f
--- /dev/null
+++ b/sys/modules/netgraph/frame_relay/ng_frame_relay.8
@@ -0,0 +1,93 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_frame_relay.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_FRAME_RELAY 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_frame_relay
+.Nd Frame relay netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_frame_relay.h>
+.Sh DESCRIPTION
+The
+.Nm frame_relay
+node type performs encapsulation, de-encapsulation, and multiplexing
+of packets using the frame relay protocol. It supports up to 1024 DLCI's.
+The LMI protocol is handled by a separate node type (see
+.Xr ng_lmi 8 ).
+.Pp
+The
+.Dv downstream
+hook should be connected to the synchronous line, i.e., the switch.
+Then hooks
+.Dv dlci0 ,
+.Dv dlci1 ,
+through
+.Dv dlci1023
+are available to connect to each of the DLCI channels.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv dlciX
+Here X is a decimal number from 0 to 1023. This hook corresponds
+to the DLCI X frame relay virtual channel.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Technically, frames on DLCI X should not be transmitted to the switch
+until the LMI protocol entity on both ends has configured DLCI X as active.
+The
+.Nm frame_relay
+node type ignores this restriction, and will always pass data received
+on a DLCI hook to
+.Dv downstream .
+Instead, it should query the LMI node first.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_lmi 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/hole/Makefile b/sys/modules/netgraph/hole/Makefile
new file mode 100644
index 0000000..f7408c1
--- /dev/null
+++ b/sys/modules/netgraph/hole/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:21 archie Exp $
+
+KMOD= ng_hole
+SRCS= ng_hole.c
+MAN8= ng_hole.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/hole/ng_hole.4 b/sys/modules/netgraph/hole/ng_hole.4
new file mode 100644
index 0000000..472b22c
--- /dev/null
+++ b/sys/modules/netgraph/hole/ng_hole.4
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_hole.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_HOLE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_hole
+.Nd netgraph discard node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_hole.h>
+.Sh DESCRIPTION
+The
+.Nm hole
+node type silently discards all data and control messages it receives.
+This type is used for testing and debugging.
+.Sh HOOKS
+.Nm Hole
+nodes accept any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Other control messages are silently discarded.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_echo 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/hole/ng_hole.8 b/sys/modules/netgraph/hole/ng_hole.8
new file mode 100644
index 0000000..472b22c
--- /dev/null
+++ b/sys/modules/netgraph/hole/ng_hole.8
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_hole.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_HOLE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_hole
+.Nd netgraph discard node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_hole.h>
+.Sh DESCRIPTION
+The
+.Nm hole
+node type silently discards all data and control messages it receives.
+This type is used for testing and debugging.
+.Sh HOOKS
+.Nm Hole
+nodes accept any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Other control messages are silently discarded.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_echo 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/iface/Makefile b/sys/modules/netgraph/iface/Makefile
new file mode 100644
index 0000000..ccd6fe8
--- /dev/null
+++ b/sys/modules/netgraph/iface/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:21 archie Exp $
+
+KMOD= ng_iface
+SRCS= ng_iface.c opt_inet.h opt_atalk.h opt_ipx.h
+MAN8= ng_iface.8
+KMODDEPS= netgraph
+
+IFACE_INET?= 1 # 0/1 - requires INET configured in kernel
+IFACE_NETATALK?= 0 # 0/1 - requires NETATALK configured in kernel
+IFACE_IPX?= 0 # 0/1 - requires IPX configured in kernel
+
+CFLAGS+= ${PROTOS}
+
+CLEANFILES+= opt_inet.h opt_atalk.h opt_ipx.h
+
+opt_inet.h:
+ touch opt_inet.h
+.if ${IFACE_INET} > 0
+ echo "#define INET 1" > opt_inet.h
+.endif
+
+opt_atalk.h:
+ touch opt_atalk.h
+.if ${IFACE_NETATALK} > 0
+ echo "#define NETATALK ${IFACE_NETATALK}" > opt_atalk.h
+.endif
+
+opt_ipx.h:
+ touch opt_ipx.h
+.if ${IFACE_IPX} > 0
+ echo "#define IPX ${IFACE_IPX}" > opt_ipx.h
+.endif
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/iface/ng_iface.4 b/sys/modules/netgraph/iface/ng_iface.4
new file mode 100644
index 0000000..376b5c5
--- /dev/null
+++ b/sys/modules/netgraph/iface/ng_iface.4
@@ -0,0 +1,126 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_IFACE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_iface
+.Nd interface netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_iface.h>
+.Sh DESCRIPTION
+An
+.Nm iface
+node is both a netgraph node and a system networking interface. When an
+.Nm iface
+node is created, a new point-to-point interface appears which is accessible via
+.Xr ifconfig 8 .
+The new interfaces are named
+.Dv ng0 ,
+.Dv ng1 ,
+etc. The node is assigned the same name as its interface, unless the name
+already exists, in which case the node remains unnamed.
+.Pp
+.Nm Iface
+nodes have a single hook corresponding to each supported protocol.
+Packets transmitted via the interface flow out the corresponding
+protocol-specific hook.
+Similarly, packets received on a hook appear on the interface as
+packets received in the corresponding protocol.
+.Pp
+The currently supported protocols are IP, IPX, AppleTalk, and NS.
+In the KLD module, only support for IP is compiled in by default.
+.Pp
+.Nm Iface
+nodes support the Berkeley Packet Filter (BPF).
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv inet
+Transmission and reception of IP packets.
+.It Dv ipx
+Transmission and reception of IPX packets.
+.It Dv atalk
+Transmission and reception of AppleTalk packets.
+.It Dv ns
+Transmission and reception of NS packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_IFACE_GET_IFNAME
+Returns the name of the interface corresponding to this node in a
+.Dv "struct ng_iface_ifname" :
+.Bd -literal -offset 4n
+struct ng_iface_ifname {
+ char ngif_name[NG_IFACE_IFACE_NAME_MAX + 1];
+};
+.Ed
+.It Dv NGM_IFACE_GET_IFADDRS
+Returns the list of addresses associated with this interface.
+The list is returned in the same format as the
+.Dv SIOCGIFCONF
+ioctl().
+.It Dv NGM_CISCO_GET_IPADDR
+This message is defined by the
+.Xr ng_cisco 8
+node type; see
+.Xr ng_cisco 8
+for a description.
+.El
+.Sh SHUTDOWN
+Because it is currently not possible to remove a system networking
+interface in FreeBSD,
+.Nm iface
+nodes are
+.Em persistent.
+That is, once created they are never destroyed.
+The receipt of a
+.Dv NGM_SHUTDOWN
+control message disconnects all hooks but does not remove the node.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr bpf 4 ,
+.Xr ng_cisco 8 ,
+.Xr ng_ppp 8 ,
+.Xr ng_rfc1490 8 ,
+.Xr ngctl 8 ,
+.Xr ifconfig 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/iface/ng_iface.8 b/sys/modules/netgraph/iface/ng_iface.8
new file mode 100644
index 0000000..376b5c5
--- /dev/null
+++ b/sys/modules/netgraph/iface/ng_iface.8
@@ -0,0 +1,126 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_IFACE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_iface
+.Nd interface netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_iface.h>
+.Sh DESCRIPTION
+An
+.Nm iface
+node is both a netgraph node and a system networking interface. When an
+.Nm iface
+node is created, a new point-to-point interface appears which is accessible via
+.Xr ifconfig 8 .
+The new interfaces are named
+.Dv ng0 ,
+.Dv ng1 ,
+etc. The node is assigned the same name as its interface, unless the name
+already exists, in which case the node remains unnamed.
+.Pp
+.Nm Iface
+nodes have a single hook corresponding to each supported protocol.
+Packets transmitted via the interface flow out the corresponding
+protocol-specific hook.
+Similarly, packets received on a hook appear on the interface as
+packets received in the corresponding protocol.
+.Pp
+The currently supported protocols are IP, IPX, AppleTalk, and NS.
+In the KLD module, only support for IP is compiled in by default.
+.Pp
+.Nm Iface
+nodes support the Berkeley Packet Filter (BPF).
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv inet
+Transmission and reception of IP packets.
+.It Dv ipx
+Transmission and reception of IPX packets.
+.It Dv atalk
+Transmission and reception of AppleTalk packets.
+.It Dv ns
+Transmission and reception of NS packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_IFACE_GET_IFNAME
+Returns the name of the interface corresponding to this node in a
+.Dv "struct ng_iface_ifname" :
+.Bd -literal -offset 4n
+struct ng_iface_ifname {
+ char ngif_name[NG_IFACE_IFACE_NAME_MAX + 1];
+};
+.Ed
+.It Dv NGM_IFACE_GET_IFADDRS
+Returns the list of addresses associated with this interface.
+The list is returned in the same format as the
+.Dv SIOCGIFCONF
+ioctl().
+.It Dv NGM_CISCO_GET_IPADDR
+This message is defined by the
+.Xr ng_cisco 8
+node type; see
+.Xr ng_cisco 8
+for a description.
+.El
+.Sh SHUTDOWN
+Because it is currently not possible to remove a system networking
+interface in FreeBSD,
+.Nm iface
+nodes are
+.Em persistent.
+That is, once created they are never destroyed.
+The receipt of a
+.Dv NGM_SHUTDOWN
+control message disconnects all hooks but does not remove the node.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr bpf 4 ,
+.Xr ng_cisco 8 ,
+.Xr ng_ppp 8 ,
+.Xr ng_rfc1490 8 ,
+.Xr ngctl 8 ,
+.Xr ifconfig 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/ksocket/Makefile b/sys/modules/netgraph/ksocket/Makefile
new file mode 100644
index 0000000..5baadf7
--- /dev/null
+++ b/sys/modules/netgraph/ksocket/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+KMOD= ng_ksocket
+SRCS= ng_ksocket.c
+MAN8= ng_ksocket.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/ksocket/ng_ksocket.4 b/sys/modules/netgraph/ksocket/ng_ksocket.4
new file mode 100644
index 0000000..d32c2cf
--- /dev/null
+++ b/sys/modules/netgraph/ksocket/ng_ksocket.4
@@ -0,0 +1,178 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 15, 1999
+.Dt NG_KSOCKET 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_ksocket
+.Nd kernel socket netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_ksocket.h>
+.Sh DESCRIPTION
+A
+.Nm ksocket
+node is both a netgraph node and a BSD socket. The
+.Nm ksocket
+node type allows one to open a socket inside the kernel and have
+it appear as a Netgraph node. The
+.Nm ksocket
+node type is the reverse of the socket node type (see
+.Xr ng_socket 8 "):"
+whereas the socket node type enables the user-level manipulation (via
+a socket) of what is normally a kernel-level entity (the associated
+Netgraph node), the
+.Nm ksocket
+node type enables the kernel-level manipulation (via a Netgraph node) of
+what is normally a user-level entity (the associated socket).
+.Pp
+A
+.Nm ksocket
+node allows at most one hook connection. Connecting to the node is
+equivalent to opening the associated socket. The name given to the hook
+determines what kind of socket the node will open (see below).
+When the hook is disconnected and/or the node is shutdown, the
+associated socket is closed.
+.Sh HOOKS
+This node type supports a single hook connection at a time.
+The name of the hook must be of the form
+.Dv Em <family>/<type>/<proto> ,
+where the
+.Dv Em family ,
+.Dv Em type ,
+and
+.Dv Em proto
+are the decimal equivalent of the same arguments to
+.Xr socket 2 .
+Alternately, aliases for the commonly used values are accepted as
+well. For example
+.Dv inet/dgram/udp
+is a more readable but equivalent version of
+.Dv 2/2/17 .
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_KSOCKET_BIND
+This functions exactly like the
+.Xr bind 2
+system call. The
+.Dv "struct sockaddr"
+socket address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_LISTEN
+This functions exactly like the
+.Xr listen 2
+system call. The backlog paramter (a single 32 bit
+.Dv int )
+should be supplied as an argument.
+.It Dv NGM_KSOCKET_CONNECT
+This functions exactly like the
+.Xr connect 2
+system call. The
+.Dv "struct sockaddr"
+destination address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_ACCEPT
+Currently unimplemented.
+.It Dv NGM_KSOCKET_GETNAME
+Equivalent to the
+.Xr getname 2
+system call. The name is returned as a
+.Dv "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_GETPEERNAME
+Equivalent to the
+.Xr getpeername 2
+system call. The name is returned as a
+.Dv "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_SETOPT
+Equivalent to the
+.Xr setsockopt 2
+system call, except that the option name, level, and value are passed in a
+.Dv "struct ng_ksocket_sockopt" .
+.It Dv NGM_KSOCKET_GETOPT
+Equivalent to the
+.Xr getsockopt 2
+system call, except that the option is passed in a
+.Dv "struct ng_ksocket_sockopt" .
+When sending this command, the
+.Dv value
+field should be empty; upon return, it will contain the
+retrieved value.
+.El
+.Pp
+.Sh ASCII FORM CONTROL MESSAGES
+For control messages that pass a
+.Dv "struct sockaddr"
+in the argument field, the normal ASCII equivalent of the C structure
+is an acceptable form. For the
+.Dv PF_INET
+and
+.Dv PF_LOCAL
+address families, a more convenient form is also used, which is
+the protocol family name, followed by a slash, followed by the actual
+address. For
+.Dv PF_INET ,
+the address is an IP address followed by an optional colon and port number.
+For
+.Dv PF_LOCAL ,
+the address is the pathname as a doubly quoted string.
+.Pp
+Examples:
+.Bl -tag -width XXXXXXXXXX
+.It Dv PF_LOCAL
+inet/192.168.1.1:1234
+.It Dv PF_INET
+local/"/tmp/foo.socket"
+.It Other
+.Dv "{ family=16 len=16 data=[ 0x70 0x00 0x01 0x23 ] }"
+.El
+.Pp
+For control messages that pass a
+.Dv "struct ng_ksocket_sockopt" ,
+the normal ASCII form for that structure is used. In the future, more
+convenient encoding of the more common socket options may be supported.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when the hook is disconnected.
+Shutdown of the node closes the associated socket.
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 4 ,
+.Xr ng_socket 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/ksocket/ng_ksocket.8 b/sys/modules/netgraph/ksocket/ng_ksocket.8
new file mode 100644
index 0000000..d32c2cf
--- /dev/null
+++ b/sys/modules/netgraph/ksocket/ng_ksocket.8
@@ -0,0 +1,178 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 15, 1999
+.Dt NG_KSOCKET 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_ksocket
+.Nd kernel socket netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_ksocket.h>
+.Sh DESCRIPTION
+A
+.Nm ksocket
+node is both a netgraph node and a BSD socket. The
+.Nm ksocket
+node type allows one to open a socket inside the kernel and have
+it appear as a Netgraph node. The
+.Nm ksocket
+node type is the reverse of the socket node type (see
+.Xr ng_socket 8 "):"
+whereas the socket node type enables the user-level manipulation (via
+a socket) of what is normally a kernel-level entity (the associated
+Netgraph node), the
+.Nm ksocket
+node type enables the kernel-level manipulation (via a Netgraph node) of
+what is normally a user-level entity (the associated socket).
+.Pp
+A
+.Nm ksocket
+node allows at most one hook connection. Connecting to the node is
+equivalent to opening the associated socket. The name given to the hook
+determines what kind of socket the node will open (see below).
+When the hook is disconnected and/or the node is shutdown, the
+associated socket is closed.
+.Sh HOOKS
+This node type supports a single hook connection at a time.
+The name of the hook must be of the form
+.Dv Em <family>/<type>/<proto> ,
+where the
+.Dv Em family ,
+.Dv Em type ,
+and
+.Dv Em proto
+are the decimal equivalent of the same arguments to
+.Xr socket 2 .
+Alternately, aliases for the commonly used values are accepted as
+well. For example
+.Dv inet/dgram/udp
+is a more readable but equivalent version of
+.Dv 2/2/17 .
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_KSOCKET_BIND
+This functions exactly like the
+.Xr bind 2
+system call. The
+.Dv "struct sockaddr"
+socket address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_LISTEN
+This functions exactly like the
+.Xr listen 2
+system call. The backlog paramter (a single 32 bit
+.Dv int )
+should be supplied as an argument.
+.It Dv NGM_KSOCKET_CONNECT
+This functions exactly like the
+.Xr connect 2
+system call. The
+.Dv "struct sockaddr"
+destination address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_ACCEPT
+Currently unimplemented.
+.It Dv NGM_KSOCKET_GETNAME
+Equivalent to the
+.Xr getname 2
+system call. The name is returned as a
+.Dv "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_GETPEERNAME
+Equivalent to the
+.Xr getpeername 2
+system call. The name is returned as a
+.Dv "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_SETOPT
+Equivalent to the
+.Xr setsockopt 2
+system call, except that the option name, level, and value are passed in a
+.Dv "struct ng_ksocket_sockopt" .
+.It Dv NGM_KSOCKET_GETOPT
+Equivalent to the
+.Xr getsockopt 2
+system call, except that the option is passed in a
+.Dv "struct ng_ksocket_sockopt" .
+When sending this command, the
+.Dv value
+field should be empty; upon return, it will contain the
+retrieved value.
+.El
+.Pp
+.Sh ASCII FORM CONTROL MESSAGES
+For control messages that pass a
+.Dv "struct sockaddr"
+in the argument field, the normal ASCII equivalent of the C structure
+is an acceptable form. For the
+.Dv PF_INET
+and
+.Dv PF_LOCAL
+address families, a more convenient form is also used, which is
+the protocol family name, followed by a slash, followed by the actual
+address. For
+.Dv PF_INET ,
+the address is an IP address followed by an optional colon and port number.
+For
+.Dv PF_LOCAL ,
+the address is the pathname as a doubly quoted string.
+.Pp
+Examples:
+.Bl -tag -width XXXXXXXXXX
+.It Dv PF_LOCAL
+inet/192.168.1.1:1234
+.It Dv PF_INET
+local/"/tmp/foo.socket"
+.It Other
+.Dv "{ family=16 len=16 data=[ 0x70 0x00 0x01 0x23 ] }"
+.El
+.Pp
+For control messages that pass a
+.Dv "struct ng_ksocket_sockopt" ,
+the normal ASCII form for that structure is used. In the future, more
+convenient encoding of the more common socket options may be supported.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when the hook is disconnected.
+Shutdown of the node closes the associated socket.
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 4 ,
+.Xr ng_socket 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/lmi/Makefile b/sys/modules/netgraph/lmi/Makefile
new file mode 100644
index 0000000..9b4c07e
--- /dev/null
+++ b/sys/modules/netgraph/lmi/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/01/19 19:39:21 archie Exp $
+
+KMOD= ng_lmi
+SRCS= ng_lmi.c
+MAN8= ng_lmi.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/lmi/ng_lmi.4 b/sys/modules/netgraph/lmi/ng_lmi.4
new file mode 100644
index 0000000..2ce52a7
--- /dev/null
+++ b/sys/modules/netgraph/lmi/ng_lmi.4
@@ -0,0 +1,130 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_lmi.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_LMI 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_lmi
+.Nd Frame relay LMI protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_lmi.h>
+.Sh DESCRIPTION
+The
+.Nm lmi
+node type performs the frame relay LMI protocol. It supports
+the ITU Annex A, ANSI Annex D, and Group-of-four LMI types.
+It also supports auto-detection of the LMI type.
+.Pp
+To enable a specific LMI type, connect the corresponding hook (
+.Dv annexA ,
+.Dv annexD ,
+or
+.Dv group4 ")"
+to DLCI 0 or 1023 of a
+.Xr ng_frame_relay 8
+node.
+Typically, Annex A and Annex D live on DLCI 0 while Group-of-four
+lives on DLCI 1023.
+.Pp
+To enable LMI type auto-detection, connect the
+.Dv auto0
+hook to DLCI 0 and the
+.Dv auto1023
+hook to DLCI 1023. The node will attempt to automatically determine
+which LMI type is running at the switch, and go into that mode.
+.Pp
+Only one fixed LMI type, or auto-detection, can be active at any given time.
+.Pp
+The
+.Dv NGM_LMI_GET_STATUS
+control message can be used at any time to query the current status
+of the LMI protocol and each DLCI channel. This node also supports the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbaz
+.It Dv annexA
+ITU Annex A LMI hook.
+.It Dv annexD
+ANSI Annex D LMI hook.
+.It Dv group4
+Group-of-four LMI hook.
+.It Dv auto0
+Auto-detection hook for DLCI 0.
+.It Dv auto1023
+Auto-detection hook for DLCI 1023.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_LMI_GET_STATUS
+This command returns status information in a
+.Dv "struct nglmistat" :
+.Bd -literal -offset 4n
+#define NGM_LMI_STAT_ARYSIZE (1024/8)
+
+struct nglmistat {
+ u_char proto[12]; /* Active proto (same as hook name) */
+ u_char hook[12]; /* Active hook */
+ u_char fixed; /* If set to fixed LMI mode */
+ u_char autod; /* If currently auto-detecting */
+ u_char seen[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs seen */
+ u_char up[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs up */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns is a human-readable version of the node status.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 8 ,
+.Xr ngctl 8 .
+.Rs
+.%T "ANSI T1.617-1991 Annex D"
+.Re
+.Rs
+.%T "ITU-T Q.933 Digital Subscriber Signaling System No. 1 - Signaling Specification for Frame Mode Basic Call Control, Annex A"
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/lmi/ng_lmi.8 b/sys/modules/netgraph/lmi/ng_lmi.8
new file mode 100644
index 0000000..2ce52a7
--- /dev/null
+++ b/sys/modules/netgraph/lmi/ng_lmi.8
@@ -0,0 +1,130 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_lmi.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_LMI 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_lmi
+.Nd Frame relay LMI protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_lmi.h>
+.Sh DESCRIPTION
+The
+.Nm lmi
+node type performs the frame relay LMI protocol. It supports
+the ITU Annex A, ANSI Annex D, and Group-of-four LMI types.
+It also supports auto-detection of the LMI type.
+.Pp
+To enable a specific LMI type, connect the corresponding hook (
+.Dv annexA ,
+.Dv annexD ,
+or
+.Dv group4 ")"
+to DLCI 0 or 1023 of a
+.Xr ng_frame_relay 8
+node.
+Typically, Annex A and Annex D live on DLCI 0 while Group-of-four
+lives on DLCI 1023.
+.Pp
+To enable LMI type auto-detection, connect the
+.Dv auto0
+hook to DLCI 0 and the
+.Dv auto1023
+hook to DLCI 1023. The node will attempt to automatically determine
+which LMI type is running at the switch, and go into that mode.
+.Pp
+Only one fixed LMI type, or auto-detection, can be active at any given time.
+.Pp
+The
+.Dv NGM_LMI_GET_STATUS
+control message can be used at any time to query the current status
+of the LMI protocol and each DLCI channel. This node also supports the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbaz
+.It Dv annexA
+ITU Annex A LMI hook.
+.It Dv annexD
+ANSI Annex D LMI hook.
+.It Dv group4
+Group-of-four LMI hook.
+.It Dv auto0
+Auto-detection hook for DLCI 0.
+.It Dv auto1023
+Auto-detection hook for DLCI 1023.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_LMI_GET_STATUS
+This command returns status information in a
+.Dv "struct nglmistat" :
+.Bd -literal -offset 4n
+#define NGM_LMI_STAT_ARYSIZE (1024/8)
+
+struct nglmistat {
+ u_char proto[12]; /* Active proto (same as hook name) */
+ u_char hook[12]; /* Active hook */
+ u_char fixed; /* If set to fixed LMI mode */
+ u_char autod; /* If currently auto-detecting */
+ u_char seen[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs seen */
+ u_char up[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs up */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns is a human-readable version of the node status.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 8 ,
+.Xr ngctl 8 .
+.Rs
+.%T "ANSI T1.617-1991 Annex D"
+.Re
+.Rs
+.%T "ITU-T Q.933 Digital Subscriber Signaling System No. 1 - Signaling Specification for Frame Mode Basic Call Control, Annex A"
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/netgraph/Makefile b/sys/modules/netgraph/netgraph/Makefile
new file mode 100644
index 0000000..eaaf4ac
--- /dev/null
+++ b/sys/modules/netgraph/netgraph/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:22 archie Exp $
+
+KMOD= netgraph
+SRCS= ng_base.c ng_parse.c
+MAN4= netgraph.4
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/netgraph/netgraph.4 b/sys/modules/netgraph/netgraph/netgraph.4
new file mode 100644
index 0000000..46cc658
--- /dev/null
+++ b/sys/modules/netgraph/netgraph/netgraph.4
@@ -0,0 +1,980 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Authors: Julian Elischer <julian@whistle.com>
+.\" Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $
+.\"
+.Dd January 19, 1999
+.Dt NETGRAPH 4
+.Os FreeBSD
+.Sh NAME
+.Nm netgraph
+.Nd graph based kernel networking subsystem
+.Sh DESCRIPTION
+The
+.Nm
+system provides a uniform and modular system for the implementation
+of kernel objects which perform various networking functions. The objects,
+known as
+.Em nodes ,
+can be arranged into arbitrarily complicated graphs. Nodes have
+.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
+.Nm
+is to supplement rather than replace the existing kernel networking
+infrastructure. It provides:
+.Pp
+.Bl -bullet -compact -offset 2n
+.It
+A flexible way of combining protocol and link level drivers
+.It
+A modular way to implement new protocols
+.It
+A common framework for kernel entities to inter-communicate
+.It
+A reasonably fast, kernel-based implementation
+.El
+.Sh Nodes and Types
+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.
+A node's type is described by a unique ASCII type name.
+The type implies what the node does and how it may be connected
+to other nodes.
+.Pp
+In object-oriented language, types are classes and nodes are instances
+of their respective class. All node types are subclasses of the generic node
+type, and hence inherit certain common functionality and capabilities
+(e.g., the ability to have an ASCII name).
+.Pp
+Nodes may be assigned a globally unique ASCII name which can be
+used to refer to the node.
+The name must not contain the characters ``.'' or ``:'' and is limited to
+.Dv "NG_NODELEN + 1"
+characters (including NUL byte).
+.Pp
+Each node instance has a unique
+.Em ID number
+which is expressed as a 32-bit hex value. This value may be used to
+refer to a node when there is no ASCII name assigned to it.
+.Sh Hooks
+Nodes are connected to other nodes by connecting a pair of
+.Em hooks ,
+one from each node. Data flows bidirectionally between nodes along
+connected pairs of hooks. A node may have as many hooks as it
+needs, and may assign whatever meaning it wants to a hook.
+.Pp
+Hooks have these properties:
+.Pp
+.Bl -bullet -compact -offset 2n
+.It
+A hook has an ASCII name which is unique among all hooks
+on that node (other hooks on other nodes may have the same name).
+The name must not contain a ``.'' or a ``:'' and is
+limited to
+.Dv "NG_HOOKLEN + 1"
+characters (including NUL byte).
+.It
+A hook is always connected to another hook. That is, hooks are
+created at the time they are connected, and breaking an edge by
+removing either hook destroys both hooks.
+.El
+.Pp
+A node may decide to assign special meaning to some hooks.
+For example, connecting to the hook named ``debug'' might trigger
+the node to start sending debugging information to that hook.
+.Sh Data Flow
+Two types of information flow between nodes: data messages and
+control messages. Data messages are passed in mbuf chains along the edges
+in the graph, one edge at a time. The first mbuf in a chain must have the
+.Dv M_PKTHDR
+flag set. Each node decides how to handle data coming in on its hooks.
+.Pp
+Control messages are type-specific C structures sent from one node
+directly to some arbitrary other node. Control messages have a common
+header format, followed by type-specific data, and are binary structures
+for efficiency. However, node types also may support conversion of the
+type specific data between binary and
+ASCII for debugging and human interface purposes (see the
+.Dv NGM_ASCII2BINARY
+and
+.Dv NGM_BINARY2ASCII
+generic control messages below). Nodes are not required to support
+these conversions.
+.Pp
+There are two ways to address a control message. If
+there is a sequence of edges connecting the two nodes, the message
+may be ``source routed'' by specifying the corresponding sequence
+of hooks as the destination address for the message (relative
+addressing). Otherwise, the recipient node global ASCII name
+(or equivalent ID based name) is used as the destination address
+for the message (absolute addressing). The two types of addressing
+may be combined, by specifying an absolute start node and a sequence
+of hooks.
+.Pp
+Messages often represent commands that are followed by a reply message
+in the reverse direction. To facilitate this, the recipient of a
+control message is supplied with a ``return address'' that is suitable
+for addressing a reply.
+.Pp
+Each control message contains a 32 bit value called a
+.Em typecookie
+indicating the type of the message, i.e., how to interpret it.
+Typically each type defines a unique typecookie for the messages
+that it understands. However, a node may choose to recognize and
+implement more than one type of message.
+.Sh Netgraph is Functional
+In order to minimize latency, most
+.Nm netgraph
+operations are functional.
+That is, data and control messages are delivered by making function
+calls rather than by using queues and mailboxes. For example, if node
+A wishes to send a data mbuf to neighboring node B, it calls the
+generic
+.Nm
+data delivery function. This function in turn locates
+node B and calls B's ``receive data'' method. While this mode of operation
+results in good performance, it has a few implications for node
+developers:
+.Pp
+.Bl -bullet -compact -offset 2n
+.It
+Whenever a node delivers a data or control message, the node
+may need to allow for the possibility of receiving a returning message
+before the original delivery function call returns.
+.It
+Netgraph nodes and support routines generally run at
+.Dv "splnet()" .
+However, some nodes may want to send data and control messages
+from a different priority level. Netgraph supplies queueing routines which
+utilize the NETISR system to move message delivery to
+.Dv "splnet()" .
+Note that messages are always received at
+.Dv "splnet()" .
+.It
+It's possible for an infinite loop to occur if the graph contains cycles.
+.El
+.Pp
+So far, these issues have not proven problematical in practice.
+.Sh Interaction With Other Parts of the Kernel
+A node may have a hidden interaction with other components of the
+kernel outside of the
+.Nm
+subsystem, such as device hardware,
+kernel protocol stacks, etc. In fact, one of the benefits of
+.Nm
+is the ability to join disparate kernel networking entities together in a
+consistent communication framework.
+.Pp
+An example is the node type
+.Em socket
+which is both a netgraph node and a
+.Xr socket 2
+BSD socket in the protocol family
+.Dv PF_NETGRAPH .
+Socket nodes allow user processes to participate in
+.Nm netgraph .
+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.
+.Sh Node Methods
+Nodes are notified of the following actions via function calls
+to the following node methods (all at
+.Dv "splnet()" )
+and may accept or reject that action (by returning the appropriate
+error code):
+.Bl -tag -width xxx
+.It Creation of a new node
+The constructor for the type is called. If creation of a new node is
+allowed, the constructor must call the generic node creation
+function (in object-oriented terms, the superclass constructor)
+and then allocate any special resources it needs. For nodes that
+correspond to hardware, this is typically done during the device
+attach routine. Often a global ASCII name corresponding to the
+device name is assigned here as well.
+.It Creation of a new hook
+The hook is created and tentatively
+linked to the node, and the node is told about the name that will be
+used to describe this hook. The node sets up any special data structures
+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
+find out who their peer is across the link and can then decide to reject
+the connection. Tear-down is automatic.
+.It Destruction of a hook
+The node is notified of a broken connection. The node may consider some hooks
+to be critical to operation and others to be expendable: the disconnection
+of one hook may be an acceptable event while for another it
+may effect a total shutdown for the node.
+.It Shutdown of a node
+This method allows a node to clean up
+and to ensure that any actions that need to be performed
+at this time are taken. The method must call the generic (i.e., superclass)
+node destructor to get rid of the generic components of the node.
+Some nodes (usually associated with a piece of hardware) may be
+.Em persistent
+in that a shutdown breaks all edges and resets the node,
+but doesn't remove it, in which case the generic destructor is not called.
+.El
+.Sh Sending and Receiving Data
+Three other methods are also supported by all nodes:
+.Bl -tag -width xxx
+.It Receive data message
+An mbuf chain is passed to the node.
+The node is notified on which hook the data arrived,
+and can use this information in its processing decision.
+The node must must always
+.Dv m_freem()
+the mbuf chain on completion or error, or pass it on to another node
+(or kernel module) which will then be responsible for freeing it.
+.Pp
+In addition to the mbuf chain itself there is also a pointer to a
+structure describing meta-data about the message
+(e.g. priority information). This pointer may be
+.Dv NULL
+if there is no additional information. The format for this information is
+described in
+.Dv netgraph.h .
+The memory for meta-data must allocated via
+.Dv malloc()
+with type
+.Dv M_NETGRAPH .
+As with the data itself, it is the receiver's responsibility to
+.Dv free()
+the meta-data. If the mbuf chain is freed the meta-data must
+be freed at the same time. If the meta-data is freed but the
+real data on is passed on, then a
+.Dv NULL
+pointer must be substituted.
+.Pp
+The receiving node may decide to defer the data by queueing it in the
+.Nm
+NETISR system (see below).
+.Pp
+The structure and use of meta-data is still experimental, but is presently used in
+frame-relay to indicate that management packets should be queued for transmission
+at a higher priority than data packets. This is required for
+conformance with Frame Relay standards.
+.Pp
+.It Receive queued data message
+Usually this will be the same function as
+.Em Receive data message.
+This is the entry point called when a data message is being handed to
+the node after having been queued in the NETISR system.
+This allows a node to decide in the
+.Em Receive data message
+method that a message should be deferred and queued,
+and be sure that when it is processed from the queue,
+it will not be queued again.
+.It Receive control message
+This method is called when a control message is addressed to the node.
+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.
+.Pp
+It is possible for a synchronous reply to be made, and in fact this
+is more common in practice.
+This is done by setting a pointer (supplied as an extra function parameter)
+to point to the reply.
+Then when the control message delivery function returns,
+the caller can check if this pointer has been made non-NULL,
+and if so then it points to the reply message allocated via
+.Dv malloc()
+and containing the synchronous response. In both directions,
+(request and response) it is up to the
+receiver of that message to
+.Dv free()
+the control message buffer. All control messages and replies are
+allocated with
+.Dv malloc()
+type
+.Dv M_NETGRAPH .
+.El
+.Pp
+Much use has been made of reference counts, so that nodes being
+free'd of all references are automatically freed, and this behaviour
+has been tested and debugged to present a consistent and trustworthy
+framework for the ``type module'' writer to use.
+.Sh Addressing
+The
+.Nm
+framework provides an unambiguous and simple to use method of specifically
+addressing any single node in the graph. The naming of a node is
+independent of its type, in that another node, or external component
+need not know anything about the node's type in order to address it so as
+to send it a generic message type. Node and hook names should be
+chosen so as to make addresses meaningful.
+.Pp
+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
+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.
+The name ``.'' (referred to as ``.:'') always refers to the local node.
+Also, nodes that have no global name may be addressed by their ID numbers,
+by enclosing the hex representation of the ID number within square brackets.
+Here are some examples of valid netgraph addresses:
+.Bd -literal -offset 4n -compact
+
+ .:
+ foo:
+ .:hook1
+ foo:hook1.hook2
+ [f057cd80]:hook1
+.Ed
+.Pp
+Consider the following set of nodes might be created for a site with
+a single physical frame relay line having two active logical DLCI channels,
+with RFC-1490 frames on DLCI 16 and PPP frames over DLCI 20:
+.Pp
+.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
+.Em "Frame1:uplink.dlci16" .
+Similarly,
+.Em "Frame1:uplink.dlci20"
+could reliably be used to reach node D, and node A could refer
+to node B as
+.Em ".:uplink" ,
+or simply
+.Em "uplink" .
+Conversely, B can refer to A as
+.Em "data" .
+The address
+.Em "mux.data"
+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 .
+Data messages are routed one hop at a time, by specifying the departing
+hook, with each node making the next routing decision. So when B
+receives a frame on hook
+.Em data
+it decodes the frame relay header to determine the DLCI,
+and then forwards the unwrapped frame to either C or D.
+.Pp
+A similar graph might be used to represent multi-link PPP running
+over an ISDN line:
+.Pp
+.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
+.Sh Netgraph Structures
+Interesting members of the node and hook structures are shown below:
+.Bd -literal
+struct ng_node {
+ char *name; /* Optional globally unique name */
+ void *private; /* Node implementation private info */
+ struct ng_type *type; /* The type of this node */
+ int refs; /* Number of references to this struct */
+ int numhooks; /* Number of connected hooks */
+ hook_p hooks; /* Linked list of (connected) hooks */
+};
+typedef struct ng_node *node_p;
+
+struct ng_hook {
+ char *name; /* This node's name for this hook */
+ void *private; /* Node implementation private info */
+ int refs; /* Number of references to this struct */
+ struct ng_node *node; /* The node this hook is attached to */
+ struct ng_hook *peer; /* The other hook in this connected pair */
+ struct ng_hook *next; /* Next in list of hooks for this node */
+};
+typedef struct ng_hook *hook_p;
+.Ed
+.Pp
+The maintenance of the name pointers, reference counts, and linked list
+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
+structure, which counts as a new reference that must be registered by
+incrementing
+.Dv "node->refs" .
+.Pp
+From a hook you can obtain the corresponding node, and from
+a node the list of all active hooks.
+.Pp
+Node types are described by these structures:
+.Bd -literal
+/** How to convert a control message from binary <-> ASCII */
+struct ng_cmdlist {
+ u_int32_t cookie; /* typecookie */
+ int cmd; /* command number */
+ const char *name; /* command name */
+ const struct ng_parse_type *mesgType; /* args if !NGF_RESP */
+ const struct ng_parse_type *respType; /* args if NGF_RESP */
+};
+
+struct ng_type {
+ u_int32_t version; /* Must equal NG_VERSION */
+ const char *name; /* Unique type name */
+
+ /* Module event handler */
+ modeventhand_t mod_event; /* Handle load/unload (optional) */
+
+ /* Constructor */
+ int (*constructor)(node_p *node); /* Create a new node */
+
+ /** Methods using the node **/
+ int (*rcvmsg)(node_p node, /* Receive control message */
+ struct ng_mesg *msg, /* The message */
+ const char *retaddr, /* Return address */
+ struct ng_mesg **resp); /* Synchronous response */
+ int (*shutdown)(node_p node); /* Shutdown this node */
+ int (*newhook)(node_p node, /* create a new hook */
+ hook_p hook, /* Pre-allocated struct */
+ const char *name); /* Name for new hook */
+
+ /** Methods using the hook **/
+ int (*connect)(hook_p hook); /* Confirm new hook attachment */
+ int (*rcvdata)(hook_p hook, /* Receive data on a hook */
+ struct mbuf *m, /* The data in an mbuf */
+ meta_p meta); /* Meta-data, if any */
+ int (*disconnect)(hook_p hook); /* Notify disconnection of hook */
+
+ /** How to convert control messages binary <-> ASCII */
+ const struct ng_cmdlist *cmdlist; /* Optional; may be NULL */
+};
+.Ed
+.Pp
+Control messages have the following structure:
+.Bd -literal
+#define NG_CMDSTRLEN 15 /* Max command string (16 with null) */
+
+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 */
+ u_char cmdstr[NG_CMDSTRLEN+1]; /* Cmd string (for debug) */
+ } header;
+ char data[0]; /* Start of cmd/resp data */
+};
+
+#define NG_VERSION 1 /* Netgraph version */
+#define NGF_ORIG 0x0000 /* Command */
+#define NGF_RESP 0x0001 /* Response */
+.Ed
+.Pp
+Control messages have the fixed header shown above, followed by a
+variable length data section which depends on the type cookie
+and the command. Each field is explained below:
+.Bl -tag -width xxx
+.It Dv version
+Indicates the version of netgraph itself. The current version is
+.Dv NG_VERSION .
+.It Dv arglen
+This is the length of any extra arguments, which begin at
+.Dv data .
+.It Dv flags
+Indicates whether this is a command or a response control message.
+.It Dv token
+The
+.Dv token
+is a means by which a sender can match a reply message to the
+corresponding command message; the reply always has the same token.
+.Pp
+.It Dv typecookie
+The corresponding node type's unique 32-bit value.
+If a node doesn't recognize the type cookie it must reject the message
+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.
+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
+(i.e., the output of
+.Dv "date -u +'%s'" ")."
+.Pp
+There is a predefined typecookie
+.Dv NGM_GENERIC_COOKIE
+for the ``generic'' node type, and
+a corresponding set of generic messages which all nodes understand.
+The handling of these messages is automatic.
+.It Dv command
+The identifier for the message command. This is type specific,
+and is defined in the same header file as the typecookie.
+.It Dv cmdstr
+Room for a short human readable version of ``command'' (for debugging
+purposes only).
+.El
+.Pp
+Some modules may choose to implement messages from more than one
+of the header files and thus recognize more than one type cookie.
+.Sh Control Message ASCII Form
+Control messages are in binary format for efficiency. However, for
+debugging and human interface purposes, and if the node type supports
+it, control messages may be converted to and from an equivalent ASCII
+form. The ASCII form is similar to the binary form, with two exceptions:
+.Pp
+.Bl -tag -compact -width xxx
+.It o
+The
+.Dv cmdstr
+header field must contain the ASCII name of the command, corresponding to the
+.Dv cmd
+header field.
+.It o
+The
+.Dv args
+field contains a NUL-terminated ASCII string version of the message arguments.
+.El
+.Pp
+In general, the arguments field of a control messgage can be any
+arbitrary C data type. Netgraph includes parsing routines to support
+some pre-defined datatypes in ASCII with this simple syntax:
+.Pp
+.Bl -tag -compact -width xxx
+.It o
+Integer types are represented by base 8, 10, or 16 numbers.
+.It o
+Strings are enclosed in double quotes and respect the normal
+C language backslash escapes.
+.It o
+IP addresses have the obvious form.
+.It o
+Arrays are enclosed in square brackets, with the elements listed
+consecutively starting at index zero. An element may have an optional
+index and equals sign preceeding it. Whenever an element
+does not have an explicit index, the index is implicitly the previous
+element's index plus one.
+.It o
+Structures are enclosed in curly braces, and each field is specified
+in the form ``fieldname=value''.
+.It o
+Any array element or structure field whose value is equal to its
+``default value'' may be omitted. For integer types, the default value
+is usually zero; for string types, the empty string.
+.It o
+Array elements and structure fields may be specified in any order.
+.El
+.Pp
+Each node type may define its own arbitrary types by providing
+the necessary routines to parse and unparse. ASCII forms defined
+for a specific node type are documented in the documentation for
+that node type.
+.Sh Generic Control Messages
+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
+.Dv ng_message.h
+along with the basic layout of messages and other similar information.
+.Bl -tag -width xxx
+.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
+might not disappear from the node namespace, but only reset themselves.
+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
+Assign a name to a node. Nodes can exist without having a name, and this
+is the default for nodes created using the
+.Dv NGM_MKPEER
+method. Such nodes can only be addressed relatively or by their ID number.
+.It Dv NGM_RMHOOK
+Ask the node to break a hook connection to one of its neighbours.
+Both nodes will have their ``disconnect'' method invoked.
+Either node may elect to totally shut down as a result.
+.It Dv NGM_NODEINFO
+Asks the target node to describe itself. The four returned fields
+are the node name (if named), the node type, the node ID and the
+number of hooks attached. The ID is an internal number unique to that node.
+.It Dv NGM_LISTHOOKS
+This returns the information given by
+.Dv NGM_NODEINFO ,
+but in addition
+includes an array of fields describing each link, and the description for
+the node at the far end of that link.
+.It Dv NGM_LISTNAMES
+This returns an array of node descriptions (as for
+.Dv NGM_NODEINFO ")"
+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
+This returns a list of all currently installed netgraph types.
+.It Dv NGM_TEXT_STATUS
+The node may return a text formatted status message.
+The status information is determined entirely by the node type.
+It is the only "generic" message
+that requires any support within the node itself and as such the node may
+elect to not support this message. The text response must be less than
+.Dv NG_TEXTRESPONSE
+bytes in length (presently 1024). This can be used to return general
+status information in human readable form.
+.It Dv NGM_BINARY2ASCII
+This message converts a binary control message to its ASCII form.
+The entire control message to be converted is contained within the
+arguments field of the
+.Dv Dv NGM_BINARY2ASCII
+message itself. If successful, the reply will contain the same control
+message in ASCII form.
+A node will typically only know how to translate messages that it
+itself understands, so the target node of the
+.Dv NGM_BINARY2ASCII
+is often the same node that would actually receive that message.
+.It Dv NGM_ASCII2BINARY
+The opposite of
+.Dv NGM_BINARY2ASCII .
+The entire control message to be converted, in ASCII form, is contained
+in the arguments section of the
+.Dv NGM_ASCII2BINARY
+and need only have the
+.Dv flags ,
+.Dv cmdstr ,
+and
+.Dv arglen
+header fields filled in, plus the NUL-terminated string version of
+the arguments in the arguments field. If successful, the reply
+contains the binary version of the control message.
+.El
+.Sh Metadata
+Data moving through the
+.Nm
+system can be accompanied by meta-data that describes some
+aspect of that data. The form of the meta-data is a fixed header,
+which contains enough information for most uses, and can optionally
+be supplemented by trailing
+.Em option
+structures, which contain a
+.Em cookie
+(see the section on control messages), an identifier, a length and optional
+data. If a node does not recognize the cookie associated with an option,
+it should ignore that option.
+.Pp
+Meta data might include such things as priority, discard eligibility,
+or special processing requirements. It might also mark a packet for
+debug status, etc. The use of meta-data is still experimental.
+.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
+.Bd -literal -offset 4n -compact
+
+ options NETGRAPH
+
+.Ed
+in your kernel configuration file. You may also include selected
+node types in the kernel compilation, for example:
+.Bd -literal -offset 4n -compact
+
+ options NETGRAPH
+ options NETGRAPH_SOCKET
+ options NETGRAPH_ECHO
+
+.Ed
+.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
+.Em type
+is made,
+.Nm
+will attempt to load the KLD module
+.Dv ng_type.ko .
+.Pp
+Types can also be installed at boot time, as certain device drivers
+may want to export each instance of the device as a netgraph node.
+.Pp
+In general, new types can be installed at any time from within the
+kernel by calling
+.Dv ng_newtype() ,
+supplying a pointer to the type's
+.Dv struct ng_type
+structure.
+.Pp
+The
+.Dv "NETGRAPH_INIT()"
+macro automates this process by using a linker set.
+.Sh EXISTING NODE TYPES
+Several node types currently exist. Each is fully documented
+in its own man page:
+.Bl -tag -width xxx
+.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.
+When both sockets have closed, the node will shut down. The
+.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
+calls, using a
+.Dv struct sockaddr_ng
+socket address.
+.Pp
+.It HOLE
+Responds only to generic messages and is a ``black hole'' for data,
+Useful for testing. Always accepts new hooks.
+.Pp
+.It ECHO
+Responds only to generic messages and always echoes data back through the
+hook from which it arrived. Returns any non generic messages as their
+own response. Useful for testing. Always accepts new hooks.
+.Pp
+.It TEE
+This node is useful for ``snooping.'' It has 4 hooks:
+.Dv left ,
+.Dv right ,
+.Dv left2right ,
+and
+.Dv right2left .
+Data entering from the right is passed to the left and duplicated on
+.Dv right2left,
+and data entering from the left is passed to the right and
+duplicated on
+.Dv left2right .
+Data entering from
+.Dv left2right
+is sent to the right and data from
+.Dv right2left
+to left.
+.Pp
+.It RFC1490 MUX
+Encapsulates/de-encapsulates frames encoded according to RFC 1490.
+Has a hook for the encapsulated packets (``downstream'') and one hook
+for each protocol (i.e., IP, PPP, etc.).
+.Pp
+.It FRAME RELAY MUX
+Encapsulates/de-encapsulates Frame Relay frames.
+Has a hook for the encapsulated packets (``downstream'') and one hook
+for each DLCI.
+.Pp
+.It FRAME RELAY LMI
+Automatically handles frame relay
+``LMI'' (link management interface) operations and packets.
+Automatically probes and detects which of several LMI standards
+is in use at the exchange.
+.Pp
+.It TTY
+This node is also a line discipline. It simply converts between mbuf
+frames and sequential serial data, allowing a tty to appear as a netgraph
+node. It has a programmable ``hotkey'' character.
+.Pp
+.It ASYNC
+This node encapsulates and de-encapsulates asynchronous frames
+according to RFC 1662. This is used in conjunction with the TTY node
+type for supporting PPP links over asynchronous serial lines.
+.Pp
+.It INTERFACE
+This node is also a system networking interface. It has hooks representing
+each protocol family (IP, AppleTalk, IPX, etc.) and appears in the output of
+.Xr ifconfig 8 .
+The interfaces are named
+.Em ng0 ,
+.Em ng1 ,
+etc.
+.El
+.Sh NOTES
+Whether a named node exists can be checked by trying to send a control message
+to it (e.g.,
+.Dv NGM_NODEINFO
+).
+If it does not exist,
+.Er ENOENT
+will be returned.
+.Pp
+All data messages are mbuf chains with the M_PKTHDR flag set.
+.Pp
+Nodes are responsible for freeing what they allocate.
+There are three exceptions:
+.Bl -tag -width xxxx
+.It 1
+Mbufs sent across a data link are never to be freed by the sender.
+.It 2
+Any meta-data information traveling with the data has the same restriction.
+It might be freed by any node the data passes through, and a
+.Dv NULL
+passed onwards, but the caller will never free it.
+Two macros
+.Dv "NG_FREE_META(meta)"
+and
+.Dv "NG_FREE_DATA(m, meta)"
+should be used if possible to free data and meta data (see
+.Dv netgraph.h ")."
+.It 3
+Messages sent using
+.Dv ng_send_message()
+are freed by the callee. As in the case above, the addresses
+associated with the message are freed by whatever allocated them so the
+recipient should copy them if it wants to keep that information.
+.El
+.Sh FILES
+.Bl -tag -width xxxxx -compact
+.It Pa /sys/netgraph/netgraph.h
+Definitions for use solely within the kernel by
+.Nm
+nodes.
+.It Pa /sys/netgraph/ng_message.h
+Definitions needed by any file that needs to deal with
+.Nm
+messages.
+.It Pa /sys/netgraph/ng_socket.h
+Definitions needed to use
+.Nm
+socket type nodes.
+.It Pa /sys/netgraph/ng_{type}.h
+Definitions needed to use
+.Nm
+{type}
+nodes, including the type cookie definition.
+.It Pa /modules/netgraph.ko
+Netgraph subsystem loadable KLD module.
+.It Pa /modules/ng_{type}.ko
+Loadable KLD module for node type {type}.
+.El
+.Sh USER MODE SUPPORT
+There is a library for supporting user-mode programs that wish
+to interact with the netgraph system. See
+.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
+.Em tee
+node type is also useful for debugging, especially in conjunction with
+.Xr ngctl 8
+and
+.Xr nghook 8 .
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 3 ,
+.Xr ngctl 8 ,
+.Xr nghook 8 ,
+.Xr ng_async 8 ,
+.Xr ng_cisco 8 ,
+.Xr ng_echo 8 ,
+.Xr ng_frame_relay 8 ,
+.Xr ng_hole 8 ,
+.Xr ng_iface 8 ,
+.Xr ng_ksocket 8 ,
+.Xr ng_lmi 8 ,
+.Xr ng_ppp 8 ,
+.Xr ng_pppoe 8 ,
+.Xr ng_rfc1490 8 ,
+.Xr ng_socket 8 ,
+.Xr ng_tee 8 ,
+.Xr ng_tty 8 ,
+.Xr ng_UI 8 ,
+.Xr ng_vjc 8 ,
+.Xr ng_{type} 8 .
+.Sh HISTORY
+The
+.Nm
+system was designed and first implemented at Whistle Communications, Inc.
+in a version FreeBSD 2.2 customized for the Whistle InterJet.
+.Sh AUTHORS
+Julian Elischer <julian@whistle.com>, with contributions by
+Archie Cobbs <archie@whistle.com>.
diff --git a/sys/modules/netgraph/ppp/Makefile b/sys/modules/netgraph/ppp/Makefile
new file mode 100644
index 0000000..590e10a
--- /dev/null
+++ b/sys/modules/netgraph/ppp/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/01/24 02:52:12 archie Exp $
+
+KMOD= ng_ppp
+SRCS= ng_ppp.c
+MAN8= ng_ppp.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/ppp/ng_ppp.4 b/sys/modules/netgraph/ppp/ng_ppp.4
new file mode 100644
index 0000000..ac23ee4
--- /dev/null
+++ b/sys/modules/netgraph/ppp/ng_ppp.4
@@ -0,0 +1,379 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_PPP 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_ppp
+.Nd PPP protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_ppp.h>
+.Sh DESCRIPTION
+The
+.Nm ppp
+node type performs multiplexing for the PPP protocol. It handles
+only packets that contain data, and forwards protocol negotiation
+and control packets to a separate controlling entity (e.g., a
+user-land daemon). This approach combines the fast dispatch of
+kernel implementations with the configuration flexibility of a
+user-land implementations. The PPP node type directly supports
+multi-link PPP, Van Jacobsen compression, PPP compression, PPP
+encryption, and the IP, IPX, and AppleTalk protocols. A single
+PPP node corresponds to one PPP multi-link bundle.
+.Pp
+There is a separate hook for each PPP link in the bundle, plus
+several hooks corresponding to the directly supported protocols.
+For compression and encryption, separate attached nodes are required
+to do the actual work. The node type used will of course depend
+on the algorithm negotiated. There is also a
+.Dv bypass
+hook which is used to handle any protocol not directly supported
+by the node. This includes all of the control protocols: LCP, IPCP,
+CCP, etc. Typically this node is connected to a user-land daemon
+via a
+.Xr ng_socket(8)
+type node.
+.Sh ENABLING FUNCTIONALITY
+In general, the PPP node enables a specific link or functionality when
+(a) a
+.Dv NGM_PPP_SET_CONFIG
+message has been received which enables it, and
+(b) the corresponding hook(s) are connected.
+This allows the controlling entity to use either method (a) or (b)
+(or both) to control the node's behavior.
+When a link is connected but disabled, traffic can still flow on
+the link via the
+.Dv bypass
+hook (see below).
+.Sh LINK HOOKS
+During normal operation, the individual PPP links are connected to hooks
+.Dv link0 ,
+.Dv link1 ,
+etc. Up to
+.Dv NG_PPP_MAX_LINKS
+links are supported.
+These device-independent hooks transmit and receive full PPP
+frames, which include the PPP protocol, address, control, and
+information fields, but no checksum or other link-specific fields.
+.Pp
+On outgoing frames, when protocol compression
+has been enabled and the protocol number is suitable for compression,
+the protocol field will be compressed (i.e., sent as one byte
+instead of two). Either compressed or uncompressed protocol fields
+are accepted on incoming frames. Similarly, if address and control
+field compression has been enabled for the link, the address and
+control fields will be omitted (except for LCP frames as required
+by the standards). Incoming frames have the address and control fields
+stripped automatically if present.
+.Pp
+Since all negotiation is handled outside the PPP node, the links
+should not be connected and enabled until the corresponding link
+has reached the network phase (i.e., LCP negotiation and authentication
+have completed successfully) and the PPP node has been informed of
+the link parameters via the
+.Dv NGM_PPP_LINK_CONFIG
+message.
+.Pp
+When a link is connected but disabled, all received frames are forwarded
+directly out the
+.Dv bypass
+hook, and conversely, frames may be transmitted via the
+.Dv bypass
+hook as well. This mode is appropriate for the link authentication phase.
+As soon as the link is enabled, the PPP node will
+begin processing frames received on the link.
+.Sh COMPRESSION AND ENCRYPTION
+Compression is supported via two hooks,
+.Dv compress
+and
+.Dv decompress .
+When enabled and connected, the PPP node writes outgoing frames on the
+.Dv comp
+hook and expects to receive back the compressed frame on the same hook.
+Similarly, the
+.Dv decompress
+hook is used to uncompress incoming frames when decompression is
+negotiated (compression and decompression are independently negotiable).
+The type of node attached to these hooks should correspond
+to the type of compression negotiated, e.g., Deflate, Predictor-1, etc.
+.Pp
+Encryption works exactly analogously via the
+.Dv encrypt
+and
+.Dv decrypt
+nodes. Data is always compressed before being encrypted,
+and decrypted before being decompressed.
+.Pp
+Only bundle-level compression and encryption is directly supported;
+link-level compression and encryption can be handled transparently
+by downstream nodes.
+.Sh VAN JACOBSEN COMPRESSION
+When all of the
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_vjip
+hooks are connected, and the corresponding configuration flag is
+enabled, Van Jacobsen compression and/or decompression will become active.
+Normally these hooks connect to the corresponding hooks of a single
+.Xr ng_vjc 8
+node. The PPP node is compatible with the ``pass through'' modes of the
+.Xr ng_vjc 8
+node type.
+.Sh BYPASS HOOK
+When a frame is received on a link with an unsupported protocol,
+or a protocol which is disabled or for which the corresponding hook
+is unconnected, the PPP node forwards the frame out the
+.Dv bypass
+hook, prepended with a four byte prefix. This first two bytes of
+the prefix indicate the link number on which the frame was received
+(in network order).
+For such frames received over the bundle (i.e., encapsulated in the
+multi-link protocol), the special link number
+.Dv NG_PPP_BUNDLE_LINKNUM
+is used. After the two byte link number is the two byte PPP protocol number
+(also in network order).
+The PPP protocol number is two bytes long even if the original frame
+was protocol compressed.
+.Pp
+Conversely, any data written to the
+.Dv bypass
+hook is assumed to be in this same format. The four byte header is
+stripped off, the PPP protocol number is prepended (possibly compressed),
+and the frame is delivered over the desired link.
+If the link number is
+.Dv NG_PPP_BUNDLE_LINKNUM
+the frame will be delivered over the multi-link bundle; or, if multi-link
+is disabled, over the (single) PPP link.
+.Pp
+Typically when the controlling entity receives a packet on the bypass
+hook it responds either by dropping the frame (if it's not ready for
+the protocol) or with an LCP protocol reject (if it doesn't recognize
+or expect the protocol).
+.Sh MULTILINK OPERATION
+To enable multi-link PPP, the corresponding configuration flag must be set
+and at least one link connected. The PPP node will not allow more than
+one link to be connected if multi-link is not enabled, nor will it allow
+certain multi-link settings to be changed while multi-link operation is
+active (e.g., short sequence number header format).
+.Pp
+Because packets are sent as fragments across multiple individual links,
+it is important that when a link goes down the PPP node is notified
+immediately, either by disconnecting the corresponding hook or disabling
+the link via the
+.Dv NGM_PPP_SET_CONFIG
+control message.
+.Pp
+Each link has configuration parameters for latency (specified in
+milliseconds) and bandwidth (specified in tens of bytes per second).
+The PPP node can be configured for
+.Em round-robin
+or
+.Em optimized
+packet delivery.
+.Pp
+When configured for round-robin delivery, the latency and bandwidth
+values are ignored and the PPP node simply sends each frame as a
+single fragment, alternating frames across all the links in the
+bundle. This scheme has the advantage that even if one link fails
+silently, some packets will still get through. It has the disadvantage
+of sub-optimal overall bundle latency, which is important for
+interactive response time, and sub-optimal overall bundle bandwidth
+when links with different bandwidths exist in the same bundle.
+.Pp
+When configured for optimal delivery, the PPP node distributes the
+packet across the links in a way that minimizes the time it takes
+for the completed packet to be received by the far end. This
+involves taking into account each link's latency, bandwidth, and
+current queue length. Therefore these numbers should be
+configured as accurately as possible. The algorithm does require
+some computation, so may not be appropriate for very slow machines
+and/or very fast links.
+.Pp
+As a special case, if all links have identical latency and bandwidth,
+then the above algorithm is disabled (because it is unnecessary)
+and the PPP node simply fragments frames into equal sized portions
+across all of the links.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv link<N>
+Individual PPP link number
+.Dv <N>
+.It Dv compress
+Connection to compression engine
+.It Dv decompress
+Connection to decompression engine
+.It Dv encrypt
+Connection to encryption engine
+.It Dv decrypt
+Connection to decryption engine
+.It Dv vjc_ip
+Connection to
+.Xr ng_vjc 8
+.Dv ip
+hook
+.It Dv vjc_vjcomp
+Connection to
+.Xr ng_vjc 8
+.Dv vjcomp
+hook
+.It Dv vjc_vjuncomp
+Connection to
+.Xr ng_vjc 8
+.Dv vjuncomp
+hook
+.It Dv vjc_vjip
+Connection to
+.Xr ng_vjc 8
+.Dv vjip
+hook
+.It Dv inet
+IP packet data
+.It Dv atalk
+AppleTalk packet data
+.It Dv ipx
+IPX packet data
+.It Dv bypass
+Bypass hook; frames have a four byte header consisting of
+a link number and a PPP protocol number.
+.El
+.Pp
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPP_SET_CONFIG
+This command configures all aspects of the node. This includes enabling
+multi-link PPP, encryption, compression, Van Jacobsen compression, and IP,
+AppleTalk, and IPX packet delivery. It includes per-link configuration,
+including enabling the link, setting latency and bandwidth parameters,
+and enabling protocol field compression. Note that no link or functionality
+is active until the corresponding hook is also connected.
+This command takes a
+.Dv "struct ng_ppp_node_config"
+as an argument:
+.Bd -literal -offset 0
+/* Per-link config structure */
+struct ng_ppp_link_config {
+ u_char enableLink; /* enable this link */
+ u_char enableProtoComp;/* enable protocol field compression */
+ u_char enableACFComp; /* enable addr/ctrl field compression */
+ u_int16_t mru; /* peer MRU */
+ u_int32_t latency; /* link latency (in milliseconds) */
+ u_int32_t bandwidth; /* link bandwidth (in bytes/second) */
+};
+
+/* Node config structure */
+struct ng_ppp_node_config {
+ u_int16_t mrru; /* multilink peer MRRU */
+ u_char enableMultilink; /* enable multilink */
+ u_char recvShortSeq; /* recv multilink short seq # */
+ u_char xmitShortSeq; /* xmit multilink short seq # */
+ u_char enableRoundRobin; /* xmit whole packets */
+ u_char enableIP; /* enable IP data flow */
+ u_char enableAtalk; /* enable AppleTalk data flow */
+ u_char enableIPX; /* enable IPX data flow */
+ u_char enableCompression; /* enable PPP compression */
+ u_char enableDecompression; /* enable PPP decompression */
+ u_char enableEncryption; /* enable PPP encryption */
+ u_char enableDecryption; /* enable PPP decryption */
+ u_char enableVJCompression; /* enable VJ compression */
+ u_char enableVJDecompression; /* enable VJ decompression */
+ struct ng_ppp_link_config /* per link config params */
+ links[NG_PPP_MAX_LINKS];
+};
+.Ed
+.Pp
+.It Dv NGM_PPP_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_ppp_node_config" .
+.It Dv NGM_PPP_GET_LINK_STATS
+This command takes a two byte link number as an argument and returns a
+.Dv "struct ng_ppp_link_stat"
+containing statistics for the corresponding link. Here
+.Dv NG_PPP_BUNDLE_LINKNUM
+is a valid link number corresponding to the multi-link bundle.
+.It Dv NGM_PPP_CLR_LINK_STATS
+This command takes a two byte link number as an argument and
+clears the statistics for that link.
+.It Dv NGM_PPP_GETCLR_LINK_STATS
+Same as
+.Dv NGM_PPP_GET_LINK_STATS ,
+but also atomically clears the statistics as well.
+.El
+.Pp
+This node type also accepts the control messages accepted by the
+.Xr ng_vjc 8
+node type. When received, these messages are simply forwarded to
+the adjacent
+.Xr ng_vjc 8
+node, if any. This is particularly useful when the individual
+PPP links are able to generate
+.Dv NGM_VJC_RECV_ERROR
+messages (see
+.Xr ng_vjc 8
+for a description).
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_async 8 ,
+.Xr ng_iface 8 ,
+.Xr ng_vjc 8 ,
+.Xr ng_pppoe 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Rs
+.%A K. Sklower
+.%A B. Lloyd
+.%A G. McGregor
+.%A D. Carr
+.%A T. Coradetti
+.%T "The PPP Multilink Protocol (MP)"
+.%O RFC 1990
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/ppp/ng_ppp.8 b/sys/modules/netgraph/ppp/ng_ppp.8
new file mode 100644
index 0000000..ac23ee4
--- /dev/null
+++ b/sys/modules/netgraph/ppp/ng_ppp.8
@@ -0,0 +1,379 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_PPP 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_ppp
+.Nd PPP protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_ppp.h>
+.Sh DESCRIPTION
+The
+.Nm ppp
+node type performs multiplexing for the PPP protocol. It handles
+only packets that contain data, and forwards protocol negotiation
+and control packets to a separate controlling entity (e.g., a
+user-land daemon). This approach combines the fast dispatch of
+kernel implementations with the configuration flexibility of a
+user-land implementations. The PPP node type directly supports
+multi-link PPP, Van Jacobsen compression, PPP compression, PPP
+encryption, and the IP, IPX, and AppleTalk protocols. A single
+PPP node corresponds to one PPP multi-link bundle.
+.Pp
+There is a separate hook for each PPP link in the bundle, plus
+several hooks corresponding to the directly supported protocols.
+For compression and encryption, separate attached nodes are required
+to do the actual work. The node type used will of course depend
+on the algorithm negotiated. There is also a
+.Dv bypass
+hook which is used to handle any protocol not directly supported
+by the node. This includes all of the control protocols: LCP, IPCP,
+CCP, etc. Typically this node is connected to a user-land daemon
+via a
+.Xr ng_socket(8)
+type node.
+.Sh ENABLING FUNCTIONALITY
+In general, the PPP node enables a specific link or functionality when
+(a) a
+.Dv NGM_PPP_SET_CONFIG
+message has been received which enables it, and
+(b) the corresponding hook(s) are connected.
+This allows the controlling entity to use either method (a) or (b)
+(or both) to control the node's behavior.
+When a link is connected but disabled, traffic can still flow on
+the link via the
+.Dv bypass
+hook (see below).
+.Sh LINK HOOKS
+During normal operation, the individual PPP links are connected to hooks
+.Dv link0 ,
+.Dv link1 ,
+etc. Up to
+.Dv NG_PPP_MAX_LINKS
+links are supported.
+These device-independent hooks transmit and receive full PPP
+frames, which include the PPP protocol, address, control, and
+information fields, but no checksum or other link-specific fields.
+.Pp
+On outgoing frames, when protocol compression
+has been enabled and the protocol number is suitable for compression,
+the protocol field will be compressed (i.e., sent as one byte
+instead of two). Either compressed or uncompressed protocol fields
+are accepted on incoming frames. Similarly, if address and control
+field compression has been enabled for the link, the address and
+control fields will be omitted (except for LCP frames as required
+by the standards). Incoming frames have the address and control fields
+stripped automatically if present.
+.Pp
+Since all negotiation is handled outside the PPP node, the links
+should not be connected and enabled until the corresponding link
+has reached the network phase (i.e., LCP negotiation and authentication
+have completed successfully) and the PPP node has been informed of
+the link parameters via the
+.Dv NGM_PPP_LINK_CONFIG
+message.
+.Pp
+When a link is connected but disabled, all received frames are forwarded
+directly out the
+.Dv bypass
+hook, and conversely, frames may be transmitted via the
+.Dv bypass
+hook as well. This mode is appropriate for the link authentication phase.
+As soon as the link is enabled, the PPP node will
+begin processing frames received on the link.
+.Sh COMPRESSION AND ENCRYPTION
+Compression is supported via two hooks,
+.Dv compress
+and
+.Dv decompress .
+When enabled and connected, the PPP node writes outgoing frames on the
+.Dv comp
+hook and expects to receive back the compressed frame on the same hook.
+Similarly, the
+.Dv decompress
+hook is used to uncompress incoming frames when decompression is
+negotiated (compression and decompression are independently negotiable).
+The type of node attached to these hooks should correspond
+to the type of compression negotiated, e.g., Deflate, Predictor-1, etc.
+.Pp
+Encryption works exactly analogously via the
+.Dv encrypt
+and
+.Dv decrypt
+nodes. Data is always compressed before being encrypted,
+and decrypted before being decompressed.
+.Pp
+Only bundle-level compression and encryption is directly supported;
+link-level compression and encryption can be handled transparently
+by downstream nodes.
+.Sh VAN JACOBSEN COMPRESSION
+When all of the
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_vjip
+hooks are connected, and the corresponding configuration flag is
+enabled, Van Jacobsen compression and/or decompression will become active.
+Normally these hooks connect to the corresponding hooks of a single
+.Xr ng_vjc 8
+node. The PPP node is compatible with the ``pass through'' modes of the
+.Xr ng_vjc 8
+node type.
+.Sh BYPASS HOOK
+When a frame is received on a link with an unsupported protocol,
+or a protocol which is disabled or for which the corresponding hook
+is unconnected, the PPP node forwards the frame out the
+.Dv bypass
+hook, prepended with a four byte prefix. This first two bytes of
+the prefix indicate the link number on which the frame was received
+(in network order).
+For such frames received over the bundle (i.e., encapsulated in the
+multi-link protocol), the special link number
+.Dv NG_PPP_BUNDLE_LINKNUM
+is used. After the two byte link number is the two byte PPP protocol number
+(also in network order).
+The PPP protocol number is two bytes long even if the original frame
+was protocol compressed.
+.Pp
+Conversely, any data written to the
+.Dv bypass
+hook is assumed to be in this same format. The four byte header is
+stripped off, the PPP protocol number is prepended (possibly compressed),
+and the frame is delivered over the desired link.
+If the link number is
+.Dv NG_PPP_BUNDLE_LINKNUM
+the frame will be delivered over the multi-link bundle; or, if multi-link
+is disabled, over the (single) PPP link.
+.Pp
+Typically when the controlling entity receives a packet on the bypass
+hook it responds either by dropping the frame (if it's not ready for
+the protocol) or with an LCP protocol reject (if it doesn't recognize
+or expect the protocol).
+.Sh MULTILINK OPERATION
+To enable multi-link PPP, the corresponding configuration flag must be set
+and at least one link connected. The PPP node will not allow more than
+one link to be connected if multi-link is not enabled, nor will it allow
+certain multi-link settings to be changed while multi-link operation is
+active (e.g., short sequence number header format).
+.Pp
+Because packets are sent as fragments across multiple individual links,
+it is important that when a link goes down the PPP node is notified
+immediately, either by disconnecting the corresponding hook or disabling
+the link via the
+.Dv NGM_PPP_SET_CONFIG
+control message.
+.Pp
+Each link has configuration parameters for latency (specified in
+milliseconds) and bandwidth (specified in tens of bytes per second).
+The PPP node can be configured for
+.Em round-robin
+or
+.Em optimized
+packet delivery.
+.Pp
+When configured for round-robin delivery, the latency and bandwidth
+values are ignored and the PPP node simply sends each frame as a
+single fragment, alternating frames across all the links in the
+bundle. This scheme has the advantage that even if one link fails
+silently, some packets will still get through. It has the disadvantage
+of sub-optimal overall bundle latency, which is important for
+interactive response time, and sub-optimal overall bundle bandwidth
+when links with different bandwidths exist in the same bundle.
+.Pp
+When configured for optimal delivery, the PPP node distributes the
+packet across the links in a way that minimizes the time it takes
+for the completed packet to be received by the far end. This
+involves taking into account each link's latency, bandwidth, and
+current queue length. Therefore these numbers should be
+configured as accurately as possible. The algorithm does require
+some computation, so may not be appropriate for very slow machines
+and/or very fast links.
+.Pp
+As a special case, if all links have identical latency and bandwidth,
+then the above algorithm is disabled (because it is unnecessary)
+and the PPP node simply fragments frames into equal sized portions
+across all of the links.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv link<N>
+Individual PPP link number
+.Dv <N>
+.It Dv compress
+Connection to compression engine
+.It Dv decompress
+Connection to decompression engine
+.It Dv encrypt
+Connection to encryption engine
+.It Dv decrypt
+Connection to decryption engine
+.It Dv vjc_ip
+Connection to
+.Xr ng_vjc 8
+.Dv ip
+hook
+.It Dv vjc_vjcomp
+Connection to
+.Xr ng_vjc 8
+.Dv vjcomp
+hook
+.It Dv vjc_vjuncomp
+Connection to
+.Xr ng_vjc 8
+.Dv vjuncomp
+hook
+.It Dv vjc_vjip
+Connection to
+.Xr ng_vjc 8
+.Dv vjip
+hook
+.It Dv inet
+IP packet data
+.It Dv atalk
+AppleTalk packet data
+.It Dv ipx
+IPX packet data
+.It Dv bypass
+Bypass hook; frames have a four byte header consisting of
+a link number and a PPP protocol number.
+.El
+.Pp
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPP_SET_CONFIG
+This command configures all aspects of the node. This includes enabling
+multi-link PPP, encryption, compression, Van Jacobsen compression, and IP,
+AppleTalk, and IPX packet delivery. It includes per-link configuration,
+including enabling the link, setting latency and bandwidth parameters,
+and enabling protocol field compression. Note that no link or functionality
+is active until the corresponding hook is also connected.
+This command takes a
+.Dv "struct ng_ppp_node_config"
+as an argument:
+.Bd -literal -offset 0
+/* Per-link config structure */
+struct ng_ppp_link_config {
+ u_char enableLink; /* enable this link */
+ u_char enableProtoComp;/* enable protocol field compression */
+ u_char enableACFComp; /* enable addr/ctrl field compression */
+ u_int16_t mru; /* peer MRU */
+ u_int32_t latency; /* link latency (in milliseconds) */
+ u_int32_t bandwidth; /* link bandwidth (in bytes/second) */
+};
+
+/* Node config structure */
+struct ng_ppp_node_config {
+ u_int16_t mrru; /* multilink peer MRRU */
+ u_char enableMultilink; /* enable multilink */
+ u_char recvShortSeq; /* recv multilink short seq # */
+ u_char xmitShortSeq; /* xmit multilink short seq # */
+ u_char enableRoundRobin; /* xmit whole packets */
+ u_char enableIP; /* enable IP data flow */
+ u_char enableAtalk; /* enable AppleTalk data flow */
+ u_char enableIPX; /* enable IPX data flow */
+ u_char enableCompression; /* enable PPP compression */
+ u_char enableDecompression; /* enable PPP decompression */
+ u_char enableEncryption; /* enable PPP encryption */
+ u_char enableDecryption; /* enable PPP decryption */
+ u_char enableVJCompression; /* enable VJ compression */
+ u_char enableVJDecompression; /* enable VJ decompression */
+ struct ng_ppp_link_config /* per link config params */
+ links[NG_PPP_MAX_LINKS];
+};
+.Ed
+.Pp
+.It Dv NGM_PPP_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_ppp_node_config" .
+.It Dv NGM_PPP_GET_LINK_STATS
+This command takes a two byte link number as an argument and returns a
+.Dv "struct ng_ppp_link_stat"
+containing statistics for the corresponding link. Here
+.Dv NG_PPP_BUNDLE_LINKNUM
+is a valid link number corresponding to the multi-link bundle.
+.It Dv NGM_PPP_CLR_LINK_STATS
+This command takes a two byte link number as an argument and
+clears the statistics for that link.
+.It Dv NGM_PPP_GETCLR_LINK_STATS
+Same as
+.Dv NGM_PPP_GET_LINK_STATS ,
+but also atomically clears the statistics as well.
+.El
+.Pp
+This node type also accepts the control messages accepted by the
+.Xr ng_vjc 8
+node type. When received, these messages are simply forwarded to
+the adjacent
+.Xr ng_vjc 8
+node, if any. This is particularly useful when the individual
+PPP links are able to generate
+.Dv NGM_VJC_RECV_ERROR
+messages (see
+.Xr ng_vjc 8
+for a description).
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_async 8 ,
+.Xr ng_iface 8 ,
+.Xr ng_vjc 8 ,
+.Xr ng_pppoe 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Rs
+.%A K. Sklower
+.%A B. Lloyd
+.%A G. McGregor
+.%A D. Carr
+.%A T. Coradetti
+.%T "The PPP Multilink Protocol (MP)"
+.%O RFC 1990
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/pppoe/Makefile b/sys/modules/netgraph/pppoe/Makefile
new file mode 100644
index 0000000..ed3756f
--- /dev/null
+++ b/sys/modules/netgraph/pppoe/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/01/19 19:39:21 archie Exp $
+
+KMOD= ng_pppoe
+SRCS= ng_pppoe.c
+MAN8= ng_pppoe.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/pppoe/ng_pppoe.4 b/sys/modules/netgraph/pppoe/ng_pppoe.4
new file mode 100644
index 0000000..69d0016
--- /dev/null
+++ b/sys/modules/netgraph/pppoe/ng_pppoe.4
@@ -0,0 +1,399 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd October 28, 1999
+.Dt NG_PPPOE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_pppoe
+.Nd RFC 2516 PPPOE protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/ethernet.h>
+.Fd #include <netgraph/ng_pppoe.h>
+.Sh DESCRIPTION
+The
+.Nm
+node type performs the PPPoE protocol. It is used in conjunction with the
+.Xr netgraph 4
+extensions to the Ethernet framework to divert and inject Ethernet packets
+to and from a PPP agent (which is not specified).
+.Pp
+The
+.Dv NGM_PPPOE_GET_STATUS
+control message can be used at any time to query the current status
+of the PPPOE module. The only statistics presently available are the
+total packet counts for input and output. This node does not yet support
+the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbaz
+.It Dv ethernet
+The hook that should normally be connected to an Ethernet node.
+.It Dv debug
+Presently no use.
+.It Dv [unspecified]
+Any other name is assumed to be a session hook that will be connected to
+a PPP client agent, or a ppp server agent.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPPOE_GET_STATUS
+This command returns status information in a
+.Dv "struct ngpppoestat" :
+.Bd -literal -offset 4n
+struct ngpppoestat {
+ u_int packets_in; /* packets in from ethernet */
+ u_int packets_out; /* packets out towards ethernet */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns is a human-readable version of the node status.
+(not yet)
+.It Dv NGM_PPPOE_CONNECT
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a client. It must be newly created and
+a service name can be given as an argument. It is legal to specify a zero length
+service name. This is common on some DSL setups. A session request packet
+will be broadcast on the Ethernet.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_LISTEN
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a server listener. The argument
+given is the name of the service to listen on behalf of. A zero length service
+length will match all requests for service. A matching service request
+packet will be passed unmodified back to the process responsible
+for starting the service. It can then examine it and pass it on to
+the session that is started to answer the request.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_OFFER
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a server. The argument
+given is the name of the service to offer. A zero length service
+is legal. The State machine will progress to a state where it will await
+a request packet to be forwarded to it from the startup server,
+which in turn probably received it from a LISTEN mode hook ( see above).
+This is so
+that information that is required for the session that is embedded in
+the original session request packet, is made available to the state machine
+that eventually answers the request. When the Session request packet is
+received, the session negotiation will proceed.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.Pp
+The three commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_init_data {
+ char hook[NG_HOOKLEN + 1]; /* hook to monitor on */
+ u_int16_t data_len; /* service name length */
+ char data[0]; /* init data goes here */
+};
+.Ed
+.It Dv NGM_PPPOE_SUCCESS
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+successful Session negotiation. It uses the structure shown below, and
+reports back the hook name corresponding to the successful session.
+.It Dv NGM_NGM_PPPOE_FAIL
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+failed Session negotiation. It uses the structure shown below, and
+reports back the hook name corresponding to the failed session.
+The hook will probably have been removed immediately after sending this message
+.It Dv NGM_NGM_PPPOE_CLOSE
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+a request to close a session. It uses the structure shown below, and
+reports back the hook name corresponding to the closed session.
+The hook will probably have been removed immediately after sending this
+message. At present this message is not yet used and a 'failed' message
+will be received at closure instead.
+.Pp
+The three commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_sts {
+ char hook[NG_HOOKLEN + 1]; /* hook associated with event session */
+};
+
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, when all session have been disconnected or when the
+.Dv ethernet
+hook is disconnected.
+.Sh EXAMPLE USAGE
+The following code uses
+.Dv libnetgraph
+to set up a
+.Nm
+node and connect it to both a socket node and an Ethernet node. It can handle
+the case of when a
+.Nm
+node is already attached to the Ethernet. It then starts a client session.
+.Bd -literal
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include <errno.h>
+#include <err.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <net/ethernet.h>
+
+#include <netgraph.h>
+#include <netgraph/ng_ether.h>
+#include <netgraph/ng_pppoe.h>
+#include <netgraph/ng_socket.h>
+static int setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd);
+
+int
+main()
+{
+ int fd1, fd2;
+ setup("xl0", NULL, "fred", &fd1, &fd2);
+ sleep (30);
+}
+
+static int
+setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd)
+{
+ struct ngm_connect ngc; /* connect */
+ struct ngm_mkpeer mkp; /* mkpeer */
+ /******** nodeinfo stuff **********/
+ u_char rbuf[2 * 1024];
+ struct ng_mesg *const resp = (struct ng_mesg *) rbuf;
+ struct hooklist *const hlist
+ = (struct hooklist *) resp->data;
+ struct nodeinfo *const ninfo = &hlist->nodeinfo;
+ int ch, no_hooks = 0;
+ struct linkinfo *link;
+ struct nodeinfo *peer;
+ /****message to connect pppoe session*****/
+ struct {
+ struct ngPPPoE_init_data idata;
+ char service[100];
+ } message;
+ /********tracking our little graph ********/
+ char path[100];
+ char source_ID[NG_NODELEN + 1];
+ char pppoe_node_name[100];
+ int k;
+
+ /*
+ * Create the data and control sockets
+ */
+ if (NgMkSockNode(NULL, cfd, dfd) < 0) {
+ return (errno);
+ }
+ /*
+ * find the ether node of the name requested by asking it for
+ * it's inquiry information.
+ */
+ if (strlen(ethername) > 16)
+ return (EINVAL);
+ sprintf(path, "%s:", ethername);
+ if (NgSendMsg(*cfd, path, NGM_GENERIC_COOKIE,
+ NGM_LISTHOOKS, NULL, 0) < 0) {
+ return (errno);
+ }
+ /*
+ * the command was accepted so it exists. Await the reply (It's
+ * almost certainly already waiting).
+ */
+ if (NgRecvMsg(*cfd, resp, sizeof(rbuf), NULL) < 0) {
+ return (errno);
+ }
+ /**
+ * The following is available about the node:
+ * ninfo->name (string)
+ * ninfo->type (string)
+ * ninfo->id (u_int32_t)
+ * ninfo->hooks (u_int32_t) (count of hooks)
+ * check it is the correct type. and get it's ID for use
+ * with mkpeer later.
+ */
+ if (strncmp(ninfo->type, NG_ETHER_NODE_TYPE,
+ strlen(NG_ETHER_NODE_TYPE)) != 0) {
+ return (EPROTOTYPE);
+ }
+ sprintf(source_ID, "[%08x]:", ninfo->id);
+
+ /*
+ * look for a hook already attached.
+ */
+ for (k = 0; k < ninfo->hooks; k++) {
+ /**
+ * The following are available about each hook.
+ * link->ourhook (string)
+ * link->peerhook (string)
+ * peer->name (string)
+ * peer->type (string)
+ * peer->id (u_int32_t)
+ * peer->hooks (u_int32_t)
+ */
+ link = &hlist->link[k];
+ peer = &hlist->link[k].nodeinfo;
+
+ /* Ignore debug hooks */
+ if (strcmp("debug", link->ourhook) == 0)
+ continue;
+
+ /* If the orphans hook is attached, use that */
+ if (strcmp(NG_ETHER_HOOK_ORPHAN,
+ link->ourhook) == 0) {
+ break;
+ }
+ /* the other option is the 'divert' hook */
+ if (strcmp("NG_ETHER_HOOK_DIVERT",
+ link->ourhook) == 0) {
+ break;
+ }
+ }
+
+ /*
+ * See if we found a hook there.
+ */
+ if (k < ninfo->hooks) {
+ if (strcmp(peer->type, NG_PPPOE_NODE_TYPE) == 0) {
+ /*
+ * If it's a type pppoe, we skip making one
+ * ourself, but we continue, using
+ * the existing one.
+ */
+ sprintf(pppoe_node_name, "[%08x]:", peer->id);
+ } else {
+ /*
+ * There is already someone hogging the data,
+ * return an error. Some day we'll try
+ * daisy-chaining..
+ */
+ return (EBUSY);
+ }
+ } else {
+
+ /*
+ * Try make a node of type pppoe against node "ID"
+ * On hook NG_ETHER_HOOK_ORPHAN.
+ */
+ snprintf(mkp.type, sizeof(mkp.type),
+ "%s", NG_PPPOE_NODE_TYPE);
+ snprintf(mkp.ourhook, sizeof(mkp.ourhook),
+ "%s", NG_ETHER_HOOK_ORPHAN);
+ snprintf(mkp.peerhook, sizeof(mkp.peerhook),
+ "%s", NG_PPPOE_HOOK_ETHERNET);
+ /* Send message */
+ if (NgSendMsg(*cfd, source_ID, NGM_GENERIC_COOKIE,
+ NGM_MKPEER, &mkp, sizeof(mkp)) < 0) {
+ return (errno);
+ }
+ /*
+ * Work out a name for the new node.
+ */
+ sprintf(pppoe_node_name, "%s:%s",
+ source_ID, NG_ETHER_HOOK_ORPHAN);
+ }
+ /*
+ * We now have a pppoe node attached to the ethernet
+ * card. The Ethernet is addressed as ethername: The pppoe
+ * node is addressed as pppoe_node_name: attach to it.
+ * Connect socket node to specified node Use the same hook
+ * name on both ends of the link.
+ */
+ snprintf(ngc.path, sizeof(ngc.path), "%s", pppoe_node_name);
+ snprintf(ngc.ourhook, sizeof(ngc.ourhook), "%s", sessname);
+ snprintf(ngc.peerhook, sizeof(ngc.peerhook), "%s", sessname);
+
+ if (NgSendMsg(*cfd, ".:", NGM_GENERIC_COOKIE,
+ NGM_CONNECT, &ngc, sizeof(ngc)) < 0) {
+ return (errno);
+ }
+ /*
+ * Send it a message telling it to start up.
+ */
+ bzero(&message, sizeof(message));
+ snprintf(message.idata.hook, sizeof(message.idata.hook),
+ "%s", sessname);
+ if (service == NULL) {
+ message.idata.data_len = 0;
+ } else {
+ snprintf(message.idata.data,
+ sizeof(message.idata.data), "%s", service);
+ message.idata.data_len = strlen(service);
+ }
+ /* Tell session/hook to start up as a client */
+ if (NgSendMsg(*cfd, ngc.path,
+ NGM_PPPOE_COOKIE, NGM_PPPOE_CONNECT, &message.idata,
+ sizeof(message.idata) + message.idata.data_len) < 0) {
+ return (errno);
+ }
+ return (0);
+}
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_socket 8 ,
+.Xr ng_ppp 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A L. Mamakos
+.%A K. Lidl
+.%A J. Evarts
+.%A D. Carrel
+.%A D. Simone
+.%A R. Wheeler
+.%T "A Method for transmitting PPP over Ethernet (PPPoE)"
+.%O RFC 2516
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/pppoe/ng_pppoe.8 b/sys/modules/netgraph/pppoe/ng_pppoe.8
new file mode 100644
index 0000000..69d0016
--- /dev/null
+++ b/sys/modules/netgraph/pppoe/ng_pppoe.8
@@ -0,0 +1,399 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd October 28, 1999
+.Dt NG_PPPOE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_pppoe
+.Nd RFC 2516 PPPOE protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/ethernet.h>
+.Fd #include <netgraph/ng_pppoe.h>
+.Sh DESCRIPTION
+The
+.Nm
+node type performs the PPPoE protocol. It is used in conjunction with the
+.Xr netgraph 4
+extensions to the Ethernet framework to divert and inject Ethernet packets
+to and from a PPP agent (which is not specified).
+.Pp
+The
+.Dv NGM_PPPOE_GET_STATUS
+control message can be used at any time to query the current status
+of the PPPOE module. The only statistics presently available are the
+total packet counts for input and output. This node does not yet support
+the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbaz
+.It Dv ethernet
+The hook that should normally be connected to an Ethernet node.
+.It Dv debug
+Presently no use.
+.It Dv [unspecified]
+Any other name is assumed to be a session hook that will be connected to
+a PPP client agent, or a ppp server agent.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPPOE_GET_STATUS
+This command returns status information in a
+.Dv "struct ngpppoestat" :
+.Bd -literal -offset 4n
+struct ngpppoestat {
+ u_int packets_in; /* packets in from ethernet */
+ u_int packets_out; /* packets out towards ethernet */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns is a human-readable version of the node status.
+(not yet)
+.It Dv NGM_PPPOE_CONNECT
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a client. It must be newly created and
+a service name can be given as an argument. It is legal to specify a zero length
+service name. This is common on some DSL setups. A session request packet
+will be broadcast on the Ethernet.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_LISTEN
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a server listener. The argument
+given is the name of the service to listen on behalf of. A zero length service
+length will match all requests for service. A matching service request
+packet will be passed unmodified back to the process responsible
+for starting the service. It can then examine it and pass it on to
+the session that is started to answer the request.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_OFFER
+Tell a nominated newly created hook that it's session should enter
+the state machine in a manner to become a server. The argument
+given is the name of the service to offer. A zero length service
+is legal. The State machine will progress to a state where it will await
+a request packet to be forwarded to it from the startup server,
+which in turn probably received it from a LISTEN mode hook ( see above).
+This is so
+that information that is required for the session that is embedded in
+the original session request packet, is made available to the state machine
+that eventually answers the request. When the Session request packet is
+received, the session negotiation will proceed.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.Pp
+The three commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_init_data {
+ char hook[NG_HOOKLEN + 1]; /* hook to monitor on */
+ u_int16_t data_len; /* service name length */
+ char data[0]; /* init data goes here */
+};
+.Ed
+.It Dv NGM_PPPOE_SUCCESS
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+successful Session negotiation. It uses the structure shown below, and
+reports back the hook name corresponding to the successful session.
+.It Dv NGM_NGM_PPPOE_FAIL
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+failed Session negotiation. It uses the structure shown below, and
+reports back the hook name corresponding to the failed session.
+The hook will probably have been removed immediately after sending this message
+.It Dv NGM_NGM_PPPOE_CLOSE
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change. This message reports
+a request to close a session. It uses the structure shown below, and
+reports back the hook name corresponding to the closed session.
+The hook will probably have been removed immediately after sending this
+message. At present this message is not yet used and a 'failed' message
+will be received at closure instead.
+.Pp
+The three commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_sts {
+ char hook[NG_HOOKLEN + 1]; /* hook associated with event session */
+};
+
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, when all session have been disconnected or when the
+.Dv ethernet
+hook is disconnected.
+.Sh EXAMPLE USAGE
+The following code uses
+.Dv libnetgraph
+to set up a
+.Nm
+node and connect it to both a socket node and an Ethernet node. It can handle
+the case of when a
+.Nm
+node is already attached to the Ethernet. It then starts a client session.
+.Bd -literal
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include <errno.h>
+#include <err.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <net/ethernet.h>
+
+#include <netgraph.h>
+#include <netgraph/ng_ether.h>
+#include <netgraph/ng_pppoe.h>
+#include <netgraph/ng_socket.h>
+static int setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd);
+
+int
+main()
+{
+ int fd1, fd2;
+ setup("xl0", NULL, "fred", &fd1, &fd2);
+ sleep (30);
+}
+
+static int
+setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd)
+{
+ struct ngm_connect ngc; /* connect */
+ struct ngm_mkpeer mkp; /* mkpeer */
+ /******** nodeinfo stuff **********/
+ u_char rbuf[2 * 1024];
+ struct ng_mesg *const resp = (struct ng_mesg *) rbuf;
+ struct hooklist *const hlist
+ = (struct hooklist *) resp->data;
+ struct nodeinfo *const ninfo = &hlist->nodeinfo;
+ int ch, no_hooks = 0;
+ struct linkinfo *link;
+ struct nodeinfo *peer;
+ /****message to connect pppoe session*****/
+ struct {
+ struct ngPPPoE_init_data idata;
+ char service[100];
+ } message;
+ /********tracking our little graph ********/
+ char path[100];
+ char source_ID[NG_NODELEN + 1];
+ char pppoe_node_name[100];
+ int k;
+
+ /*
+ * Create the data and control sockets
+ */
+ if (NgMkSockNode(NULL, cfd, dfd) < 0) {
+ return (errno);
+ }
+ /*
+ * find the ether node of the name requested by asking it for
+ * it's inquiry information.
+ */
+ if (strlen(ethername) > 16)
+ return (EINVAL);
+ sprintf(path, "%s:", ethername);
+ if (NgSendMsg(*cfd, path, NGM_GENERIC_COOKIE,
+ NGM_LISTHOOKS, NULL, 0) < 0) {
+ return (errno);
+ }
+ /*
+ * the command was accepted so it exists. Await the reply (It's
+ * almost certainly already waiting).
+ */
+ if (NgRecvMsg(*cfd, resp, sizeof(rbuf), NULL) < 0) {
+ return (errno);
+ }
+ /**
+ * The following is available about the node:
+ * ninfo->name (string)
+ * ninfo->type (string)
+ * ninfo->id (u_int32_t)
+ * ninfo->hooks (u_int32_t) (count of hooks)
+ * check it is the correct type. and get it's ID for use
+ * with mkpeer later.
+ */
+ if (strncmp(ninfo->type, NG_ETHER_NODE_TYPE,
+ strlen(NG_ETHER_NODE_TYPE)) != 0) {
+ return (EPROTOTYPE);
+ }
+ sprintf(source_ID, "[%08x]:", ninfo->id);
+
+ /*
+ * look for a hook already attached.
+ */
+ for (k = 0; k < ninfo->hooks; k++) {
+ /**
+ * The following are available about each hook.
+ * link->ourhook (string)
+ * link->peerhook (string)
+ * peer->name (string)
+ * peer->type (string)
+ * peer->id (u_int32_t)
+ * peer->hooks (u_int32_t)
+ */
+ link = &hlist->link[k];
+ peer = &hlist->link[k].nodeinfo;
+
+ /* Ignore debug hooks */
+ if (strcmp("debug", link->ourhook) == 0)
+ continue;
+
+ /* If the orphans hook is attached, use that */
+ if (strcmp(NG_ETHER_HOOK_ORPHAN,
+ link->ourhook) == 0) {
+ break;
+ }
+ /* the other option is the 'divert' hook */
+ if (strcmp("NG_ETHER_HOOK_DIVERT",
+ link->ourhook) == 0) {
+ break;
+ }
+ }
+
+ /*
+ * See if we found a hook there.
+ */
+ if (k < ninfo->hooks) {
+ if (strcmp(peer->type, NG_PPPOE_NODE_TYPE) == 0) {
+ /*
+ * If it's a type pppoe, we skip making one
+ * ourself, but we continue, using
+ * the existing one.
+ */
+ sprintf(pppoe_node_name, "[%08x]:", peer->id);
+ } else {
+ /*
+ * There is already someone hogging the data,
+ * return an error. Some day we'll try
+ * daisy-chaining..
+ */
+ return (EBUSY);
+ }
+ } else {
+
+ /*
+ * Try make a node of type pppoe against node "ID"
+ * On hook NG_ETHER_HOOK_ORPHAN.
+ */
+ snprintf(mkp.type, sizeof(mkp.type),
+ "%s", NG_PPPOE_NODE_TYPE);
+ snprintf(mkp.ourhook, sizeof(mkp.ourhook),
+ "%s", NG_ETHER_HOOK_ORPHAN);
+ snprintf(mkp.peerhook, sizeof(mkp.peerhook),
+ "%s", NG_PPPOE_HOOK_ETHERNET);
+ /* Send message */
+ if (NgSendMsg(*cfd, source_ID, NGM_GENERIC_COOKIE,
+ NGM_MKPEER, &mkp, sizeof(mkp)) < 0) {
+ return (errno);
+ }
+ /*
+ * Work out a name for the new node.
+ */
+ sprintf(pppoe_node_name, "%s:%s",
+ source_ID, NG_ETHER_HOOK_ORPHAN);
+ }
+ /*
+ * We now have a pppoe node attached to the ethernet
+ * card. The Ethernet is addressed as ethername: The pppoe
+ * node is addressed as pppoe_node_name: attach to it.
+ * Connect socket node to specified node Use the same hook
+ * name on both ends of the link.
+ */
+ snprintf(ngc.path, sizeof(ngc.path), "%s", pppoe_node_name);
+ snprintf(ngc.ourhook, sizeof(ngc.ourhook), "%s", sessname);
+ snprintf(ngc.peerhook, sizeof(ngc.peerhook), "%s", sessname);
+
+ if (NgSendMsg(*cfd, ".:", NGM_GENERIC_COOKIE,
+ NGM_CONNECT, &ngc, sizeof(ngc)) < 0) {
+ return (errno);
+ }
+ /*
+ * Send it a message telling it to start up.
+ */
+ bzero(&message, sizeof(message));
+ snprintf(message.idata.hook, sizeof(message.idata.hook),
+ "%s", sessname);
+ if (service == NULL) {
+ message.idata.data_len = 0;
+ } else {
+ snprintf(message.idata.data,
+ sizeof(message.idata.data), "%s", service);
+ message.idata.data_len = strlen(service);
+ }
+ /* Tell session/hook to start up as a client */
+ if (NgSendMsg(*cfd, ngc.path,
+ NGM_PPPOE_COOKIE, NGM_PPPOE_CONNECT, &message.idata,
+ sizeof(message.idata) + message.idata.data_len) < 0) {
+ return (errno);
+ }
+ return (0);
+}
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_socket 8 ,
+.Xr ng_ppp 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A L. Mamakos
+.%A K. Lidl
+.%A J. Evarts
+.%A D. Carrel
+.%A D. Simone
+.%A R. Wheeler
+.%T "A Method for transmitting PPP over Ethernet (PPPoE)"
+.%O RFC 2516
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/pptpgre/Makefile b/sys/modules/netgraph/pptpgre/Makefile
new file mode 100644
index 0000000..b8602e3
--- /dev/null
+++ b/sys/modules/netgraph/pptpgre/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/11/29 23:14:33 archie Exp $
+
+KMOD= ng_pptpgre
+SRCS= ng_pptpgre.c
+MAN8= ng_pptpgre.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/pptpgre/ng_pptpgre.4 b/sys/modules/netgraph/pptpgre/ng_pptpgre.4
new file mode 100644
index 0000000..7eadcc3
--- /dev/null
+++ b/sys/modules/netgraph/pptpgre/ng_pptpgre.4
@@ -0,0 +1,136 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $
+.\"
+.Dd November 29, 1999
+.Dt NG_PPTPGRE 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_pptpgre
+.Nd PPP protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_pptpgre.h>
+.Sh DESCRIPTION
+The
+.Nm pptpgre
+node type performs Generic Routing Encapsulation (GRE) over IP
+for the PPTP protocol as specified by RFC 2637. This involves packet
+encapsulation, sequencing, acknowlegement, and an adaptive timeout
+sliding window mechanism. This node type does not handle any of
+the TCP control protocol or call negotiation defined by PPTP.
+.Pp
+The typical use for this node type would be to connect the
+.Dv upper
+hook to one of the link hooks of a
+.Xr ng_ppp 8
+node, and the
+.Dv lower
+hook to the
+.Dv "inet/raw/gre"
+hook of a
+.Xr ng_ksocket 8
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv upper
+Connection to the upper protocol layers
+.It Dv lower
+Connection to the lower protocol layers
+.El
+.Pp
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPTPGRE_SET_CONFIG
+This command resets and configures the node for a session.
+This command takes a
+.Dv "struct ng_pptpgre_conf"
+as an argument:
+.Bd -literal -offset 0
+/* Configuration for a session */
+struct ng_pptpgre_conf {
+ u_char enabled; /* enables traffic flow */
+ u_char enableDelayedAck; /* enables delayed acks */
+ u_int16_t cid; /* my call id */
+ u_int16_t peerCid; /* peer call id */
+ u_int16_t recvWin; /* peer recv window size */
+ u_int16_t peerPpd; /* peer packet processing delay
+ (in 1/10 of a second) */
+};
+
+.Ed
+The
+.Dv enabled
+field enables traffic flow through the node. The
+.Dv enableDelayedAck
+field enables delayed acknowledgement (maximum 250 miliseconds), which
+is a useful optimization and should generally be turned on.
+The remaining fields are as supplied by the PPTP virtual call setup process.
+.It Dv NGM_PPTPGRE_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_pptpgre_conf" .
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ksocket 8 ,
+.Xr ng_ppp 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A K. Hamzeh
+.%A G. Pall
+.%A W. Verthein
+.%A J. Taarud
+.%A W. Little
+.%A G. Zorn
+.%T "Point-to-Point Tunneling Protocol (PPTP)"
+.%O RFC 2637
+.Re
+.Rs
+.%A S. Hanks
+.%A T. \&Li
+.%A D. Farinacci
+.%A P. Traina
+.%T "Generic Routing Encapsulation over IPv4 networks"
+.%O RFC 1702
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/pptpgre/ng_pptpgre.8 b/sys/modules/netgraph/pptpgre/ng_pptpgre.8
new file mode 100644
index 0000000..7eadcc3
--- /dev/null
+++ b/sys/modules/netgraph/pptpgre/ng_pptpgre.8
@@ -0,0 +1,136 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $
+.\"
+.Dd November 29, 1999
+.Dt NG_PPTPGRE 8
+.Os FreeBSD
+.Sh NAME
+.Nm ng_pptpgre
+.Nd PPP protocol netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_pptpgre.h>
+.Sh DESCRIPTION
+The
+.Nm pptpgre
+node type performs Generic Routing Encapsulation (GRE) over IP
+for the PPTP protocol as specified by RFC 2637. This involves packet
+encapsulation, sequencing, acknowlegement, and an adaptive timeout
+sliding window mechanism. This node type does not handle any of
+the TCP control protocol or call negotiation defined by PPTP.
+.Pp
+The typical use for this node type would be to connect the
+.Dv upper
+hook to one of the link hooks of a
+.Xr ng_ppp 8
+node, and the
+.Dv lower
+hook to the
+.Dv "inet/raw/gre"
+hook of a
+.Xr ng_ksocket 8
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv upper
+Connection to the upper protocol layers
+.It Dv lower
+Connection to the lower protocol layers
+.El
+.Pp
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPTPGRE_SET_CONFIG
+This command resets and configures the node for a session.
+This command takes a
+.Dv "struct ng_pptpgre_conf"
+as an argument:
+.Bd -literal -offset 0
+/* Configuration for a session */
+struct ng_pptpgre_conf {
+ u_char enabled; /* enables traffic flow */
+ u_char enableDelayedAck; /* enables delayed acks */
+ u_int16_t cid; /* my call id */
+ u_int16_t peerCid; /* peer call id */
+ u_int16_t recvWin; /* peer recv window size */
+ u_int16_t peerPpd; /* peer packet processing delay
+ (in 1/10 of a second) */
+};
+
+.Ed
+The
+.Dv enabled
+field enables traffic flow through the node. The
+.Dv enableDelayedAck
+field enables delayed acknowledgement (maximum 250 miliseconds), which
+is a useful optimization and should generally be turned on.
+The remaining fields are as supplied by the PPTP virtual call setup process.
+.It Dv NGM_PPTPGRE_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_pptpgre_conf" .
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ksocket 8 ,
+.Xr ng_ppp 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A K. Hamzeh
+.%A G. Pall
+.%A W. Verthein
+.%A J. Taarud
+.%A W. Little
+.%A G. Zorn
+.%T "Point-to-Point Tunneling Protocol (PPTP)"
+.%O RFC 2637
+.Re
+.Rs
+.%A S. Hanks
+.%A T. \&Li
+.%A D. Farinacci
+.%A P. Traina
+.%T "Generic Routing Encapsulation over IPv4 networks"
+.%O RFC 1702
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/rfc1490/Makefile b/sys/modules/netgraph/rfc1490/Makefile
new file mode 100644
index 0000000..ac7562d
--- /dev/null
+++ b/sys/modules/netgraph/rfc1490/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:22 archie Exp $
+
+KMOD= ng_rfc1490
+SRCS= ng_rfc1490.c
+MAN8= ng_rfc1490.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/rfc1490/ng_rfc1490.4 b/sys/modules/netgraph/rfc1490/ng_rfc1490.4
new file mode 100644
index 0000000..a2aa9d0
--- /dev/null
+++ b/sys/modules/netgraph/rfc1490/ng_rfc1490.4
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_rfc1490.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_RFC1490 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_rfc1490
+.Nd RFC 1490 netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_rfc1490.h>
+.Sh DESCRIPTION
+The
+.Nm rfc1490
+node type performs protocol encapsulation, de-encapsulation, and
+multiplexing according to RFC 1490 (which has since been updated by RFC 2427).
+This particular type of encapsulation is often used on top of frame relay
+DLCI channels.
+.Pp
+The
+.Dv downstream
+hook is used to transmit and receive encapsulated frames. On the other
+side of the node, the
+.Dv inet
+and
+.Dv ppp
+hooks are used to transmit and receive raw IP frames and PPP frames,
+respectively. PPP frames are transmitted and received according to
+RFC 1973; in particular, frames appearing on the
+.Dv ppp
+hook begin with the PPP protocol number.
+.Pp
+Typically the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 8
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazum
+.It Dv downstream
+Connects to the RFC 1490 peer entity.
+.It Dv inet
+Transmits and receives raw IP frames.
+.It Dv ppp
+Transmits and receives PPP frames.
+.El
+.Sh CONTROL MESSAGES
+This node type only supports the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Not all of RFC 1490 is implemented.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 8 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A C. Brown, A. Malis
+.%T "Multiprotocol Interconnect over Frame Relay"
+.%O RFC 2427
+.Re
+.Rs
+.%A W. Simpson
+.%T "PPP in Frame Relay"
+.%O RFC 1973
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/rfc1490/ng_rfc1490.8 b/sys/modules/netgraph/rfc1490/ng_rfc1490.8
new file mode 100644
index 0000000..a2aa9d0
--- /dev/null
+++ b/sys/modules/netgraph/rfc1490/ng_rfc1490.8
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_rfc1490.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_RFC1490 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_rfc1490
+.Nd RFC 1490 netgraph node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_rfc1490.h>
+.Sh DESCRIPTION
+The
+.Nm rfc1490
+node type performs protocol encapsulation, de-encapsulation, and
+multiplexing according to RFC 1490 (which has since been updated by RFC 2427).
+This particular type of encapsulation is often used on top of frame relay
+DLCI channels.
+.Pp
+The
+.Dv downstream
+hook is used to transmit and receive encapsulated frames. On the other
+side of the node, the
+.Dv inet
+and
+.Dv ppp
+hooks are used to transmit and receive raw IP frames and PPP frames,
+respectively. PPP frames are transmitted and received according to
+RFC 1973; in particular, frames appearing on the
+.Dv ppp
+hook begin with the PPP protocol number.
+.Pp
+Typically the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 8
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazum
+.It Dv downstream
+Connects to the RFC 1490 peer entity.
+.It Dv inet
+Transmits and receives raw IP frames.
+.It Dv ppp
+Transmits and receives PPP frames.
+.El
+.Sh CONTROL MESSAGES
+This node type only supports the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Not all of RFC 1490 is implemented.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 8 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A C. Brown, A. Malis
+.%T "Multiprotocol Interconnect over Frame Relay"
+.%O RFC 2427
+.Re
+.Rs
+.%A W. Simpson
+.%T "PPP in Frame Relay"
+.%O RFC 1973
+.Re
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/socket/Makefile b/sys/modules/netgraph/socket/Makefile
new file mode 100644
index 0000000..d2779b3
--- /dev/null
+++ b/sys/modules/netgraph/socket/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:22 archie Exp $
+
+KMOD= ng_socket
+SRCS= ng_socket.c
+MAN8= ng_socket.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/socket/ng_socket.4 b/sys/modules/netgraph/socket/ng_socket.4
new file mode 100644
index 0000000..cb224bc
--- /dev/null
+++ b/sys/modules/netgraph/socket/ng_socket.4
@@ -0,0 +1,173 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_socket.8,v 1.5 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_SOCKET 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_socket
+.Nd netgraph socket node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_message.h>
+.Fd #include <netgraph/ng_socket.h>
+.Sh DESCRIPTION
+A
+.Nm socket
+node is both a BSD socket and a netgraph node. The
+.Nm socket
+node type allows user-mode processes to participate in the kernel
+.Xr netgraph 4
+networking subsystem using the BSD socket interface. The process must have
+root privileges to be able to create netgraph sockets however once created,
+any process that has one may use it.
+.Pp
+A new
+.Nm socket
+node is created by creating a new socket of type
+.Dv NG_CONTROL
+in the protocol family
+.Dv PF_NETGRAPH ,
+using the
+.Xr socket 2
+system call.
+Any control messages received by the node
+and not having a cookie value of
+.Dv NGM_SOCKET_COOKIE
+are received by the process, using
+.Xr recvfrom 2 ;
+the socket address argument is a
+.Dv "struct sockaddr_ng"
+containing the sender's netgraph address. Conversely, control messages
+can be sent to any node by calling
+.Xr sendto 2 ,
+supplying the recipient's address in a
+.Dv "struct sockaddr_ng" .
+The
+.Xr bind 2
+system call may be used to assign a global netgraph name to the node.
+.Pp
+To transmit and receive netgraph data packets, a
+.Dv NG_DATA
+socket must also be created using
+.Xr socket 2
+and associated with a
+.Nm socket
+node.
+.Dv NG_DATA sockets do not automatically
+have nodes associated with them; they are bound to a specific node via the
+.Xr connect 2
+system call. The address argument is the netgraph address of the
+.Nm socket
+node already created. Once a data socket is associated with a node,
+any data packets received by the node are read using
+.Xr recvfrom 2
+and any packets to be sent out from the node are written using
+.Xr sendto 2 .
+In the case of data sockets, the
+.Dv "struct sockaddr_ng"
+contains the name of the
+.Em hook
+on which the data was received or should be sent.
+.Pp
+As a special case, to allow netgraph data sockets to be used as stdin or stdout
+on naive programs, a
+.Xr sendto 2
+with a NULL sockaddr pointer, a
+.Xr send 2
+or a
+.Xr write 2
+will succeed in the case where there is exactly ONE hook attached to
+the socket node, (and thus the path is unambiguous).
+.Pp
+There is a user library that simplifies using netgraph sockets; see
+.Xr netgraph 3 .
+.Sh HOOKS
+This node type supports hooks with arbitrary names (as long as
+they are unique) and always accepts hook connection requests.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_SOCK_CMD_NOLINGER
+When the last hook is removed from this node, it will shut down as
+if it had received a
+.Dv NGM_SHUTDOWN
+message. Attempts to access the sockets associated will return
+.Er ENOTCONN .
+.It Dv NGM_SOCK_CMD_LINGER
+This is the default mode. When the last hook is removed, the node will
+continue to exist, ready to accept new hooks until it
+is explicitly shut down.
+.El
+.Pp
+All other messages
+with neither the
+.Dv NGM_SOCKET_COOKIE
+or
+.Dv NGM_GENERIC_COOKIE
+will be passed unaltered up the
+.Dv NG_CONTROL
+socket.
+.Sh SHUTDOWN
+This node type shuts down and disappears when both the associated
+.Dv NG_CONTROL
+and
+.Dv NG_DATA
+sockets have been closed, or a
+.Dv NGM_SHUTDOWN
+control message is received. In the latter case, attempts to write
+to the still-open sockets will return
+.Er ENOTCONN .
+If the
+.Dv NGM_SOCK_CMD_NOLINGER
+message has been received, closure of the last hook will also initiate
+a shutdown of the node.
+.Sh BUGS
+It is not possible to reject the connection of a hook, though any
+data received on that hook can certainly be ignored.
+.Pp
+The controlling process is not notified of all events that an in-kernel node
+would be notified of, e.g. a new hook, or hook removal. We should define
+some node-initiated messages for this purpose (to be sent up the control
+socket).
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_ksocket 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/socket/ng_socket.8 b/sys/modules/netgraph/socket/ng_socket.8
new file mode 100644
index 0000000..cb224bc
--- /dev/null
+++ b/sys/modules/netgraph/socket/ng_socket.8
@@ -0,0 +1,173 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_socket.8,v 1.5 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_SOCKET 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_socket
+.Nd netgraph socket node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_message.h>
+.Fd #include <netgraph/ng_socket.h>
+.Sh DESCRIPTION
+A
+.Nm socket
+node is both a BSD socket and a netgraph node. The
+.Nm socket
+node type allows user-mode processes to participate in the kernel
+.Xr netgraph 4
+networking subsystem using the BSD socket interface. The process must have
+root privileges to be able to create netgraph sockets however once created,
+any process that has one may use it.
+.Pp
+A new
+.Nm socket
+node is created by creating a new socket of type
+.Dv NG_CONTROL
+in the protocol family
+.Dv PF_NETGRAPH ,
+using the
+.Xr socket 2
+system call.
+Any control messages received by the node
+and not having a cookie value of
+.Dv NGM_SOCKET_COOKIE
+are received by the process, using
+.Xr recvfrom 2 ;
+the socket address argument is a
+.Dv "struct sockaddr_ng"
+containing the sender's netgraph address. Conversely, control messages
+can be sent to any node by calling
+.Xr sendto 2 ,
+supplying the recipient's address in a
+.Dv "struct sockaddr_ng" .
+The
+.Xr bind 2
+system call may be used to assign a global netgraph name to the node.
+.Pp
+To transmit and receive netgraph data packets, a
+.Dv NG_DATA
+socket must also be created using
+.Xr socket 2
+and associated with a
+.Nm socket
+node.
+.Dv NG_DATA sockets do not automatically
+have nodes associated with them; they are bound to a specific node via the
+.Xr connect 2
+system call. The address argument is the netgraph address of the
+.Nm socket
+node already created. Once a data socket is associated with a node,
+any data packets received by the node are read using
+.Xr recvfrom 2
+and any packets to be sent out from the node are written using
+.Xr sendto 2 .
+In the case of data sockets, the
+.Dv "struct sockaddr_ng"
+contains the name of the
+.Em hook
+on which the data was received or should be sent.
+.Pp
+As a special case, to allow netgraph data sockets to be used as stdin or stdout
+on naive programs, a
+.Xr sendto 2
+with a NULL sockaddr pointer, a
+.Xr send 2
+or a
+.Xr write 2
+will succeed in the case where there is exactly ONE hook attached to
+the socket node, (and thus the path is unambiguous).
+.Pp
+There is a user library that simplifies using netgraph sockets; see
+.Xr netgraph 3 .
+.Sh HOOKS
+This node type supports hooks with arbitrary names (as long as
+they are unique) and always accepts hook connection requests.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_SOCK_CMD_NOLINGER
+When the last hook is removed from this node, it will shut down as
+if it had received a
+.Dv NGM_SHUTDOWN
+message. Attempts to access the sockets associated will return
+.Er ENOTCONN .
+.It Dv NGM_SOCK_CMD_LINGER
+This is the default mode. When the last hook is removed, the node will
+continue to exist, ready to accept new hooks until it
+is explicitly shut down.
+.El
+.Pp
+All other messages
+with neither the
+.Dv NGM_SOCKET_COOKIE
+or
+.Dv NGM_GENERIC_COOKIE
+will be passed unaltered up the
+.Dv NG_CONTROL
+socket.
+.Sh SHUTDOWN
+This node type shuts down and disappears when both the associated
+.Dv NG_CONTROL
+and
+.Dv NG_DATA
+sockets have been closed, or a
+.Dv NGM_SHUTDOWN
+control message is received. In the latter case, attempts to write
+to the still-open sockets will return
+.Er ENOTCONN .
+If the
+.Dv NGM_SOCK_CMD_NOLINGER
+message has been received, closure of the last hook will also initiate
+a shutdown of the node.
+.Sh BUGS
+It is not possible to reject the connection of a hook, though any
+data received on that hook can certainly be ignored.
+.Pp
+The controlling process is not notified of all events that an in-kernel node
+would be notified of, e.g. a new hook, or hook removal. We should define
+some node-initiated messages for this purpose (to be sent up the control
+socket).
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_ksocket 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/tee/Makefile b/sys/modules/netgraph/tee/Makefile
new file mode 100644
index 0000000..118668f
--- /dev/null
+++ b/sys/modules/netgraph/tee/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:22 archie Exp $
+
+KMOD= ng_tee
+SRCS= ng_tee.c
+MAN8= ng_tee.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/tee/ng_tee.4 b/sys/modules/netgraph/tee/ng_tee.4
new file mode 100644
index 0000000..1a774e6
--- /dev/null
+++ b/sys/modules/netgraph/tee/ng_tee.4
@@ -0,0 +1,117 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tee.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_TEE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_tee
+.Nd netgraph ``tee'' node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_tee.h>
+.Sh DESCRIPTION
+The
+.Nm tee
+node type has a purpose similar to the
+.Xr tee 1
+command.
+.Nm Tee
+nodes are useful for debugging or ``snooping'' on a connection
+between two netgraph nodes.
+.Nm Tee
+nodes have four hooks,
+.Dv right ,
+.Dv left ,
+.Dv right2left ,
+and
+.Dv left2right .
+All data received on
+.Dv right
+is sent unmodified to
+.Em both
+hooks
+.Dv left
+and
+.Dv right2left .
+Similarly, all data received on
+.Dv left
+is sent unmodified to both
+.Dv right
+and
+.Dv left2right .
+.Pp
+Packets may also be received on
+.Dv right2left
+and
+.Dv left2right ;
+if so, they are forwarded unchanged out hooks
+.Dv left
+and
+.Dv right ,
+respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbarfoo
+.It Dv right
+The connection to the node on the right.
+.It Dv left
+The connection to the node on the left.
+.It Dv right2left
+Tap for right to left traffic.
+.It Dv left2right
+Tap for left to right traffic.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following.
+.Bl -tag -width foo
+.It Dv NGM_TEE_GET_STATS
+Get statistics, returned as a
+.Dv "struct ng_tee_stats" .
+.It Dv NGM_TEE_CLR_STATS
+Clear statistics.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr tee 1 ,
+.Xr netgraph 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/tee/ng_tee.8 b/sys/modules/netgraph/tee/ng_tee.8
new file mode 100644
index 0000000..1a774e6
--- /dev/null
+++ b/sys/modules/netgraph/tee/ng_tee.8
@@ -0,0 +1,117 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tee.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_TEE 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_tee
+.Nd netgraph ``tee'' node type
+.Sh SYNOPSIS
+.Fd #include <netgraph/ng_tee.h>
+.Sh DESCRIPTION
+The
+.Nm tee
+node type has a purpose similar to the
+.Xr tee 1
+command.
+.Nm Tee
+nodes are useful for debugging or ``snooping'' on a connection
+between two netgraph nodes.
+.Nm Tee
+nodes have four hooks,
+.Dv right ,
+.Dv left ,
+.Dv right2left ,
+and
+.Dv left2right .
+All data received on
+.Dv right
+is sent unmodified to
+.Em both
+hooks
+.Dv left
+and
+.Dv right2left .
+Similarly, all data received on
+.Dv left
+is sent unmodified to both
+.Dv right
+and
+.Dv left2right .
+.Pp
+Packets may also be received on
+.Dv right2left
+and
+.Dv left2right ;
+if so, they are forwarded unchanged out hooks
+.Dv left
+and
+.Dv right ,
+respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbarfoo
+.It Dv right
+The connection to the node on the right.
+.It Dv left
+The connection to the node on the left.
+.It Dv right2left
+Tap for right to left traffic.
+.It Dv left2right
+Tap for left to right traffic.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following.
+.Bl -tag -width foo
+.It Dv NGM_TEE_GET_STATS
+Get statistics, returned as a
+.Dv "struct ng_tee_stats" .
+.It Dv NGM_TEE_CLR_STATS
+Clear statistics.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr tee 1 ,
+.Xr netgraph 4 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Julian Elischer <julian@whistle.com>
diff --git a/sys/modules/netgraph/tty/Makefile b/sys/modules/netgraph/tty/Makefile
new file mode 100644
index 0000000..5b9bd20
--- /dev/null
+++ b/sys/modules/netgraph/tty/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.2 1999/01/19 19:39:22 archie Exp $
+
+KMOD= ng_tty
+SRCS= ng_tty.c
+MAN8= ng_tty.8
+KMODDEPS= netgraph
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/tty/ng_tty.4 b/sys/modules/netgraph/tty/ng_tty.4
new file mode 100644
index 0000000..c3f0aa5
--- /dev/null
+++ b/sys/modules/netgraph/tty/ng_tty.4
@@ -0,0 +1,131 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_TTY 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_tty
+.Nd netgraph node type that is also a line discipline
+.Sh SYNOPSIS
+.Fd #include <sys/ttycom.h>
+.Fd #include <netgraph/ng_message.h>
+.Fd #include <netgraph/ng_tty.h>
+.Sh DESCRIPTION
+The
+.Nm tty
+node type is both a netgraph node type and a line discipline.
+A new node is created when the corresponding line discipline,
+.Dv NETGRAPHDISC ,
+is registered on a tty device (see
+.Xr tty 4 ")."
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the tty device are sent out on this hook,
+and frames received on
+.Dv hook
+are transmitted out on the tty device.
+No modification to the data is performed in either direction.
+While the line discipline is installed on a tty, the normal
+read and write operations are unavailable, returning
+.Er EIO .
+.Pp
+The node supports an optional ``hot character.'' If set to non-zero, incoming
+data from the tty device is queued until this character is seen.
+This avoids sending lots of mbufs containing a small number of bytes,
+but introduces potentially infinite latency.
+The default hot character is 0x7e, consistent with
+.Dv hook
+being connected to a
+.Xr ng_async 8
+type node. The hot character has no effect on the transmission of data.
+.Pp
+The node will attempt to give itself the same netgraph name as the name
+of the tty device.
+In any case, information about the node is available via the netgraph
+.Xr ioctl 2
+command
+.Dv NGIOCGINFO .
+This command returns a
+.Dv "struct nodeinfo"
+similar to the
+.Dv NGM_NODEINFO
+netgraph control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv hook
+.Xr tty 4
+serial data contained in
+.Dv mbuf
+structures, with arbitrary inter-frame boundaries.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_TTY_SET_HOTCHAR
+This command takes an integer argument and sets the hot character
+from the lower 8 bits. A hot character of zero disables queueing,
+so that all received data is forwarded immediately.
+.It Dv NGM_TTY_GET_HOTCHAR
+Returns an integer containing the current hot character in the lower
+eight bits.
+.Sh SHUTDOWN
+This node shuts down when the corresponding device is closed
+(or the line discipline is uninstalled on the device).
+The
+.Dv NGM_SHUTDOWN
+control message is not valid, and always returns the error
+.Er EOPNOTSUPP .
+.Sh BUGS
+The serial driver code also has a notion of a ``hot character.''
+Unfortunately, this value is statically defined in terms of the
+line discipline and cannot be changed.
+Therefore, if a hot character other than 0x7e (the default) is set for the
+.Nm tty
+node, the node has no way to convey this information to the
+serial driver, and sub-optimal performance may result.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr netgraph 4 ,
+.Xr tty 4 ,
+.Xr ng_async 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/tty/ng_tty.8 b/sys/modules/netgraph/tty/ng_tty.8
new file mode 100644
index 0000000..c3f0aa5
--- /dev/null
+++ b/sys/modules/netgraph/tty/ng_tty.8
@@ -0,0 +1,131 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_TTY 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_tty
+.Nd netgraph node type that is also a line discipline
+.Sh SYNOPSIS
+.Fd #include <sys/ttycom.h>
+.Fd #include <netgraph/ng_message.h>
+.Fd #include <netgraph/ng_tty.h>
+.Sh DESCRIPTION
+The
+.Nm tty
+node type is both a netgraph node type and a line discipline.
+A new node is created when the corresponding line discipline,
+.Dv NETGRAPHDISC ,
+is registered on a tty device (see
+.Xr tty 4 ")."
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the tty device are sent out on this hook,
+and frames received on
+.Dv hook
+are transmitted out on the tty device.
+No modification to the data is performed in either direction.
+While the line discipline is installed on a tty, the normal
+read and write operations are unavailable, returning
+.Er EIO .
+.Pp
+The node supports an optional ``hot character.'' If set to non-zero, incoming
+data from the tty device is queued until this character is seen.
+This avoids sending lots of mbufs containing a small number of bytes,
+but introduces potentially infinite latency.
+The default hot character is 0x7e, consistent with
+.Dv hook
+being connected to a
+.Xr ng_async 8
+type node. The hot character has no effect on the transmission of data.
+.Pp
+The node will attempt to give itself the same netgraph name as the name
+of the tty device.
+In any case, information about the node is available via the netgraph
+.Xr ioctl 2
+command
+.Dv NGIOCGINFO .
+This command returns a
+.Dv "struct nodeinfo"
+similar to the
+.Dv NGM_NODEINFO
+netgraph control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobar
+.It Dv hook
+.Xr tty 4
+serial data contained in
+.Dv mbuf
+structures, with arbitrary inter-frame boundaries.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_TTY_SET_HOTCHAR
+This command takes an integer argument and sets the hot character
+from the lower 8 bits. A hot character of zero disables queueing,
+so that all received data is forwarded immediately.
+.It Dv NGM_TTY_GET_HOTCHAR
+Returns an integer containing the current hot character in the lower
+eight bits.
+.Sh SHUTDOWN
+This node shuts down when the corresponding device is closed
+(or the line discipline is uninstalled on the device).
+The
+.Dv NGM_SHUTDOWN
+control message is not valid, and always returns the error
+.Er EOPNOTSUPP .
+.Sh BUGS
+The serial driver code also has a notion of a ``hot character.''
+Unfortunately, this value is statically defined in terms of the
+line discipline and cannot be changed.
+Therefore, if a hot character other than 0x7e (the default) is set for the
+.Nm tty
+node, the node has no way to convey this information to the
+serial driver, and sub-optimal performance may result.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr netgraph 4 ,
+.Xr tty 4 ,
+.Xr ng_async 8 ,
+.Xr ngctl 8 .
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/vjc/Makefile b/sys/modules/netgraph/vjc/Makefile
new file mode 100644
index 0000000..b27f767
--- /dev/null
+++ b/sys/modules/netgraph/vjc/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# $Whistle: Makefile,v 1.1 1999/01/24 06:48:07 archie Exp $
+
+KMOD= ng_vjc
+SRCS= ng_vjc.c slcompress.c
+MAN8= ng_vjc.8
+KMODDEPS= netgraph
+
+.PATH: ${.CURDIR}/../../../net
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/vjc/ng_vjc.4 b/sys/modules/netgraph/vjc/ng_vjc.4
new file mode 100644
index 0000000..c86be55
--- /dev/null
+++ b/sys/modules/netgraph/vjc/ng_vjc.4
@@ -0,0 +1,210 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_VJC 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_vjc
+.Nd Van Jacobsen compression netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/slcompress.h>
+.Fd #include <netgraph/ng_vjc.h>
+.Sh DESCRIPTION
+The
+.Nm vjc
+node type performs Van Jacobsen compression, which is used
+over PPP, SLIP, and other point-to-point IP connections to
+compress TCP packet headers. The
+.Dv ip
+hook represents the uncompressed side of the node, while the
+.Dv vjcomp ,
+.Dv vjuncomp ,
+and
+.Dv vjip
+nodes represent the compressed side of the node. Packets received on the
+.Dv ip
+will be compressed or passed through as appropriate. Packets received
+on the other three hooks will be uncompressed as appropriate.
+This node also supports ``always pass through'' mode in either direction.
+.Pp
+Van Jacobsen compression only applies to TCP packets.
+Only ``normal'' (i.e., common case) TCP packets are actually compressed.
+These are output on the
+.Dv vjcomp
+hook. Other TCP packets are run through the state machine but not
+compressed; these appear on the
+.Dv vjuncomp
+hook.
+Other non-TCP IP packets are forwarded unchanged to
+.Dv vjip .
+.Pp
+When connecting to a
+.Xr ng_ppp 8
+node, the
+.Dv ip ,
+.Dv vjuncomp ,
+.Dv vjcomp ,
+and
+.Dv vjip
+nodes should be connected to the
+.Xr ng_ppp 8
+node's
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_ip
+nodes, respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazi
+.It Dv ip
+Upstream (uncompressed) IP packets.
+.It Dv vjcomp
+Downstream compressed TCP packets.
+.It Dv vjuncomp
+Downstream uncompressed TCP packets.
+.It Dv vjip
+Downstream uncompressed IP packets.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_VJC_SET_CONFIG
+This command resets the compression state and configures it according
+to the supplied
+.Dv "struct ngm_vjc_config"
+argument. This structure contains the following fields:
+.Bd -literal -offset 4n
+struct ngm_vjc_config {
+ u_char enableComp; /* Enable compression */
+ u_char enableDecomp; /* Enable decompression */
+ u_char maxChannel; /* Number of outgoing channels - 1 */
+ u_char compressCID; /* OK to compress outgoing CID's */
+};
+.Ed
+.Pp
+When
+.Dv enableComp
+is set to zero, all packets received on the
+.Dv ip
+hook are forwarded unchanged out the
+.Dv vjip
+hook. Similarly, when
+.Dv enableDecomp
+is set to zero, all packets received on the
+.Dv vjip
+hook are forwarded unchanged out the
+.Dv ip
+hook, and packets are not accepted on the
+.Dv vjcomp
+and
+.Dv vjuncomp
+hooks.
+When a node is first created,
+both compression and decompression are disabled and the node is
+therefore operating in bi-directional ``pass through'' mode.
+.Pp
+When enabling compression,
+.Dv maxChannel
+should be set to the number of outgoing compression channels minus one,
+and is a value between 3 and 15, inclusive. Also, the
+.Dv compressCID
+field indicates whether it is OK to compress the CID field for
+outgoing compressed TCP packets. This value should be zero unless
+either (a) it not possible for an incoming frame to be lost, or
+(b) lost frames can be reliably detected and a
+.Dv NGM_VJC_RECV_ERROR
+message is immediately sent whenever this occurs.
+.It Dv NGM_VJC_GET_STATE
+This command returns the node's current state described by the
+.Dv "struct slcompress"
+structure, which is defined in
+.Dv "net/slcompress.h" .
+.It Dv NGM_VJC_CLR_STATS
+Clears the node statistics counters. Statistics are also cleared whenever the
+.Dv enableComp
+or
+.Dv enableDecomp
+fields are changed from zero to one by a
+.Dv NGM_VJC_SET_CONFIG
+control message.
+.It Dv NGM_VJC_RECV_ERROR
+When the
+.Dv compressCID
+is set to one, this message must be sent to the node immediately
+after detecting that a received frame has been lost, due to a bad
+checksum or for any other reason. Failing to do this can result
+in corrupted TCP stream data.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Because the initialization routine in the kernel implementation of
+Van Jacobsen compression initializes both compression and decompression
+at once, this node does not allow compression and decompression to
+be enabled in separate operations. In order to enable one when
+the other is already enabled, first both must be disabled, then
+both enabled. This of course resets the node state. This restriction
+may be lifted in a later version.
+.Pp
+When built as a loadable kernel module, this module includes the file
+.Dv "net/slcompress.c" .
+Although loading the module should fail if
+.Dv "net/slcompress.c"
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 8 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A V. Jacobsen
+.%T "Compressing TCP/IP Headers"
+.%O RFC 1144
+.Re
+.Rs
+.%A G. McGregor
+.%T "The PPP Internet Control Protocol (IPCP)"
+.%O RFC 1332
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
diff --git a/sys/modules/netgraph/vjc/ng_vjc.8 b/sys/modules/netgraph/vjc/ng_vjc.8
new file mode 100644
index 0000000..c86be55
--- /dev/null
+++ b/sys/modules/netgraph/vjc/ng_vjc.8
@@ -0,0 +1,210 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" Author: Archie Cobbs <archie@whistle.com>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_VJC 8
+.Os FreeBSD 4.0
+.Sh NAME
+.Nm ng_vjc
+.Nd Van Jacobsen compression netgraph node type
+.Sh SYNOPSIS
+.Fd #include <net/slcompress.h>
+.Fd #include <netgraph/ng_vjc.h>
+.Sh DESCRIPTION
+The
+.Nm vjc
+node type performs Van Jacobsen compression, which is used
+over PPP, SLIP, and other point-to-point IP connections to
+compress TCP packet headers. The
+.Dv ip
+hook represents the uncompressed side of the node, while the
+.Dv vjcomp ,
+.Dv vjuncomp ,
+and
+.Dv vjip
+nodes represent the compressed side of the node. Packets received on the
+.Dv ip
+will be compressed or passed through as appropriate. Packets received
+on the other three hooks will be uncompressed as appropriate.
+This node also supports ``always pass through'' mode in either direction.
+.Pp
+Van Jacobsen compression only applies to TCP packets.
+Only ``normal'' (i.e., common case) TCP packets are actually compressed.
+These are output on the
+.Dv vjcomp
+hook. Other TCP packets are run through the state machine but not
+compressed; these appear on the
+.Dv vjuncomp
+hook.
+Other non-TCP IP packets are forwarded unchanged to
+.Dv vjip .
+.Pp
+When connecting to a
+.Xr ng_ppp 8
+node, the
+.Dv ip ,
+.Dv vjuncomp ,
+.Dv vjcomp ,
+and
+.Dv vjip
+nodes should be connected to the
+.Xr ng_ppp 8
+node's
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_ip
+nodes, respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -width foobarbazi
+.It Dv ip
+Upstream (uncompressed) IP packets.
+.It Dv vjcomp
+Downstream compressed TCP packets.
+.It Dv vjuncomp
+Downstream uncompressed TCP packets.
+.It Dv vjip
+Downstream uncompressed IP packets.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_VJC_SET_CONFIG
+This command resets the compression state and configures it according
+to the supplied
+.Dv "struct ngm_vjc_config"
+argument. This structure contains the following fields:
+.Bd -literal -offset 4n
+struct ngm_vjc_config {
+ u_char enableComp; /* Enable compression */
+ u_char enableDecomp; /* Enable decompression */
+ u_char maxChannel; /* Number of outgoing channels - 1 */
+ u_char compressCID; /* OK to compress outgoing CID's */
+};
+.Ed
+.Pp
+When
+.Dv enableComp
+is set to zero, all packets received on the
+.Dv ip
+hook are forwarded unchanged out the
+.Dv vjip
+hook. Similarly, when
+.Dv enableDecomp
+is set to zero, all packets received on the
+.Dv vjip
+hook are forwarded unchanged out the
+.Dv ip
+hook, and packets are not accepted on the
+.Dv vjcomp
+and
+.Dv vjuncomp
+hooks.
+When a node is first created,
+both compression and decompression are disabled and the node is
+therefore operating in bi-directional ``pass through'' mode.
+.Pp
+When enabling compression,
+.Dv maxChannel
+should be set to the number of outgoing compression channels minus one,
+and is a value between 3 and 15, inclusive. Also, the
+.Dv compressCID
+field indicates whether it is OK to compress the CID field for
+outgoing compressed TCP packets. This value should be zero unless
+either (a) it not possible for an incoming frame to be lost, or
+(b) lost frames can be reliably detected and a
+.Dv NGM_VJC_RECV_ERROR
+message is immediately sent whenever this occurs.
+.It Dv NGM_VJC_GET_STATE
+This command returns the node's current state described by the
+.Dv "struct slcompress"
+structure, which is defined in
+.Dv "net/slcompress.h" .
+.It Dv NGM_VJC_CLR_STATS
+Clears the node statistics counters. Statistics are also cleared whenever the
+.Dv enableComp
+or
+.Dv enableDecomp
+fields are changed from zero to one by a
+.Dv NGM_VJC_SET_CONFIG
+control message.
+.It Dv NGM_VJC_RECV_ERROR
+When the
+.Dv compressCID
+is set to one, this message must be sent to the node immediately
+after detecting that a received frame has been lost, due to a bad
+checksum or for any other reason. Failing to do this can result
+in corrupted TCP stream data.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh BUGS
+Because the initialization routine in the kernel implementation of
+Van Jacobsen compression initializes both compression and decompression
+at once, this node does not allow compression and decompression to
+be enabled in separate operations. In order to enable one when
+the other is already enabled, first both must be disabled, then
+both enabled. This of course resets the node state. This restriction
+may be lifted in a later version.
+.Pp
+When built as a loadable kernel module, this module includes the file
+.Dv "net/slcompress.c" .
+Although loading the module should fail if
+.Dv "net/slcompress.c"
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 8 ,
+.Xr ng_iface 8 ,
+.Xr ngctl 8 .
+.Rs
+.%A V. Jacobsen
+.%T "Compressing TCP/IP Headers"
+.%O RFC 1144
+.Re
+.Rs
+.%A G. McGregor
+.%T "The PPP Internet Control Protocol (IPCP)"
+.%O RFC 1332
+.Re
+.Sh AUTHOR
+Archie Cobbs <archie@whistle.com>
OpenPOWER on IntegriCloud