summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/pfe_filter.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2012-10-19 16:49:51 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2012-10-19 16:49:51 +0000
commit744997318c1e8642211ac59064869fcc742d7427 (patch)
treee3a8caa4309836c0b9cd761036e374007e9a90e0 /usr.sbin/relayd/pfe_filter.c
parent14846c424b752562086c94b0f700a45e6bb34454 (diff)
Support additional scheduling algorithms in the load balancer:
least-states, random, source-hash. least-states is currently only supported for redirections and the other ones are currently only supported by relays. ok benno@
Diffstat (limited to 'usr.sbin/relayd/pfe_filter.c')
-rw-r--r--usr.sbin/relayd/pfe_filter.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c
index a92871c1dea..1bdc302f22d 100644
--- a/usr.sbin/relayd/pfe_filter.c
+++ b/usr.sbin/relayd/pfe_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe_filter.c,v 1.51 2012/10/04 20:53:30 reyk Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.52 2012/10/19 16:49:50 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -483,7 +483,18 @@ sync_ruleset(struct relayd *env, struct rdr *rdr, int enable)
ntohs(rdr->table->conf.port);
rio.rule.rdr.port_op = PF_OP_EQ;
}
- rio.rule.rdr.opts = PF_POOL_ROUNDROBIN;
+
+ switch (rdr->conf.mode) {
+ case RELAY_DSTMODE_ROUNDROBIN:
+ rio.rule.rdr.opts = PF_POOL_ROUNDROBIN;
+ break;
+ case RELAY_DSTMODE_LEASTSTATES:
+ rio.rule.rdr.opts = PF_POOL_LEASTSTATES;
+ break;
+ default:
+ fatalx("sync_ruleset: unsupported mode");
+ /* NOTREACHED */
+ }
if (rdr->conf.flags & F_STICKY)
rio.rule.rdr.opts |= PF_POOL_STICKYADDR;