Index: head/share/man/man4/divert.4 =================================================================== --- head/share/man/man4/divert.4 (revision 67507) +++ head/share/man/man4/divert.4 (revision 67508) @@ -1,170 +1,170 @@ .\" $FreeBSD$ .\" .Dd June 18, 1996 .Dt DIVERT 4 .Os FreeBSD .Sh NAME .Nm divert .Nd kernel packet diversion mechanism .Sh SYNOPSIS .Fd #include .Fd #include .Fd #include .Ft int .Fn socket PF_INET SOCK_RAW IPPROTO_DIVERT .Sh DESCRIPTION .Pp Divert sockets are similar to raw IP sockets, except that they can be bound to a specific .Nm port via the .Xr bind 2 system call. The IP address in the bind is ignored; only the port number is significant. A divert socket bound to a divert port will receive all packets diverted to that port by some (here unspecified) kernel mechanism(s). Packets may also be written to a divert port, in which case they re-enter kernel IP packet processing. .Pp Divert sockets are normally used in conjunction with FreeBSD's packet filtering implementation and the .Xr ipfw 8 program. By reading from and writing to a divert socket, matching packets can be passed through an arbitrary ``filter'' as they travel through the host machine, special routing tricks can be done, etc. .Sh READING PACKETS Packets are diverted either as they are ``incoming'' or ``outgoing.'' Incoming packets are diverted after reception on an IP interface, whereas outgoing packets are diverted before next hop forwarding. .Pp Diverted packets may be read unaltered via .Xr read 2 , .Xr recv 2 , or .Xr recvfrom 2 . In the latter case, the address returned will have its port set to the some tag supplied by the packet diverter, (usually the ipfw rule number) and the IP address set to the (first) address of the interface on which the packet was received (if the packet was incoming) or .Dv INADDR_ANY (if the packet was outgoing). In the case of an incoming packet the interface name will also be placed in the 8 bytes following the address, (assuming it fits). .Sh WRITING PACKETS Writing to a divert socket is similar to writing to a raw IP socket; the packet is injected ``as is'' into the normal kernel IP packet processing and minimal error checking is done. Packets are written as either incoming or outgoing: if .Xr write 2 or .Xr send 2 is used to deliver the packet, or if .Xr sendto 2 is used with a destination IP address of .Dv INADDR_ANY , then the packet is treated as if it were outgoing, i.e., destined for a non-local address. Otherwise, the packet is assumed to be incoming and full packet routing is done. .Pp In the latter case, the IP address specified must match the address of some local interface, or an interface name must be found after the IP address. If an interface name is found, that interface will be used and the value of the IP address will be ignored (other than the fact that it is not .Dv INADDR_ANY ). This is to indicate on which interface the packet ``arrived.'' .Pp Normally, packets read as incoming should be written as incoming; similarly for outgoing packets. When reading and then writing back packets, passing the same socket address supplied by .Xr recvfrom 2 unmodified to .Xr sendto 2 simplifies things (see below). .Pp The port part of the socket address passed to the .Xr sendto 2 contains a tag that should be meaningful to the diversion module. In the case of .Xr ipfw 8 the tag is interpreted as the rule number .Em after which rule processing should restart. .Sh LOOP AVOIDANCE Packets written into a divert socket .Po using .Xr sendto 2 .Pc re-enter the packet filter at the rule number following the tag given in the port part of the socket address, which is usually already set at the rule number that caused the diversion (not the next rule if there are several at the same number). If the 'tag' is altered to indicate an alternative re-entry point, care should be taken to avoid loops, where the same packet is diverted more than once at the same rule. .Sh DETAILS To enable divert sockets, your kernel must be compiled with the option .Dv IPDIVERT . .Pp If a packet is diverted but no socket is bound to the port, or if .Dv IPDIVERT is not enabled in the kernel, the packet is dropped. .Pp Incoming packet fragments which get diverted are fully reassembled before delivery; the diversion of any one fragment causes the entire packet to get diverted. If different fragments divert to different ports, then which port ultimately gets chosen is unpredictable. .Pp Packets are received and sent unchanged, except that packets written as outgoing have their IP header checksums overwritten with the correct value. Packets written as incoming and having incorrect checksums will be dropped. Otherwise, all header fields are unchanged (and therefore in network order). .Pp Binding to port numbers less than 1024 requires super-user access, as does creating a socket of type SOCK_RAW. .Sh ERRORS Writing to a divert socket can return these errors, along with the usual errors possible when writing raw packets: .Bl -tag -width Er .It Bq Er EINVAL The packet had an invalid header, or the IP options in the packet and the socket options set were incompatible. .It Bq Er EADDRNOTAVAIL The destination address contained an IP address not equal to .Dv INADDR_ANY that was not associated with any interface. .El .Sh SEE ALSO .Xr bind 2 , .Xr recvfrom 2 , .Xr sendto 2 , .Xr socket 2 , .Xr ipfw 8 .Sh BUGS This is an attempt to provide a clean way for user mode processes to implement various IP tricks like address translation, but it could be cleaner, and it's too dependent on .Xr ipfw 8 . .Pp It's questionable whether incoming fragments should be reassembled before being diverted. For example, if only some fragments of a packet destined for another machine don't get routed through the local machine, the packet is lost. This should probably be a settable socket option in any case. .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com , +.An Archie Cobbs Aq archie@freebsd.org , Whistle Communications Corp. Index: head/share/man/man4/ipfirewall.4 =================================================================== --- head/share/man/man4/ipfirewall.4 (revision 67507) +++ head/share/man/man4/ipfirewall.4 (revision 67508) @@ -1,192 +1,192 @@ .\" .\" $FreeBSD$ .\" .Dd June 22, 1997 .Dt IPFIREWALL 4 .Os .Sh NAME .Nm ipfirewall .Nd IP packet filter and traffic accounting .Sh SYNOPSIS .Fd #include .Fd #include .Fd #include .Fd #include .Ft int .Fn setsockopt raw_socket IPPROTO_IP "ipfw option" "struct ipfw" size .Sh DESCRIPTION Ipfirewall (alias ipfw) is a system facility which allows filtering, redirecting, and other operations on IP packets travelling through system interfaces. Packets are matched by applying an ordered list of pattern rules against each packet until a match is found, at which point the corresponding action is taken. Rules are numbered from 1 to 65534; multiple rules may share the same number. .Pp There is one rule that always exists, rule number 65535. This rule normally causes all packets to be dropped. Hence, any packet which does not match a lower numbered rule will be dropped. However, a kernel compile time option .Dq IPFIREWALL_DEFAULT_TO_ACCEPT allows the administrator to change this fixed rule to permit everything. .Pp The value passed to .Fn setsockopt is a struct ip_fw describing the rule (see below). In some cases (such as .Dv IP_FW_DEL ) , only the rule number is significant. .Ss Commands The following socket options are used to manage the rule list: .Bl -tag -width "IP_FW_FLUSH" .It Dv IP_FW_ADD inserts the rule into the rule list .It Dv IP_FW_DEL deletes all rules having the matching rule number .It Dv IP_FW_GET returns the (first) rule having the matching rule number .It Dv IP_FW_ZERO zeros the statistics associated with all rules having the matching rule number. If the rule number is zero, all rules are zeroed. .It Dv IP_FW_FLUSH removes all rules (except 65535). .El .Pp When the kernel security level is greater than 2, only .Dv IP_FW_GET is allowed. .Ss Rule Structure Rules are described by the structures in ip_fw.h. .Ss Rule Actions Each rule has an action described by the IP_FW_F_COMMAND bits in the flags word: .Bl -tag -width "IP_FW_F_DIVERT" .It Dv IP_FW_F_DENY Drop packet and stop processing. .It Dv IP_FW_F_REJECT drop packet; send rejection via ICMP or TCP and stop processing. .It Dv IP_FW_F_ACCEPT accept packet and stop processing. .It Dv IP_FW_F_COUNT increment counters; continue matching .It Dv IP_FW_F_DIVERT divert packet to a .Xr divert 4 socket and stop processing. .It Dv IP_FW_F_TEE Send a copy of this packet to a .Xr divert 4 socket and continue processing the original packet at the next rule. .It Dv IP_FW_F_SKIPTO skip to rule number .Va fu_skipto_rule At this time the target rule number must be greater than the active rule number. .It Dv IP_FW_F_PIPE The packet is marked for the use of .Xr dummynet 4 , and processing stopped. .It Dv IP_FW_F_QUEUE The packet is marked for the use of .Xr dummynet 4 , and processing stopped. .It Dv IP_FW_F_FWD The packet is accepted but the destination is hijacked. (see .Xr ipfw 8 ) .El .Pp In the case of .Dv IP_FW_F_REJECT , if the .Va fu_reject_code is a number from 0 to 255, then an ICMP unreachable packet is sent back to the original packet's source IP address, with the corresponding code. Otherwise, the value must be 256 and the protocol .Dv IPPROTO_TCP , in which case a TCP reset packet is sent instead. .Pp With .Dv IP_FW_F_SKIPTO , all succeeding rules having rule number less than .Va fu_skipto_rule are skipped. .Ss Kernel Options Options in the kernel configuration file: .Bl -tag -width "optionsXIPFIREWALL_VERBOSE_LIMIT" .It Cd options IPFIREWALL enable .Nm .It Cd options IPFIREWALL_VERBOSE enable firewall output .It Cd options IPFIREWALL_VERBOSE_LIMIT limit firewall output .It Cd options IPDIVERT enable .Xr divert 4 sockets .El .Pp When packets match a rule with the .Dv IP_FW_F_PRN bit set, a message is logged to the console if .Dv IPFIREWALL_VERBOSE has been enabled; Dq IPFIREWALL_VERBOSE_LIMIT limits the maximum number of times each rule can cause a log message. These variables are also available via the .Xr sysctl 3 interface. .Sh RETURN VALUES The .Fn setsockopt function returns 0 on success. Otherwise, -1 is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS The .Fn setsockopt function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The IP option field was improperly formed; an option field was shorter than the minimum value or longer than the option buffer provided. .It Bq Er EINVAL A structural error in ip_fw structure occurred (n_src_p+n_dst_p too big, ports set for ALL/ICMP protocols etc.). .It Bq Er EINVAL An invalid rule number was used. .El .Sh SEE ALSO .Xr setsockopt 2 , .Xr divert 4 , .Xr ip 4 , .Xr ipfw 8 , .Xr sysctl 8 . .Sh BUGS .Pp This man page still needs work. .Sh HISTORY The ipfw facility was initially written as package to BSDI by .An Daniel Boulet .Aq danny@BouletFermat.ab.ca . It has been heavily modified and ported to .Fx by .Ar Ugen J.S.Antsilevich .Aq ugen@NetVision.net.il . .Pp Several enhancements added by .An Archie Cobbs -.Aq archie@whistle.com . +.Aq archie@freebsd.org . Index: head/share/man/man4/netgraph.4 =================================================================== --- head/share/man/man4/netgraph.4 (revision 67507) +++ head/share/man/man4/netgraph.4 (revision 67508) @@ -1,1114 +1,1114 @@ .\" 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 -.\" Archie Cobbs +.\" Authors: Julian Elischer +.\" Archie Cobbs .\" .\" $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 .Tn 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 .Tn ASCII name). .Pp Nodes may be assigned a globally unique .Tn ASCII name which can be used to refer to the node. The name must not contain the characters .Dq \&. or .Dq \&: 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 .Tn 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 .Tn 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 .Dq \&. or a .Dq \&: 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 .Dq 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 .Tn 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 .Dq source routed by specifying the corresponding sequence of hooks as the destination address for the message (relative addressing). Otherwise, the recipient node global .Tn 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 .Dq 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. .Pp If message is delivered to an address that implies that it arrived at that node through a particular hook, that hook is identified to the receiving node. This allows a message to be rerouted or passed on, should a node decide that this is required. .Sh Netgraph is Functional In order to minimize latency, most .Nm 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 .Dq receive data method. .Pp It is allowable for nodes to reject a data packet, or to pass it back to the caller in a modified or completely replaced form. The caller can notify the node being called that it does not wish to receive any such packets by using the .Fn NG_SEND_DATA macro, in which case, the second node should just discard rejected packets. If the sender knows how to handle returned packets, it must use the .Fn NG_SEND_DATA_RET macro, which will adjust the parameters to point to the returned data or NULL if no data was returned to the caller. No packet return is possible across a queuing link (though an explicitly sent return is of course possible, it doesn't mean quite the same thing). .Pp 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 .Fn 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 .Fn splnet . Nodes that run at other priorities (e.g. interfaces) can be directly linked to other nodes so that the combination runs at the other priority, however any interaction with nodes running at splnet MUST be achievd via the queueing functions, (which use the .Fn netisr feature of the kernel). Note that messages are always received at .Fn 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 Ns . 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 .Fn 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 .Tn 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 receiving node must always .Fn m_freem the mbuf chain on completion or error, pass it back (reject it), or pass it on to another node (or kernel module) which will then be responsible for freeing it. If a node passes a packet back to the caller, it does not have to be the same mbuf, in which case the original must be freed. Passing a packet back allows a module to modify the original data (e.g. encrypt it), or in some other way filter it (e.g. packet filtering). .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 .Pa netgraph.h . The memory for meta-data must allocated via .Fn malloc with type .Dv M_NETGRAPH . As with the data itself, it is the receiver's responsibility to .Fn 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. Meta-data may be passed back in the same way that mbuf data may be passed back. As with mbuf data, the rejected or returned meta-data pointer may point to the same or different meta-data as that passed in, and if it is different, the original must be freed. .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 .Fn malloc and containing the synchronous response. In both directions, (request and response) it is up to the receiver of that message to .Fn free the control message buffer. All control messages and replies are allocated with .Fn malloc type .Dv M_NETGRAPH . .Pp If the message was delivered via a specific hook, that hook will also be made known, which allows the use of such things as flow-control messages, and status change messages, where the node may want to forward the message out another hook to that on which it arrived. .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 .Dq 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 .Dq \&. (referred to as .Dq \&.: ) 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)[](dlci16)<-->(mux)[ ] [ A ] [ B ](dlci20)<---+ [ C ] | | [ type PPP ] +>(mux)[] [ D ] .Ed .Pp One could always send a control message to node C from anywhere by using the name .Em "Frame1:uplink.dlci16" . In this case, node C would also be notified that the message reached it via its hook .Dq mux . 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 . In each of these cases, where a relative addressing mode is used, the recipient is notified of the hook on which the message arrived, as well as the originating node. This allows the option of hop-by-hop distibution of messages and state information. Data messages are .Em only 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 .Dq 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 */ hook_p lasthook); /* last hook traversed */ 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 */ struct mbuf **ret_m, /* return data here */ meta_p *ret_meta); /* return Meta-data here */ 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 .Dq 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 .Dq 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 .Tn ASCII form. The .Tn 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 .Tn ASCII name of the command, corresponding to the .Dv cmd header field. .It o The .Dv args field contains a NUL-terminated .Tn 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 .Tn 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 .Dq fieldname=value . .It o Any array element or structure field whose value is equal to its .Dq 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. .Tn 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 .Pa 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 .Dq 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 .Tn 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 .Tn 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 .Tn 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 .Pa 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 .Fn ng_newtype , supplying a pointer to the type's .Dv struct ng_type structure. .Pp The .Fn 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 .Dq 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 .Dq 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 .Pq Dq 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 .Pq Dq downstream and one hook for each DLCI. .Pp .It FRAME RELAY LMI Automatically handles frame relay .Dq 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 .Dq 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, unless it is returned from the recipient. .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 .Fn NG_FREE_META "meta" and .Fn NG_FREE_DATA "m" "meta" should be used if possible to free data and meta data (see .Pa netgraph.h ) . .It 3 Messages sent using .Fn ng_send_message are freed by the recipient. 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 ng_async 4 , .Xr ng_bpf 4 , .Xr ng_cisco 4 , .Xr ng_ether 4 , .Xr ng_echo 4 , .Xr ng_frame_relay 4 , .Xr ng_hole 4 , .Xr ng_iface 4 , .Xr ng_ksocket 4 , .Xr ng_lmi 4 , .Xr ng_mppc 4 , .Xr ng_ppp 4 , .Xr ng_pppoe 4 , .Xr ng_rfc1490 4 , .Xr ng_socket 4 , .Xr ng_tee 4 , .Xr ng_tty 4 , .Xr ng_UI 4 , .Xr ng_vjc 4 , .Xr ng_{type} 4 , .Xr ngctl 8 , .Xr nghook 8 .Sh HISTORY The .Nm system was designed and first implemented at Whistle Communications, Inc. in a version of .Fx 2.2 customized for the Whistle InterJet. It first made its debut in the main tree in .Fx 3.4 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com , +.An Julian Elischer Aq julian@freebsd.org , with contributions by -.An Archie Cobbs Aq archie@whistle.com . +.An Archie Cobbs Aq archie@freebsd.org . Index: head/share/man/man4/ng_UI.4 =================================================================== --- head/share/man/man4/ng_UI.4 (revision 67507) +++ head/share/man/man4/ng_UI.4 (revision 67508) @@ -1,91 +1,91 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_UI.8,v 1.4 1999/01/25 02:37:56 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_UI 4 .Os FreeBSD .Sh NAME .Nm ng_UI .Nd UI netgraph node type .Sh SYNOPSIS .Fd #include .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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_async.4 =================================================================== --- head/share/man/man4/ng_async.4 (revision 67507) +++ head/share/man/man4/ng_async.4 (revision 67508) @@ -1,169 +1,169 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_ASYNC 4 .Os FreeBSD .Sh NAME .Nm ng_async .Nd asynchronous framing netgraph node type .Sh SYNOPSIS .Fd #include .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 .Dq 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 4 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 4 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 .Dq 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 4 , .Xr ng_tty 4 , .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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_bpf.4 =================================================================== --- head/share/man/man4/ng_bpf.4 (revision 67507) +++ head/share/man/man4/ng_bpf.4 (revision 67508) @@ -1,154 +1,154 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $ .\" .Dd December 2, 1999 .Dt NG_BPF 4 .Os FreeBSD .Sh NAME .Nm ng_bpf .Nd Berkeley packet filter netgraph node type .Sh SYNOPSIS .Fd #include .Fd #include .Sh DESCRIPTION The .Nm bpf node type allows Berkeley Packet Filter (see .Xr bpf 4 ) 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 4 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 4 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 program may be installed using the .Dv NGM_BPF_SET_PROGRAM 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_PROGRAM 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 4 program or else .Er EINVAL is returned. .It Dv NGM_BPF_GET_PROGRAM This command takes an .Tn 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 .Tn 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 .Tn 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 .Pa net/bpf_filter.c . Although loading the module should fail if .Pa 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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh SEE ALSO .Xr netgraph 4 , .Xr bpf 4 , .Xr ngctl 8 .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_cisco.4 =================================================================== --- head/share/man/man4/ng_cisco.4 (revision 67507) +++ head/share/man/man4/ng_cisco.4 (revision 67508) @@ -1,174 +1,174 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_cisco.8,v 1.5 1999/01/25 23:46:26 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_CISCO 4 .Os FreeBSD .Sh NAME .Nm ng_cisco .Nd Cisco HDLC protocol netgraph node type .Sh SYNOPSIS .Fd #include .Fd #include .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 .Dq keep alive and an .Dq 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 inet6 , .Dv atalk , and .Dv ipx hooks, which transmit and receive raw IP, IPv6, AppleTalk, and IPX packets, respectively. Typically these hooks would connect to the corresponding hooks on an .Xr ng_iface 4 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 .Dq 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 4 node, as is usually the case, then configuration is automatic as the .Xr ng_iface 4 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 inet6 IPv6 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 4 , .Xr ngctl 8 .Rs .%A D. Perkins .%T "Requirements for an Internet Standard Point-to-Point Protocol" .%O RFC 1547 .Re .Sh LEGAL .Tn Cisco is a trademark of Cisco Systems, Inc. .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com , -.An Archie Cobbs Aq archie@whistle.com +.An Julian Elischer Aq julian@freebsd.org , +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_echo.4 =================================================================== --- head/share/man/man4/ng_echo.4 (revision 67507) +++ head/share/man/man4/ng_echo.4 (revision 67508) @@ -1,73 +1,73 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_echo.8,v 1.4 1999/01/25 23:46:26 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_ECHO 4 .Os FreeBSD .Sh NAME .Nm ng_echo .Nd netgraph echo node type .Sh SYNOPSIS .Fd #include .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 A .Nm echo node accepts 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_ether.4 =================================================================== --- head/share/man/man4/ng_ether.4 (revision 67507) +++ head/share/man/man4/ng_ether.4 (revision 67508) @@ -1,209 +1,209 @@ .\" Copyright (c) 2000 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" .Dd June 26, 2000 .Dt NG_ETHER 4 .Os FreeBSD .Sh NAME .Nm ng_ether .Nd Ethernet netgraph node type .Sh SYNOPSIS .Fd #include .Sh DESCRIPTION The .Nm ng_ether netgraph node type allows Ethernet interfaces to interact with the .Xr netgraph 4 networking subsystem. Once the .Nm module is loaded in the kernel, a node is automatically created for each Ethernet interface in the system. Each node will attempt to name itself with the same name as the associated interface. All .Nm nodes are persistent for as long as the interface itself exists. .Pp Three hooks are supported: .Dv lower , .Dv upper , and .Dv orphans . The hook name .Dv divert may be used as an alias for .Dv lower , and is provided for backward compatibility. In reality the two names represent the same hook. .Pp The .Dv lower hook is a connection to the raw Ethernet device. When connected, all incoming packets are diverted out this hook. Writing to this hook results in a raw Ethernet frame being transmitted by the device. Normal outgoing packets are not affected by .Dv lower being connected. .Pp The .Dv upper hook is a connection to the upper protocol layers. When connected, all outgoing packets are diverted out this hook. Writing to this hook results in a raw Ethernet frame being received by the kernel just as if it had come in over the wire. Normal incoming packets are not affected by .Dv upper being connected. .Pp The .Dv orphans hook is equivalent to .Dv lower , except that only unrecognized packets (that would otherwise be discarded) are written to the hook, and normal incoming traffic is unaffected. At most one of .Dv orphans and .Dv lower may be connected at any time. .Pp In all cases, frames are raw Ethernet frames with the standard 14 byte Ethernet header (but no checksum). .Pp When no hooks are connected, .Dv upper and .Dv lower are in effect connected together, so that packets flow normally upwards and downwards. .Sh HOOKS This node type supports the following hooks: .Pp .Bl -tag -width orphans .It Dv lower Connection to the lower device link layer. .It Dv upper Connection to the upper protocol layers. .It Dv orphans Like .Dv lower , but only receives unrecognized packets. .El .Sh CONTROL MESSAGES This node type supports the generic control messages, plus the following: .Bl -tag -width foo .It Dv NGM_ETHER_GET_IFNAME Returns the name of the associated interface as a NUL-terminated ASCII string. Normally this is the same as the name of the node. .It Dv NGM_ETHER_GET_IFINDEX Returns the global index of the associated interface as a 32 bit integer. .It Dv NGM_ETHER_GET_ENADDR Returns the device's unique six byte Ethernet address. .It Dv NGM_ETHER_SET_ENADDR Sets the device's unique six byte Ethernet address. This control message is equivalent to using the .Dv SIOCSIFLLADDR .Xr ioctl 2 system call. .It Dv NGM_ETHER_SET_PROMISC Enable or disable promiscuous mode. This message includes a single 32 bit integer flag that enables or disables promiscuous mode on the interface. .It Dv NGM_ETHER_GET_PROMISC Get the current value of the node's promiscuous flag. The returned value is always either one or zero. Note that this flag reflects the node's own promiscuous setting and does not necessarily reflect the promiscuous state of the actual interface, which can be affected by other means (e.g., .Xr bpf 4 ) . .It Dv NGM_ETHER_SET_AUTOSRC Sets the automatic source address override flag. This message includes a single 32 bit integer flag that causes all outgoing packets to have their source Ethernet address field overwritten with the device's unique Ethernet address. If this flag is set to zero, the source address in outgoing packets is not modified. The default setting for this flag is enabled. .It Dv NGM_ETHER_GET_AUTOSRC Get the current value of the node's source address override flag. The returned value is always either one or zero. .El .Sh SHUTDOWN This node is persistent for as long as the interface exists. Upon receipt of a .Dv NGM_SHUTDOWN control message, all hooks are disconnected, promiscuous mode is disabled, and the source address override flag is reenabled, but the node is not removed. If the interface itself is detached (e.g., because of PCCARD removal), the node disappears as well. .Sh EXAMPLE This command dumps all unrecognized packets received by the .Dv fxp0 interface to standard output decoded in hex and ASCII: .Bd -literal -offset indent nghook -a fxp0: orphans .Ed .Pp This command sends the contents of .Dv foo.pkt out the interface .Dv ed0 : .Bd -literal -offset indent cat foo.pkt | nghook fxp0: orphans .Ed .Pp These commands insert an .Xr ng_tee 4 node between the lower and upper protocol layers, which can be used for tracing packet flow, statistics, etc.: .Bd -literal -offset indent ngctl mkpeer fxp0: tee lower right ngctl connect fxp0: lower upper left .Ed .Sh SEE ALSO .Xr arp 4 , .Xr netgraph 4 , .Xr netintro 4 , .Xr ifconfig 8 , .Xr nghook 8 , .Xr ngctl 8 .Sh AUTHORS .An Julian Elischer Aq julian@FreeBSD.org .An Archie Cobbs Aq archie@FreeBSD.org Index: head/share/man/man4/ng_frame_relay.4 =================================================================== --- head/share/man/man4/ng_frame_relay.4 (revision 67507) +++ head/share/man/man4/ng_frame_relay.4 (revision 67508) @@ -1,98 +1,98 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $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 4 .Os FreeBSD .Sh NAME .Nm ng_frame_relay .Nd frame relay netgraph node type .Sh SYNOPSIS .Fd #include .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 4 ). .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 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_hole.4 =================================================================== --- head/share/man/man4/ng_hole.4 (revision 67507) +++ head/share/man/man4/ng_hole.4 (revision 67508) @@ -1,73 +1,73 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_hole.8,v 1.4 1999/01/25 23:46:26 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_HOLE 4 .Os FreeBSD .Sh NAME .Nm ng_hole .Nd netgraph discard node type .Sh SYNOPSIS .Fd #include .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 A .Nm node accepts 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_iface.4 =================================================================== --- head/share/man/man4/ng_iface.4 (revision 67507) +++ head/share/man/man4/ng_iface.4 (revision 67508) @@ -1,153 +1,153 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_IFACE 4 .Os FreeBSD .Sh NAME .Nm ng_iface .Nd interface netgraph node type .Sh SYNOPSIS .Fd #include .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 interface appears which is accessible via .Xr ifconfig 8 . .Nm Iface node interfaces are named .Dv ng0 , .Dv ng1 , etc. When a node is shutdown, the corresponding interface is removed and the interface name becomes available for reuse by future .Nm iface nodes; new nodes always take the first unused interface. The node itself is assigned the same name as its interface, unless the name already exists, in which case the node remains unnamed. .Pp An .Nm iface node has 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 into the corresponding protocol stack. The currently supported protocols are IP, IPv6, AppleTalk, IPX, ATM, NATM, and NS. .Pp An .Nm iface node be configured as a point-to-point interface or a broadcast interface. The configuration can only be changed when the interface is down. The default mode is point-to-point. .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 inet6 Transmission and reception of IPv6 packets. .It Dv atalk Transmission and reception of AppleTalk packets. .It Dv ipx Transmission and reception of IPX packets. .It Dv atm Transmission and reception of ATM packets. .It Dv natm Transmission and reception of NATM 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_POINT2POINT Set the interface to point-to-point mode. The interface must not currently be up. .It Dv NGM_IFACE_BROADCAST Set the interface to broadcast mode. The interface must not currently be up. .It Dv NGM_CISCO_GET_IPADDR This message is defined by the .Xr ng_cisco 4 node type; see .Xr ng_cisco 4 for a description. .El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN control message. The associated interface is removed and becomes available for use by future .Nm iface nodes. .Pp Unlike most other node types, an .Nm iface node does .Em not go away when all hooks have been disconnected; rather, and explicit .Dv NGM_SHUTDOWN control message is required. .Sh SEE ALSO .Xr bpf 4 , .Xr netgraph 4 , .Xr ng_cisco 4 , .Xr ifconfig 8 , .Xr ngctl 8 .Sh HISTORY The .Nm iface node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_ksocket.4 =================================================================== --- head/share/man/man4/ng_ksocket.4 (revision 67507) +++ head/share/man/man4/ng_ksocket.4 (revision 67508) @@ -1,187 +1,187 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" .Dd November 15, 1999 .Dt NG_KSOCKET 4 .Os FreeBSD .Sh NAME .Nm ng_ksocket .Nd kernel socket netgraph node type .Sh SYNOPSIS .Fd #include .Sh DESCRIPTION A .Nm ksocket node is both a netgraph node and a BSD socket. The .Nm node type allows one to open a socket inside the kernel and have it appear as a Netgraph node. The .Nm node type is the reverse of the socket node type (see .Xr ng_socket 4 ) : 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 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 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 // , 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 .Tn 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 local/"/tmp/foo.socket" .It Dv PF_INET inet/192.168.1.1:1234 .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 .Tn 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_lmi.4 =================================================================== --- head/share/man/man4/ng_lmi.4 (revision 67507) +++ head/share/man/man4/ng_lmi.4 (revision 67508) @@ -1,135 +1,135 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_lmi.8,v 1.4 1999/01/25 23:46:27 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_LMI 4 .Os FreeBSD .Sh NAME .Nm ng_lmi .Nd frame relay LMI protocol netgraph node type .Sh SYNOPSIS .Fd #include .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 4 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 4 , .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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_mppc.4 =================================================================== --- head/share/man/man4/ng_mppc.4 (revision 67507) +++ head/share/man/man4/ng_mppc.4 (revision 67508) @@ -1,192 +1,192 @@ .\" Copyright (c) 1996-2000 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 +.\" Author: Archie Cobbs .\" .\" $Whistle: ng_mppc.8,v 1.1 1999/12/08 20:20:39 archie Exp $ .\" $FreeBSD$ .\" .Dd December 8, 1999 .Dt NG_MPPC 4 .Os FreeBSD .Sh NAME .Nm ng_mppc .Nd Microsoft MPPC/MPPE compression and encryption netgraph node type .Sh SYNOPSIS .Fd #include .Sh DESCRIPTION The .Nm mppc node type implements the Microsoft Point-to-Point Compression (MPPC) and Microsoft Point-to-Point Encryption (MPPE) sub-protocols of the PPP protocol. These protocols are often used in conjunction with the Point-to-Point Tunneling Protocol (PPTP). .Pp The node has two hooks, .Dv "comp" for compression and .Dv "decomp" for decompression. Typically one or both of these hooks would be connected to the .Xr ng_ppp 4 node type hook of the same name. Each direction of traffic flow is independent of the other. .Sh HOOKS This node type supports the following hooks: .Pp .Bl -tag -compact -width vjc_vjuncomp .It Dv comp Connection to .Xr ng_ppp 4 .Dv "comp" hook. Incoming frames are compressed and/or encrypted, and sent back out the same hook. .It Dv decomp Connection to .Xr ng_ppp 4 .Dv "decomp" hook. Incoming frames are decompressed and/or decrypted, and sent back out the same hook. .El .Sh CONTROL MESSAGES This node type supports the generic control messages, plus the following: .Bl -tag -width foo .It Dv NGM_MPPC_CONFIG_COMP This command resets and configures the node for a session in the outgoing traffic direction (i.e., for compression and/or encryption). This command takes a .Dv "struct ng_mppc_config" as an argument: .Bd -literal -offset 0 /* Length of MPPE key */ #define MPPE_KEY_LEN 16 /* MPPC/MPPE PPP negotiation bits */ #define MPPC_BIT 0x00000001 /* mppc compression bits */ #define MPPE_40 0x00000020 /* use 40 bit key */ #define MPPE_128 0x00000040 /* use 128 bit key */ #define MPPE_BITS 0x00000060 /* mppe encryption bits */ #define MPPE_STATELESS 0x01000000 /* use stateless mode */ #define MPPC_VALID_BITS 0x01000061 /* possibly valid bits */ /* Configuration for a session */ struct ng_mppc_config { u_char enable; /* enable */ u_int32_t bits; /* config bits */ u_char startkey[MPPE_KEY_LEN]; /* start key */ }; .Ed The .Dv enabled field enables traffic flow through the node. The .Dv bits field contains the bits as negotiated by the Compression Control Protocol (CCP) in PPP. The .Dv startkey is only necessary if MPPE was negotiated, and must be equal to the session start key as defined for MPPE. This key is based on the MS-CHAP credentials used at link authentication time. .It Dv NGM_MPPC_CONFIG_DECOMP This command resets and configures the node for a session in the incoming traffic direction (i.e., for decompression and/or decryption). This command takes a .Dv "struct ng_mppc_config" as an argument. .It Dv NGM_MPPC_RESETREQ This message contains no arguments, and is bi-directional. If an error is detected during decompression, this message is sent by the node to the originator of the .Dv NGM_MPPC_CONFIG_DECOMP message that initiated the session. The receiver should respond by sending a PPP CCP Reset-Request to the peer. .Pp This message may also be received by this node type when a CCP Reset-Request is received by the local PPP entity. The node will respond by flushing its outgoing compression and encryption state so the remote side can resynchronize. .El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN control message, or when both hooks have been disconnected. .Sh COMPILATION The kernel options .Dv NETGRAPH_MPPC_COMPRESSION and .Dv NETGRAPH_MPPC_ENCRYPTION are supplied to selectively compile in either or both capabilities. At least one of these must be defined, or else this node type is useless. .Pp The MPPC protocol requires proprietary compression code available from Hi/Fn (formerly STAC). These files must be obtained elsewhere and added to the kernel sources before this node type will compile with the .Dv NETGRAPH_MPPC_COMPRESSION option. .Sh BUGS In PPP, encryption should be handled by the Encryption Control Procotol (ECP) rather than CCP. However, Microsoft combined both compression and encryption into their ``compression'' algorithm, which is confusing. .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_ppp 4 , .Xr ngctl 8 .Rs .%A G. Pall .%T "Microsoft Point-To-Point Compression (MPPC) Protocol" .%O RFC 2118 .Re .Rs .%A G. S. Pall .%A G. Zorn .%T "Microsoft Point-To-Point Encryption (MPPE) Protocol" .%O draft-ietf-pppext-mppe-04.txt .Re .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 .Sh AUTHORS -Archie Cobbs +Archie Cobbs Index: head/share/man/man4/ng_ppp.4 =================================================================== --- head/share/man/man4/ng_ppp.4 (revision 67507) +++ head/share/man/man4/ng_ppp.4 (revision 67508) @@ -1,388 +1,388 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_PPP 4 .Os FreeBSD .Sh NAME .Nm ng_ppp .Nd PPP protocol netgraph node type .Sh SYNOPSIS .Fd #include .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 Jacobson 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 4 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 JACOBSON 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 Jacobson compression and/or decompression will become active. Normally these hooks connect to the corresponding hooks of a single .Xr ng_vjc 4 node. The PPP node is compatible with the .Dq pass through modes of the .Xr ng_vjc 4 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 an unexpected packet on the .Dv 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 Individual PPP link number .Dv .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 4 .Dv ip hook .It Dv vjc_vjcomp Connection to .Xr ng_vjc 4 .Dv vjcomp hook .It Dv vjc_vjuncomp Connection to .Xr ng_vjc 4 .Dv vjuncomp hook .It Dv vjc_vjip Connection to .Xr ng_vjc 4 .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 Jacobson 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 4 node type. When received, these messages are simply forwarded to the adjacent .Xr ng_vjc 4 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 4 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 4 , .Xr ng_iface 4 , .Xr ng_mppc 4 , .Xr ng_pppoe 4 , .Xr ng_vjc 4 , .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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_pppoe.4 =================================================================== --- head/share/man/man4/ng_pppoe.4 (revision 67507) +++ head/share/man/man4/ng_pppoe.4 (revision 67508) @@ -1,404 +1,404 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $ .\" .Dd October 28, 1999 .Dt NG_PPPOE 4 .Os FreeBSD .Sh NAME .Nm ng_pppoe .Nd RFC 2516 PPPOE protocol netgraph node type .Sh SYNOPSIS .Fd #include .Fd #include .Sh DESCRIPTION The .Nm pppoe 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 EXAMPLES 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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 4 , .Xr ng_ppp 4 , .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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_pptpgre.4 =================================================================== --- head/share/man/man4/ng_pptpgre.4 (revision 67507) +++ head/share/man/man4/ng_pptpgre.4 (revision 67508) @@ -1,159 +1,159 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $ .\" .Dd November 29, 1999 .Dt NG_PPTPGRE 4 .Os FreeBSD .Sh NAME .Nm ng_pptpgre .Nd PPTP GRE protocol netgraph node type .Sh SYNOPSIS .Fd #include .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 This node type expects to receive complete IP packets, including the IP header, on the .Dv lower hook, but it transmits outgoing frames without any IP header. 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 4 node, and the .Dv lower hook to the .Dv "inet/raw/gre" hook of a .Xr ng_ksocket 4 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" . .It Dv NGM_PPTPGRE_GET_STATS This command returns a .Dv "struct ng_pptpgre_stats" containing various node statistics. .It Dv NGM_PPTPGRE_CLR_STATS This command resets the node statistics. .It Dv NGM_PPTPGRE_GETCLR_STATS This command atomically gets and resets the node statistics, returning a .Dv "struct ng_pptpgre_stats" . .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 4 , .Xr ng_ppp 4 , .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 BUGS The node should not expect incoming GRE packets to have an IP header. This behavior is inherited from the (converse) behavior of raw IP sockets. An intermediate node that strips IP headers in one direction should be used instead. .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_rfc1490.4 =================================================================== --- head/share/man/man4/ng_rfc1490.4 (revision 67507) +++ head/share/man/man4/ng_rfc1490.4 (revision 67508) @@ -1,115 +1,115 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_rfc1490.8,v 1.4 1999/01/25 23:46:27 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_RFC1490 4 .Os FreeBSD .Sh NAME .Nm ng_rfc1490 .Nd RFC 1490 netgraph node type .Sh SYNOPSIS .Fd #include .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 4 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 4 , .Xr ng_iface 4 , .Xr ngctl 8 .Rs .%A C. Brown .%A 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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_socket.4 =================================================================== --- head/share/man/man4/ng_socket.4 (revision 67507) +++ head/share/man/man4/ng_socket.4 (revision 67508) @@ -1,178 +1,178 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_socket.8,v 1.5 1999/01/25 23:46:27 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_SOCKET 4 .Os FreeBSD .Sh NAME .Nm ng_socket .Nd netgraph socket node type .Sh SYNOPSIS .Fd #include .Fd #include .Sh DESCRIPTION A .Nm socket node is both a BSD socket and a netgraph node. The .Nm 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 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 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 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_tee.4 =================================================================== --- head/share/man/man4/ng_tee.4 (revision 67507) +++ head/share/man/man4/ng_tee.4 (revision 67508) @@ -1,124 +1,124 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_tee.8,v 1.4 1999/01/25 23:46:27 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_TEE 4 .Os FreeBSD .Sh NAME .Nm ng_tee .Nd netgraph ``tee'' node type .Sh SYNOPSIS .Fd #include .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 .Dq 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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org Index: head/share/man/man4/ng_tty.4 =================================================================== --- head/share/man/man4/ng_tty.4 (revision 67507) +++ head/share/man/man4/ng_tty.4 (revision 67508) @@ -1,139 +1,139 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_TTY 4 .Os FreeBSD .Sh NAME .Nm ng_tty .Nd netgraph node type that is also a line discipline .Sh SYNOPSIS .Fd #include .Fd #include .Fd #include .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 .Dq 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 4 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 .Dq 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 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 4 , .Xr ngctl 8 .Sh HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/ng_vjc.4 =================================================================== --- head/share/man/man4/ng_vjc.4 (revision 67507) +++ head/share/man/man4/ng_vjc.4 (revision 67508) @@ -1,223 +1,223 @@ .\" 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 +.\" Author: Archie Cobbs .\" .\" $FreeBSD$ .\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $ .\" .Dd January 19, 1999 .Dt NG_VJC 4 .Os FreeBSD .Sh NAME .Nm ng_vjc .Nd Van Jacobson compression netgraph node type .Sh SYNOPSIS .Fd #include .Fd #include .Sh DESCRIPTION The .Nm vjc node type performs Van Jacobson 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 hooks 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 .Dq always pass through mode in either direction. .Pp Van Jacobson compression only applies to TCP packets. Only .Dq 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 4 node, the .Dv ip , .Dv vjuncomp , .Dv vjcomp , and .Dv vjip hooks should be connected to the .Xr ng_ppp 4 node's .Dv vjc_ip , .Dv vjc_vjcomp , .Dv vjc_vjuncomp , and .Dv vjc_ip hooks, 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 .Dq 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. The .Dv compressCID field indicates whether it is OK to compress the CID header field for outgoing compressed TCP packets. This value should be zero unless either (a) it is not possible for an outgoing frame to be lost, or (b) lost frames can be reliably detected and immediately reported to the peer's decompression engine (see .Dv NGM_VJC_RECV_ERROR below). .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 .Pa 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 peer has CID header field compression enabled, this message must be sent to the local .Nm vjc 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 Jacobson 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 .Pa net/slcompress.c . Although loading the module should fail if .Pa 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 4 , .Xr ng_iface 4 , .Xr ngctl 8 .Rs .%A V. Jacobson .%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 HISTORY The .Nm node type was implemented in .Fx 4.0 . .Sh AUTHORS -.An Archie Cobbs Aq archie@whistle.com +.An Archie Cobbs Aq archie@freebsd.org Index: head/share/man/man4/udbp.4 =================================================================== --- head/share/man/man4/udbp.4 (revision 67507) +++ head/share/man/man4/udbp.4 (revision 67508) @@ -1,118 +1,118 @@ .\" Copyright (c) 1999 .\" Nick Hibma . All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Bill Paul. .\" 4. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY NICK HIBMA AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL NICK HIBMA OR THE VOICES IN HIS HEAD .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON 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 ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd April 30, 2000 .Dt UDBP 4 .Os .Sh NAME .Nm udbp .Nd USB Double Bulk Pipe driver .Sh SYNOPSIS .Cd "device udbp" .Sh DESCRIPTION The .Nm driver provides support for host-to-host cables that contain at least two bulk pipes (one for each direction), for example the EzLink cable and the NetChip 1080 chip. .Pp .\" XXX The description of how to add netgraph to the kernel .\" is out of place here. It should be limited to the .\" netgraph(4) manpage only. However, that page does .\" not yet give instructions for kldload(8) for the .\" clueless. Working on it -- sheldonh It requires .Xr netgraph 4 to be avalable. This can be done either by adding .Cd "options NETGRAPH" to your kernel configuration file, or alternatively loading .Xr netgraph 4 as a module, either from .Pa /boot/loader.conf or from the command line, before the .Nm module. .Sh EXAMPLE .Dl options NETGRAPH .Dl device udbp .Pp Add the .Nm driver to the kernel. .Pp .Dl kldload netgraph .Dl kldload udbp .Pp Load the .Xr netgraph 4 module and then the .Nm driver. .Pp .Dl ngctl mkpeer udbp0: iface data inet .Dl ifconfig ng0 10.0.0.1 10.0.0.2 .Pp Create a new network interface node and connect its inet hook to the data hook of the .Nm node. .Xr ifconfig 8 configures the resulting network interface ng0 with a local IP address of 10.0.0.1 and a remote IP address of 10.0.0.2. On the remote host, the two IP addresses should of course be reversed. .Pp .Sh SEE ALSO .Xr netgraph 4 , .Xr ohci 4 , .Xr uhci 4 , .Xr usb 4 , .Xr ng_iface 8 , .Xr ngctl 8 .Sh HISTORY The .Nm driver first appeared in .Fx 5.0 . .Sh AUTHORS The .Nm driver was written by .An Doug Ambrisko Aq ambrisko@whistle.com , -.An Julian Elischer Aq julian@whistle.com +.An Julian Elischer Aq julian@freebsd.org and .An Nick Hibma Aq n_hibma@freebsd.org . .Pp This manual page was written by .An Nick Hibma Aq n_hibma@freebsd.org .