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