Hi

Attached is a patch for ldirectord when using one-packet scheduling when using udp ipvsadm balancing. In ldirectord.cf, in the virtual service definition put ops = yes ( protocol = udp is mandatory )

regards

--
Dan Cândea
Does God Play Dice?

--- /usr/sbin/ldirectord	2013-01-06 22:50:55.000000000 +0000
+++ ldirectord	2013-07-01 14:11:55.000000000 +0000
@@ -1353,6 +1353,7 @@
 			$vsrv{num_connects} = 0;
 			$vsrv{httpmethod} = "GET";
 			$vsrv{secret} = "";
+			$vsrv{ops} = "no";
 			push(@VIRTUAL, \%vsrv);
 			while(<CFGFILE>) {
 				$line++;
@@ -1479,6 +1480,7 @@
 						} else {    # tcp or udp
 							if ($1 eq "tcp" || $1 eq "udp") {
 								$vsrv{protocol} = $1;
+					
 							} else {
 								&config_error($line, "protocol must be tcp or udp if the virtual service is an address and port");
 							}
@@ -1486,6 +1488,9 @@
 					} else {
 						&config_error($line, "invalid protocol");
 					}
+				} elsif ($rcmd  =~ /^ops\s*=\s*(.*)/) {
+					 ($1 eq "yes" || $1 eq "no") or &config_error($line, "ops must be 'yes' or 'no'");
+				         $vsrv{ops} = $1;
 				} elsif ($rcmd =~ /^service\s*=\s*(.*)/) {
 					$1 =~ /(\w+)/ && ($1 eq "dns"	||
 							  $1 eq "ftp"	||
@@ -2219,10 +2224,13 @@
 			$$v{proto} = "-t";
 		} elsif ($$v{protocol} eq "udp") {
 			$$v{proto} = "-u";
-		} elsif ($$v{protocol} eq "fwm") {
+				} elsif ($$v{protocol} eq "fwm") {
 			$$v{proto} = "-f";
 		}
-		$$v{flags} = "$$v{proto} " .  &get_virtual_option($v) . " ";
+		$$v{flags} .= "$$v{proto} " .  &get_virtual_option($v) . " ";
+		if ($$v{protocol} eq "udp" && $$v{ops} eq "yes") {
+				$$v{flags} .= "-o ";
+		}
 		$$v{flags} .= "-s $$v{scheduler} " if defined ($$v{scheduler});
 		if (defined $$v{persistent}) {
 			$$v{flags} .= "-p $$v{persistent} ";

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-requ...@linuxvirtualserver.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

Reply via email to