Client and Director in the same machine with IPVS-NAT

Carlos Lozano clozano at andago.com
Fri Jul 2 12:24:09 BST 2004


Hello,

We have a machine here what must be client and director,
and it wasn't working (2 problems, ipvs doesn't handle loopback
packets, and the return packets are handled by ip_vs_in, and
not by ip_vs_out). In this page:

http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.realserver_director_as_client.html

there is some notes for client+director but using IPVS-DR.
I have written a patch for support client+director using
IPVS-NAT. It is only a poor hack, but it works correctly
in my testcase, so i decided to send to the list for what
people with the same problem can "play" with the patch.

It is for the kernel 2.4.26.

Regards,
Carlos.

-- 
 ___         _          \  |  /  Consulting
| . |._ _  _| | ___  ___  ___    http://www.andago.com
|   || ' |/ . |<_> |/ . |/ . \__ GNU/Linux
|_|_||_|_|\___|<___|\_. |\___/     _ \  __|\ \  /
 Carlos A. Lozano   <___'/ | \ -_) __/\__ \ >  <  -_)
 [ carlos.lozano at andago.com ]\___|_|  ____/ _/\_\___|
 [ calb at epsxe.com           ]  http://www.ePSXe.com
-------------- next part --------------
--- ip_vs_core.c.orig	2003-11-28 19:26:21.000000000 +0100
+++ ip_vs_core.c.list	2004-07-02 11:13:51.000000000 +0200
@@ -1036,7 +1036,7 @@
 	 *	Big tappo: only PACKET_HOST (nor loopback neither mcasts)
 	 *	... don't know why 1st test DOES NOT include 2nd (?)
 	 */
-	if (skb->pkt_type != PACKET_HOST || skb->dev == &loopback_dev) {
+	if (skb->pkt_type != PACKET_HOST) { /* || skb->dev == &loopback_dev) { */
 		IP_VS_DBG(12, "packet type=%d proto=%d daddr=%d.%d.%d.%d ignored\n",
 			  skb->pkt_type,
 			  iph->protocol,
@@ -1059,6 +1059,13 @@
 	iph = skb->nh.iph;
 	h.raw = (char*) iph + ihl;
 
+        cp = ip_vs_conn_out_get(iph->protocol, iph->saddr, h.portp[0],
+                               iph->daddr, h.portp[1]);
+        if (cp) {
+           __ip_vs_conn_put(cp);
+           return (ip_vs_out(hooknum,skb_p,in,out,okfn));
+        }
+
 	/*
 	 * Check if the packet belongs to an existing connection entry
 	 */


More information about the lvs-users mailing list