-/* $OpenBSD: parse.y,v 1.198 2014/12/21 00:54:49 guenther Exp $ */
+/* $OpenBSD: parse.y,v 1.199 2014/12/23 13:18:23 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
rdroptsl : forwardmode TO tablespec interface {
if (hashkey != NULL) {
+ memcpy(&rdr->conf.key,
+ hashkey, sizeof(rdr->conf.key));
+ rdr->conf.flags |= F_HASHKEY;
free(hashkey);
hashkey = NULL;
}
switch ($2) {
case RELAY_DSTMODE_LOADBALANCE:
case RELAY_DSTMODE_HASH:
- case RELAY_DSTMODE_RANDOM:
- case RELAY_DSTMODE_SRCHASH:
if (rdr != NULL) {
yyerror("mode not supported "
"for redirections");
YYERROR;
}
/* FALLTHROUGH */
+ case RELAY_DSTMODE_RANDOM:
case RELAY_DSTMODE_ROUNDROBIN:
+ case RELAY_DSTMODE_SRCHASH:
dstmode = $2;
break;
case RELAY_DSTMODE_LEASTSTATES:
-/* $OpenBSD: pfe_filter.c,v 1.53 2013/04/27 16:39:30 benno Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.54 2014/12/23 13:18:23 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
}
switch (rdr->conf.mode) {
+ case RELAY_DSTMODE_RANDOM:
+ rio.rule.rdr.opts = PF_POOL_RANDOM;
+ break;
case RELAY_DSTMODE_ROUNDROBIN:
rio.rule.rdr.opts = PF_POOL_ROUNDROBIN;
break;
+ case RELAY_DSTMODE_SRCHASH:
+ rio.rule.rdr.opts = PF_POOL_SRCHASH;
+ break;
case RELAY_DSTMODE_LEASTSTATES:
rio.rule.rdr.opts = PF_POOL_LEASTSTATES;
break;
}
if (rdr->conf.flags & F_STICKY)
rio.rule.rdr.opts |= PF_POOL_STICKYADDR;
+ if (rdr->conf.flags & F_HASHKEY)
+ memcpy(rio.rule.rdr.key.key32, rdr->conf.key.data,
+ sizeof(rio.rule.rdr.key.key32));
if (rio.rule.rt == PF_ROUTETO) {
memcpy(&rio.rule.route, &rio.rule.rdr,
-.\" $OpenBSD: relayd.conf.5,v 1.155 2014/12/18 21:26:09 jmc Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.156 2014/12/23 13:18:23 reyk Exp $
.\"
.\" Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 18 2014 $
+.Dd $Mdocdate: December 23 2014 $
.Dt RELAYD.CONF 5
.Os
.Sh NAME
This mode is only supported by relays.
.It Ic mode random
Distributes the outgoing connections randomly through all active hosts.
-This mode is only supported by relays.
+This mode is supported by redirections and relays.
.It Ic mode roundrobin
Distributes the outgoing connections using a round-robin scheduler
through all active hosts.
Balances the outgoing connections across the active hosts based on the
.Ar key
and the source IP address of the client.
-This mode is only supported by relays.
+This mode is supported by redirections and relays.
.El
.Pp
The optional