Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2009 17:15:30 GMT
From:      Maxim Ignatenko <gelraen.ua@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/137775: [patch] Add XMIT_FAILOVER to ng_one2many
Message-ID:  <200908141715.n7EHFUWS093141@www.freebsd.org>
Resent-Message-ID: <200908141720.n7EHK8Aa015775@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         137775
>Category:       kern
>Synopsis:       [patch] Add XMIT_FAILOVER to ng_one2many
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 14 17:20:08 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Maxim Ignatenko
>Release:        8-CURRENT
>Organization:
Kiev National Taras Shevchenko University
>Environment:
FreeBSD imax 8.0-CURRENT FreeBSD 8.0-CURRENT #82 r195339M: Sat Jul  4 17:53:30 EEST 2009     root@imax:/usr/obj/usr/src/sys/HEAD  i386
>Description:
Sending packets to first active "many" hook is more adequate for simulating lagg(4) with "laggproto failover".
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: sys/netgraph/ng_one2many.c
===================================================================
--- sys/netgraph/ng_one2many.c	(revision 195339)
+++ sys/netgraph/ng_one2many.c	(working copy)
@@ -278,6 +278,7 @@
 			switch (conf->xmitAlg) {
 			case NG_ONE2MANY_XMIT_ROUNDROBIN:
 			case NG_ONE2MANY_XMIT_ALL:
+			case NG_ONE2MANY_XMIT_FAILOVER:
 				break;
 			default:
 				error = EINVAL;
@@ -473,6 +474,9 @@
 				NG_SEND_DATA_ONLY(error, mdst->hook, m2);
 			}
 			break;
+		case NG_ONE2MANY_XMIT_FAILOVER:
+			dst = &priv->many[priv->activeMany[0]];
+			break;
 #ifdef INVARIANTS
 		default:
 			panic("%s: invalid xmitAlg", __func__);
@@ -583,6 +587,7 @@
 			priv->nextMany %= priv->numActiveMany;
 		break;
 	case NG_ONE2MANY_XMIT_ALL:
+	case NG_ONE2MANY_XMIT_FAILOVER:
 		break;
 #ifdef INVARIANTS
 	default:
Index: sys/netgraph/ng_one2many.h
===================================================================
--- sys/netgraph/ng_one2many.h	(revision 195339)
+++ sys/netgraph/ng_one2many.h	(working copy)
@@ -61,6 +61,7 @@
 /* Algorithms for outgoing packet distribution (XXX only one so far) */
 #define NG_ONE2MANY_XMIT_ROUNDROBIN	1	/* round-robin delivery */
 #define NG_ONE2MANY_XMIT_ALL		2	/* send packets to all many hooks */
+#define NG_ONE2MANY_XMIT_FAILOVER	3	/* send packets to first active "many" */
 
 /* Algorithms for detecting link failure (XXX only one so far) */
 #define NG_ONE2MANY_FAIL_MANUAL		1	/* use enabledLinks[] array */
Index: share/man/man4/ng_one2many.4
===================================================================
--- share/man/man4/ng_one2many.4	(revision 195339)
+++ share/man/man4/ng_one2many.4	(working copy)
@@ -96,6 +96,10 @@
 Each packet goes out each
 .Dv many
 hook.
+.It Dv NG_ONE2MANY_XMIT_FAILOVER
+Packets are delivered out the first active
+.Dv many
+hook.
 .El
 .Pp
 In the future other algorithms may be added as well.


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908141715.n7EHFUWS093141>