xref: /freebsd/share/man/man4/ng_one2many.4 (revision 2357939bc239bd5334a169b62313806178dd8f30)
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 January 26, 2001
38.Dt NG_ONE2MANY 4
39.Os
40.Sh NAME
41.Nm ng_one2many
42.Nd packet multiplexing netgraph node type
43.Sh SYNOPSIS
44.In sys/types.h
45.In netgraph/ng_one2many.h
46.Sh DESCRIPTION
47The
48.Nm one2many
49provides a simple mechanism for routing packets over several links
50in a one-to-many (and in the reverse direction, many-to-one) fashion.
51There is a single hook named
52.Dv one ,
53and multiple hooks named
54.Dv many0 ,
55.Dv many1 ,
56etc.
57Packets received on any of the
58.Dv many
59hooks are forwarded out the
60.Dv one
61hook.
62Packets received on the
63.Dv one
64hook are forwarded out one or more of the
65.Dv many
66hooks; which hook(s) is determined by the node's configured
67transmit algorithm.
68Packets are not altered in any way.
69.Pp
70Each of the connected many links may be considered to be up or down.
71Packets are never delivered out a many hook that is down.
72How a link is determined to be up or down depends on the node's
73configured link failure detection algorithm.
74.Pp
75Before an interface or link can be plumbed into a group, its status
76must be marked as being
77.Dq up .
78This is normally setup during the initial boot stages by
79.Xr rc.conf 5 .
80It is also possible to change an interfaces status to
81.Dq up
82by using the
83.Xr ifconfig 8
84utility.
85.Sh TRANSMIT ALGORITHMS
86.Bl -tag -width foo
87.It NG_ONE2MANY_XMIT_ROUNDROBIN
88Packets are delivered out the many hooks in sequential order.
89Each packet goes out on a different
90.Dv many
91hook.
92.It NG_ONE2MANY_XMIT_ALL
93Packets are delivered out all the
94.Dv many
95hooks. Each packet goes out each
96.Dv many
97hook.
98.El
99.Pp
100In the future other algorithms may be added as well.
101.Sh LINK FAILURE DETECTION
102At this time, the only algorithm for determining when a link
103has failed, other than the hook being disconnected, is the
104``manual'' algorithm: the node is explicitly told which of
105the links are up via the
106.Dv NGM_ONE2MANY_SET_CONFIG
107control message (see below).
108Newly connected links are down until configured otherwise.
109.Pp
110In the future other algorithms may be added as well.
111.Sh HOOKS
112This node type supports up to
113.Dv NG_ONE2MANY_MAX_LINKS
114hooks named
115.Dv many0 ,
116.Dv many1 ,
117etc.,
118plus a single hook named
119.Dv one .
120.Sh CONTROL MESSAGES
121This node type supports the generic control messages, plus the
122following:
123.Bl -tag -width foo
124.It Dv NGM_ONE2MANY_SET_CONFIG
125Sets the node configuration using a
126.Dv "struct ng_one2many_link_config"
127as the control message argument:
128.Bd -literal -offset 0n
129/* Node configuration structure */
130struct ng_one2many_config {
131  u_int32_t   xmitAlg;        /* how to distribute packets */
132  u_int32_t   failAlg;        /* how to detect link failure */
133  u_char      enabledLinks[NG_ONE2MANY_MAX_LINKS];
134};
135.Ed
136.Pp
137Currently, the only valid setting for the
138.Dv xmitAlg
139field is
140.Dv NG_ONE2MANY_XMIT_ROUNDROBIN ;
141this is also the default setting.
142The only valid setting for
143.Dv failAlg
144is
145.Dv NG_ONE2MANY_FAIL_MANUAL ;
146this is also the default setting.
147.It Dv NGM_ONE2MANY_GET_CONFIG
148Returns the current node configuration in a
149.Dv "struct ng_one2many_link_config" .
150.It Dv NGM_ONE2MANY_GET_STATS
151This command takes a 32 bit link number as an argument and
152returns a
153.Dv "struct ng_one2many_link_stats"
154containing statistics for the corresponding
155.Dv many
156link, which may or may not be currently connected:
157.Bd -literal -offset 0n
158/* Statistics structure (one for each link) */
159struct ng_one2many_link_stats {
160  u_int64_t   recvOctets;     /* total octets rec'd on link */
161  u_int64_t   recvPackets;    /* total pkts rec'd on link */
162  u_int64_t   xmitOctets;     /* total octets xmit'd on link */
163  u_int64_t   xmitPackets;    /* total pkts xmit'd on link */
164};
165.Ed
166.Pp
167To access statistics for the
168.Dv one
169link, use the link number
170.Dv -1 .
171.It Dv NGM_ONE2MANY_CLR_STATS
172This command takes a 32 bit link number as an argument and
173clears the statistics for that link.
174.It Dv NGM_ONE2MANY_GETCLR_STATS
175Same as
176.Dv NGM_ONE2MANY_GET_STATS ,
177but also atomically clears the statistics for the link as well.
178.El
179.Sh SHUTDOWN
180This node shuts down upon receipt of a
181.Dv NGM_SHUTDOWN
182control message, or when all hooks have been disconnected.
183.Sh EXAMPLES
184The following commands will set up Ethernet interfaces
185.Dv fxp0
186to deliver packets alternating over the physical interfaces
187corresponding to networking interfaces
188.Dv fxp0
189through
190.Dv fxp3 :
191.Bd -literal -offset 0n
192  # Plumb nodes together
193
194  ngctl mkpeer fxp0: one2many upper one
195  ngctl connect fxp0: fxp0:upper lower many0
196  ngctl connect fxp1: fxp0:upper lower many1
197  ngctl connect fxp2: fxp0:upper lower many2
198  ngctl connect fxp3: fxp0:upper lower many3
199
200  # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
201
202  ngctl msg fxp1: setpromisc 1
203  ngctl msg fxp2: setpromisc 1
204  ngctl msg fxp3: setpromisc 1
205  ngctl msg fxp1: setautosrc 0
206  ngctl msg fxp2: setautosrc 0
207  ngctl msg fxp3: setautosrc 0
208
209  # Configure all four links as up
210
211  ngctl msg fxp0:upper \\
212    setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
213
214  # Bring up interface
215
216  ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
217.Ed
218.Pp
219With a similar setup on a peer machine (using the address
220192.168.1.2), a point-to-point
221Ethernet connection with four times normal bandwidth is
222achieved.
223.Sh BUGS
224More transmit and link failure algorithms should be supported.
225A good candidate is Cisco's Etherchannel.
226.Sh SEE ALSO
227.Xr ifconfig 8 ,
228.Xr netgraph 4 ,
229.Xr ng_bridge 4 ,
230.Xr ng_ether 4 ,
231.Xr ng_hub 4 ,
232.Xr ngctl 8
233.Sh HISTORY
234The
235.Nm
236node type was implemented in
237.Fx 4.2 .
238.Sh AUTHORS
239.An -nosplit
240The
241.Nm one2many
242netgraph node (with round-robin algorithm) was written by
243.An Archie Cobbs
244.Aq archie@FreeBSD.org .
245The all algorithm was added by
246.An Rogier R. Mulhuijzen
247.Aq drwilco@drwilco.net .
248