diff options
author | ae <ae@FreeBSD.org> | 2011-03-01 13:10:56 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2011-03-01 13:10:56 +0000 |
commit | 8d27150a02987492c63fb82670f25f512e3eedbb (patch) | |
tree | 4198e94746c15f6642c55eec2c852cabe88a012c | |
parent | 318d44b9bce302c0851213f1070bd6b080a363a7 (diff) | |
download | FreeBSD-src-8d27150a02987492c63fb82670f25f512e3eedbb.zip FreeBSD-src-8d27150a02987492c63fb82670f25f512e3eedbb.tar.gz |
Add XMIT_FAILOVER transmit algorithm to ng_one2many node. Packets are
delivered out the first active "many" hook.
PR: kern/137775
Submitted by: Maxim Ignatenko
MFC after: 2 weeks
-rw-r--r-- | share/man/man4/ng_one2many.4 | 6 | ||||
-rw-r--r-- | sys/netgraph/ng_one2many.c | 5 | ||||
-rw-r--r-- | sys/netgraph/ng_one2many.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/share/man/man4/ng_one2many.4 b/share/man/man4/ng_one2many.4 index e43fd8a..434ea73 100644 --- a/share/man/man4/ng_one2many.4 +++ b/share/man/man4/ng_one2many.4 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2006 +.Dd March 1, 2011 .Dt NG_ONE2MANY 4 .Os .Sh NAME @@ -96,6 +96,10 @@ hooks. 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. diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c index 6b88730..714528d 100644 --- a/sys/netgraph/ng_one2many.c +++ b/sys/netgraph/ng_one2many.c @@ -278,6 +278,7 @@ ng_one2many_rcvmsg(node_p node, item_p item, hook_p lasthook) 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_one2many_rcvdata(hook_p hook, item_p item) 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 @@ ng_one2many_update_many(priv_p priv) priv->nextMany %= priv->numActiveMany; break; case NG_ONE2MANY_XMIT_ALL: + case NG_ONE2MANY_XMIT_FAILOVER: break; #ifdef INVARIANTS default: diff --git a/sys/netgraph/ng_one2many.h b/sys/netgraph/ng_one2many.h index 343f7ee..753221d 100644 --- a/sys/netgraph/ng_one2many.h +++ b/sys/netgraph/ng_one2many.h @@ -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 */ |