Project

General

Profile

Bug #337 » filter.inc.diff

Scott Ullrich, 07/14/2010 10:51 PM

View differences:

etc/inc/filter.inc
575 575
			if (count($members) > 0) {
576 576
				$foundlb = 0;
577 577
				$routeto = "";
578
                        	foreach($members as $idx => $member) {
579
                                	$int = $member['int'];
580
                                	$gatewayip = $member['gwip'];
581
                                	if (($int <> "") && is_ipaddr($gatewayip)) {
582
                                        	if ($g['debug'])
583
                                                	log_error("Setting up route with {$gatewayip} om $int");
578
				foreach($members as $idx => $member) {
579
					$int = $member['int'];
580
					$gatewayip = $member['gwip'];
581
					if (($int <> "") && is_ipaddr($gatewayip)) {
582
						if ($g['debug'])
583
							log_error("Setting up route with {$gatewayip} om $int");
584 584
						if ($member['weight'] > 1) {
585 585
							$routeto .= str_repeat("( {$int} {$gatewayip} ) ", $member['weight']);
586 586
						} else
587
                                        		$routeto .= "( {$int} {$gatewayip} ) ";
587
							$routeto .= "( {$int} {$gatewayip} ) ";
588 588
						$foundlb = 1;
589
                                	} else
590
                                        	log_error("An error occurred while trying to find the interface got $gatewayip .  The rule has not been added.");
591
                        	}
592
				$route = "";
593
				if ($foundlb > 0) {
594
                                	$route = " route-to { {$routeto} } ";
595
					if ($idx > 1) {
596
                                		$route .= " round-robin ";
597
                                		if (isset($config['system']['lb_use_sticky']))
598
                                        		$route .= " sticky-address ";
589
						} else
590
							log_error("An error occurred while trying to find the interface got $gatewayip .  The rule has not been added.");
599 591
					}
600
                        	}
592
					$route = "";
593
					if ($foundlb > 0) {
594
						$route = " route-to { {$routeto} } ";
595
					$route .= " round-robin ";
596
					if (isset($config['system']['lb_use_sticky']))
597
						$route .= " sticky-address ";
598
				}
601 599
			}
602 600
			$rules .= "GW{$gateway} = \" {$route} \"\n";
603 601
		}
(6-6/6)