[PATCH] Fixes in Virtual Server for 2.2.12pre

Mike Jagdis (uli@linux.tu-varna.acad.bg)
Tue, 17 Aug 1999 14:15:47 +0300 (EEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---1530068696-625650479-934888547=:23065
Content-Type: TEXT/PLAIN; charset=US-ASCII

Above is the patch against 2.2.12pre4/pre7 which fixes some
incompatibilities with masq tables changed in 2.2.11. Now VS works.

--- linux/include/net/ip_masq.h.orig Tue Aug 17 13:08:13 1999
+++ linux/include/net/ip_masq.h Tue Aug 17 13:08:55 1999
@@ -74,6 +74,7 @@

#ifdef __KERNEL__

+#define IP_MASQ_NTABLES 3
#define IP_MASQ_TAB_SIZE 16384

/*
--- linux/net/ipv4/ip_masq.c.orig Tue Aug 17 13:06:33 1999
+++ linux/net/ipv4/ip_masq.c Tue Aug 17 13:07:55 1999
@@ -599,8 +599,6 @@
* 1 for extra modules support (daddr)
*/

-#define IP_MASQ_NTABLES 3
-
struct list_head ip_masq_m_table[IP_MASQ_TAB_SIZE];
struct list_head ip_masq_s_table[IP_MASQ_TAB_SIZE];
struct list_head ip_masq_d_table[IP_MASQ_TAB_SIZE];
--- linux/net/ipv4/ip_vs.c.orig Sat Aug 14 15:03:58 1999
+++ linux/net/ipv4/ip_vs.c Tue Aug 17 13:45:47 1999
@@ -42,6 +42,7 @@
#include <net/ip.h>
#include <net/route.h>

+#include <net/ip_masq.h>
#include <net/ip_vs.h>

#ifdef CONFIG_KMOD
@@ -229,12 +230,12 @@
hash = ip_vs_hash_key(ms->protocol, ms->daddr, ms->dport);

/*
- * Note: because ip_masq_put sets masq expire if its refcnt==2,
- * we have to increase counter two times, otherwise the
- * masq won't expire.
+ * Note: because ip_masq_put sets masq expire if its
+ * refcnt==IP_MASQ_NTABLES, we have to increase
+ * counter IP_MASQ_NTABLES times, otherwise the masq
+ * won't expire.
*/
- atomic_inc(&ms->refcnt);
- atomic_inc(&ms->refcnt);
+ atomic_add(IP_MASQ_NTABLES, &ms->refcnt);
list_add(&ms->m_list, &ip_vs_table[hash]);

ms->flags |= IP_MASQ_F_HASHED;
@@ -250,7 +251,6 @@
int ip_vs_unhash(struct ip_masq *ms)
{
unsigned int hash;
- struct ip_masq ** ms_p;

if (!(ms->flags & IP_MASQ_F_HASHED)) {
IP_VS_ERR("ip_vs_unhash(): request for unhash flagged, called from %p\n",
@@ -262,11 +262,10 @@
*/
hash = ip_vs_hash_key(ms->protocol, ms->daddr, ms->dport);
/*
- * Note: since we increase refcnt twice while hashing,
- * we have to decrease it twice while unhashing.
+ * Note: since we increase refcnt while hashing,
+ * we have to decrease it while unhashing.
*/
- atomic_dec(&ms->refcnt);
- atomic_dec(&ms->refcnt);
+ atomic_sub(IP_MASQ_NTABLES, &ms->refcnt);
list_del(&ms->m_list);
ms->flags &= ~IP_MASQ_F_HASHED;
return 1;
@@ -284,7 +283,7 @@
struct ip_masq * ip_vs_in_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
{
unsigned hash;
- struct ip_masq *ms = NULL;
+ struct ip_masq *ms;
struct list_head *l, *e;

hash = ip_vs_hash_key(protocol, s_addr, s_port);
@@ -301,6 +300,7 @@
goto out;
}
}
+ ms = NULL;

out:
return ms;
@@ -317,7 +317,7 @@
struct ip_masq * ip_vs_out_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
{
unsigned hash;
- struct ip_masq *ms = NULL;
+ struct ip_masq *ms;
struct list_head *l, *e;

/*
@@ -338,6 +338,7 @@
}

}
+ ms = NULL;

out:
return ms;

Attached: gzipped variant

Julian Anastasov

---1530068696-625650479-934888547=:23065
Content-Type: APPLICATION/octet-stream; name="vs.diff.gz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.10.9908171415470.23065@linux.himel.bg>
Content-Description: Patch agains 2.2.12pre7
Content-Disposition: attachment; filename="vs.diff.gz"

H4sICFE/uTcAA3ZzLmRp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BUEqY5cillNHTQ5Rp2yaEcdltw+SB1Ncsal/iFnDudwgLkp/Fumx04x
pjyJQ7BSxgy7kjFDO/0OFUGeosMLyZrymmDFHhuEJHYHGFHwwJ3Vx51ASCZz
czJXyo4Q7gGyBQyROv/1+nqyn1pZ56DO0p+ABmbcoDm6VhNgX2BWmiqqrlpm
t8XtYtjtdtqyY2uNbgC/2WJ82re93jcc/UE5Mh9UG5dmJOqREa2BGJJ6nRgS
Ovk/TUlrNTRVvz2UHceXql+28zsb+h82J3PkPwwAAA==
---1530068696-625650479-934888547=:23065--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/