From 9534ea8b210f0e4f525f342d8356743208a38cb2 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 9 May 2007 16:50:37 +0000 Subject: Port load balancer sticky address option --- etc/inc/services.inc | 8 ++++++++ etc/rc.bootup | 1 + usr/local/www/system_advanced.php | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index f6fd5f6..970f715 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -32,6 +32,14 @@ /* include all configuration functions */ require_once("functions.inc"); +function load_balancer_use_sticky() { + global $config, $g; + if (isset ($config['system']['lb_use_sticky'])) + touch("/var/etc/use_pf_pool__stickyaddr"); + else + unlink_if_exists("/var/etc/use_pf_pool__stickyaddr"); +} + function services_dhcpd_configure() { global $config, $g; if(isset($config['system']['developerspew'])) { diff --git a/etc/rc.bootup b/etc/rc.bootup index b9e3263..5384461 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -180,6 +180,7 @@ setup_filter_bridge(); /* start load balancer daemon */ + load_balancer_use_sticky(); slbd_configure(); /* start OpenVPN server & clients */ diff --git a/usr/local/www/system_advanced.php b/usr/local/www/system_advanced.php index 39960d7..7328782 100755 --- a/usr/local/www/system_advanced.php +++ b/usr/local/www/system_advanced.php @@ -59,6 +59,7 @@ $pconfig['disablenatreflection'] = $config['system']['disablenatreflection']; $pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']); $pconfig['disablescrub'] = isset($config['system']['disablescrub']); $pconfig['shapertype'] = $config['system']['shapertype']; +$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']); if ($_POST) { @@ -130,6 +131,11 @@ if ($_POST) { setup_polling(); } + if($_POST['lb_use_sticky'] == "yes") + $config['system']['lb_use_sticky'] = true; + else + unset($config['system']['lb_use_sticky']); + if($_POST['sharednet'] == "yes") { $config['system']['sharednet'] = true; system_disable_arp_wrong_if(); @@ -402,10 +408,40 @@ include("head.inc");   + + + Load Balancing + + + Load Balancing + + /> + Use sticky connections +
+ + Successive connections will be redirected to the servers in a round-robin manner with connections from the same source being sent to the same web server. This \"sticky connection\" will exist as long as there are states that refer to this connection. Once the states expire, so will the sticky connection. Further connections from that host will be redirected to the next web server in the round robin. + + + + +   + + + + + +   + + Miscellaneous + +   + + + Device polling -- cgit v1.1