xref: /freebsd/share/man/man4/ng_one2many.4 (revision 77a0943ded95b9e6438f7db70c4a28e4d93946d4)
1.\" Copyright (c) 2000 Whistle Communications, Inc.
2.\" All rights reserved.
3.\"
4.\" Subject to the following obligations and disclaimer of warranty, use and
5.\" redistribution of this software, in source or object code forms, with or
6.\" without modifications are expressly permitted by Whistle Communications;
7.\" provided, however, that:
8.\" 1. Any and all reproductions of the source or object code must include the
9.\"    copyright notice above and the following disclaimer of warranties; and
10.\" 2. No rights are granted, in any manner or form, to use Whistle
11.\"    Communications, Inc. trademarks, including the mark "WHISTLE
12.\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
13.\"    such appears in the above copyright notice or in the software.
14.\"
15.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
16.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
17.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
18.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
20.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
21.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
22.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
23.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
24.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
25.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
27.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
31.\" OF SUCH DAMAGE.
32.\"
33.\" Author: Archie Cobbs <archie@freebsd.org>
34.\"
35.\" $FreeBSD$
36.\"
37.Dd November 15, 2000
38.Dt NG_ONE2MANY 4
39.Os FreeBSD
40.Sh NAME
41.Nm ng_one2many
42.Nd packet multiplexing netgraph node type
43.Sh SYNOPSIS
44.Fd #include <netgraph/ng_one2many.h>
45.Sh DESCRIPTION
46The
47.Nm one2many
48provides a simple mechanism for routing packets over several links
49in a one-to-many (and in the reverse direction, many-to-one) fashion.
50There is a single hook named
51.Dv one ,
52and multiple hooks named
53.Dv many0 ,
54.Dv many1 ,
55etc.
56Packets received on any of the
57.Dv many
58hooks are forwarded out the
59.Dv one
60hook.
61Packets received on the
62.Dv one
63hook are forwarded out one of the
64.Dv many
65hooks; which hook is determined by the node's configured
66transmit algorithm.
67Packets are not altered in any way.
68.Pp
69Each of the connected many links may be considered to be up or down.
70Packets are never delivered out a many hook that is down.
71How a link is determined to be up or down depends on the node's
72configured link failure detection algorithm.
73.Sh TRANSMIT ALGORITHMS
74At this time, the only algorithm for determing the outgoing
75.Dv many
76hook is a simple round-robin delivery algorithm.
77Packets are delivered out the many hooks in sequential order.
78.Pp
79In the future other algorithms may be added as well.
80.Sh LINK FAILURE DETECTION
81At this time, the only algorithm for determining when a link
82has failed, other than the hook being disconnected, is the
83``manual'' algorithm: the node is explicitly told which of
84the links are up via the
85.Dv NGM_ONE2MANY_SET_CONFIG
86control message (see below).
87Newly connected links are down until configured otherwise.
88.Pp
89In the future other algorithms may be added as well.
90.Sh HOOKS
91This node type supports up to
92.Dv NG_ONE2MANY_MAX_LINKS
93hooks named
94.Dv many0 ,
95.Dv many1 ,
96etc.,
97plus a single hook named
98.Dv one .
99.Sh CONTROL MESSAGES
100This node type supports the generic control messages, plus the
101following:
102.Bl -tag -width foo
103.It Dv NGM_ONE2MANY_SET_CONFIG
104Sets the node configuration using a
105.Dv "struct ng_one2many_link_config"
106as the control message argument:
107.Bd -literal -offset 0
108/* Node configuration structure */
109struct ng_one2many_config {
110  u_int32_t   xmitAlg;        /* how to distribute packets */
111  u_int32_t   failAlg;        /* how to detect link failure */
112  u_char      enabledLinks[NG_ONE2MANY_MAX_LINKS];
113};
114.Ed
115.Pp
116Currently, the only valid setting for the
117.Dv xmitAlg
118field is
119.Dv NG_ONE2MANY_XMIT_ROUNDROBIN ;
120this is also the default setting.
121The only valid setting for
122.Dv failAlg
123is
124.Dv NG_ONE2MANY_FAIL_MANUAL ;
125this is also the default setting.
126.It Dv NGM_ONE2MANY_GET_CONFIG
127Returns the current node configuration in a
128.Dv "struct ng_one2many_link_config" .
129.It Dv NGM_ONE2MANY_GET_STATS
130This command takes a 32 bit link number as an argument and
131returns a
132.Dv "struct ng_one2many_link_stats"
133containing statistics for the corresponding
134.Dv many
135link, which may or may not be currently connected:
136.Bd -literal -offset 0
137/* Statistics structure (one for each link) */
138struct ng_one2many_link_stats {
139  u_int64_t   recvOctets;     /* total octets rec'd on link */
140  u_int64_t   recvPackets;    /* total pkts rec'd on link */
141  u_int64_t   xmitOctets;     /* total octets xmit'd on link */
142  u_int64_t   xmitPackets;    /* total pkts xmit'd on link */
143};
144.Ed
145.Pp
146To access statistics for the
147.Dv one
148link, use the link number
149.Dv -1 .
150.It Dv NGM_ONE2MANY_CLR_STATS
151This command takes a 32 bit link number as an argument and
152clears the statistics for that link.
153.It Dv NGM_ONE2MANY_GETCLR_STATS
154Same as
155.Dv NGM_ONE2MANY_GET_STATS ,
156but also atomically clears the statistics for the link as well.
157.Sh SHUTDOWN
158This node shuts down upon receipt of a
159.Dv NGM_SHUTDOWN
160control message, or when all hooks have been disconnected.
161.Sh EXAMPLE
162The following commands will set up Ethernet interfaces
163.Dv fxp0
164to deliver packets alternating over the physical interfaces
165corresponding to networking interfaces
166.Dv fxp0
167through
168.Dv fxp3 :
169.Bd -literal -offset 0
170  # Plumb nodes together
171  ngctl mkpeer fxp0: ng_one2many upper one
172  ngctl connect fxp0: fxp0:upper lower many0
173  ngctl connect fxp1: fxp0:upper lower many1
174  ngctl connect fxp2: fxp0:upper lower many2
175  ngctl connect fxp3: fxp0:upper lower many3
176  # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
177  ngctl msg fxp1: setpromisc 1
178  ngctl msg fxp3: setpromisc 1
179  ngctl msg fxp2: setpromisc 1
180  ngctl msg fxp1: setautosrc 0
181  ngctl msg fxp3: setautosrc 0
182  ngctl msg fxp2: setautosrc 0
183  # Configure all four links as up
184  ngctl msg fxp0:upper \\
185    setconfig "{ xmitAlg=1 failAlg=1 enabledLinks={ 1 1 1 1 } }"
186  # Bring up interface
187  ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
188.Ed
189.Pp
190With a similar setup on a peer machine (using the address
191192.168.1.2), a point-to-point
192Ethernet connection with four times normal bandwidth is
193achieved.
194.Sh BUGS
195More transmit and link failure algorithms should be supported.
196A good candidate is Cisco's Etherchannel.
197.Sh SEE ALSO
198.Xr netgraph 4 ,
199.Xr ng_bridge 4 ,
200.Xr ng_ether 4 ,
201.Xr ngctl 8
202.Sh HISTORY
203The
204.Nm
205node type was implemented in
206.Fx 4.2 .
207.Sh AUTHORS
208.An Archie Cobbs Aq archie@freebsd.org
209