xref: /freebsd/share/man/man4/ng_one2many.4 (revision 74bf4e164ba5851606a27d4feff27717452583e5)
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 interface's 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.
96Each packet goes out each
97.Dv many
98hook.
99.El
100.Pp
101In the future other algorithms may be added as well.
102.Sh LINK FAILURE DETECTION
103At this time, the only algorithm for determining when a link
104has failed, other than the hook being disconnected, is the
105``manual'' algorithm: the node is explicitly told which of
106the links are up via the
107.Dv NGM_ONE2MANY_SET_CONFIG
108control message (see below).
109Newly connected links are down until configured otherwise.
110.Pp
111In the future other algorithms may be added as well.
112.Sh HOOKS
113This node type supports up to
114.Dv NG_ONE2MANY_MAX_LINKS
115hooks named
116.Dv many0 ,
117.Dv many1 ,
118etc.,
119plus a single hook named
120.Dv one .
121.Sh CONTROL MESSAGES
122This node type supports the generic control messages, plus the
123following:
124.Bl -tag -width foo
125.It Dv NGM_ONE2MANY_SET_CONFIG
126Sets the node configuration using a
127.Dv "struct ng_one2many_link_config"
128as the control message argument:
129.Bd -literal
130/* Node configuration structure */
131struct ng_one2many_config {
132  u_int32_t   xmitAlg;        /* how to distribute packets */
133  u_int32_t   failAlg;        /* how to detect link failure */
134  u_char      enabledLinks[NG_ONE2MANY_MAX_LINKS];
135};
136.Ed
137.Pp
138Currently, the valid settings for the
139.Dv xmitAlg
140field are
141.Dv NG_ONE2MANY_XMIT_ROUNDROBIN
142(default) or
143.Dv NG_ONE2MANY_XMIT_ALL .
144The only valid setting for
145.Dv failAlg
146is
147.Dv NG_ONE2MANY_FAIL_MANUAL ;
148this is also the default setting.
149.It Dv NGM_ONE2MANY_GET_CONFIG
150Returns the current node configuration in a
151.Dv "struct ng_one2many_link_config" .
152.It Dv NGM_ONE2MANY_GET_STATS
153This command takes a 32 bit link number as an argument and
154returns a
155.Dv "struct ng_one2many_link_stats"
156containing statistics for the corresponding
157.Dv many
158link, which may or may not be currently connected:
159.Bd -literal
160/* Statistics structure (one for each link) */
161struct ng_one2many_link_stats {
162  u_int64_t   recvOctets;     /* total octets rec'd on link */
163  u_int64_t   recvPackets;    /* total pkts rec'd on link */
164  u_int64_t   xmitOctets;     /* total octets xmit'd on link */
165  u_int64_t   xmitPackets;    /* total pkts xmit'd on link */
166};
167.Ed
168.Pp
169To access statistics for the
170.Dv one
171link, use the link number
172.Dv -1 .
173.It Dv NGM_ONE2MANY_CLR_STATS
174This command takes a 32 bit link number as an argument and
175clears the statistics for that link.
176.It Dv NGM_ONE2MANY_GETCLR_STATS
177Same as
178.Dv NGM_ONE2MANY_GET_STATS ,
179but also atomically clears the statistics for the link as well.
180.El
181.Sh SHUTDOWN
182This node shuts down upon receipt of a
183.Dv NGM_SHUTDOWN
184control message, or when all hooks have been disconnected.
185.Sh EXAMPLES
186The following commands will set up Ethernet interfaces
187.Dv fxp0
188to deliver packets alternating over the physical interfaces
189corresponding to networking interfaces
190.Dv fxp0
191through
192.Dv fxp3 :
193.Bd -literal
194  # Plumb nodes together
195
196  ngctl mkpeer fxp0: one2many upper one
197  ngctl connect fxp0: fxp0:upper lower many0
198  ngctl connect fxp1: fxp0:upper lower many1
199  ngctl connect fxp2: fxp0:upper lower many2
200  ngctl connect fxp3: fxp0:upper lower many3
201
202  # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
203
204  ngctl msg fxp1: setpromisc 1
205  ngctl msg fxp2: setpromisc 1
206  ngctl msg fxp3: setpromisc 1
207  ngctl msg fxp1: setautosrc 0
208  ngctl msg fxp2: setautosrc 0
209  ngctl msg fxp3: setautosrc 0
210
211  # Configure all four links as up
212
213  ngctl msg fxp0:upper \\
214    setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
215
216  # Bring up interface
217
218  ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
219.Ed
220.Pp
221With a similar setup on a peer machine (using the address
222192.168.1.2), a point-to-point
223Ethernet connection with four times normal bandwidth is
224achieved.
225.Sh BUGS
226More transmit and link failure algorithms should be supported.
227A good candidate is Cisco's Etherchannel.
228.Sh SEE ALSO
229.Xr netgraph 4 ,
230.Xr ng_bridge 4 ,
231.Xr ng_ether 4 ,
232.Xr ng_hub 4 ,
233.Xr ifconfig 8 ,
234.Xr ngctl 8
235.Sh HISTORY
236The
237.Nm
238node type was implemented in
239.Fx 4.2 .
240.Sh AUTHORS
241.An -nosplit
242The
243.Nm one2many
244netgraph node (with round-robin algorithm) was written by
245.An Archie Cobbs
246.Aq archie@FreeBSD.org .
247The all algorithm was added by
248.An Rogier R. Mulhuijzen
249.Aq drwilco@drwilco.net .
250