LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[lvs-devel] crashing kernel with lvs as transparent squid proxy

Subject: [lvs-devel] crashing kernel with lvs as transparent squid proxy
From: peter at endian.com (Peter Warasin)
Date: Thu, 13 Sep 2007 12:07:39 +0200
Hmm, something seems to remove my attachments. Here is the patch:


--- linux-2.6.9/include/net/ip.h.orig   2007-08-01 20:22:35.000000000 +0200
+++ linux-2.6.9/include/net/ip.h        2007-08-01 20:22:50.000000000 +0200
@@ -87,6 +87,7 @@
                                              struct ip_options *opt);
 extern int             ip_rcv(struct sk_buff *skb, struct net_device *dev,
                               struct packet_type *pt);
+extern int             ip_rercv(struct sk_buff *skb);
 extern int             ip_local_deliver(struct sk_buff *skb);
 extern int             ip_mr_input(struct sk_buff *skb);
 extern int             ip_output(struct sk_buff **pskb);
--- linux-2.6.9/include/net/ip_vs.h.orig        2007-08-01 22:12:52.000000000 
+0200
+++ linux-2.6.9/include/net/ip_vs.h     2007-08-01 22:13:10.000000000 +0200
@@ -925,6 +925,8 @@
  */
 extern int ip_vs_null_xmit
 (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_loop_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
 extern int ip_vs_bypass_xmit
 (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
 extern int ip_vs_nat_xmit
--- linux-2.6.9/net/ipv4/ipvs/ip_vs_conn.c.orig 2007-08-01
21:52:32.000000000 +0200
+++ linux-2.6.9/net/ipv4/ipvs/ip_vs_conn.c      2007-08-01 21:52:51.000000000
+0200
@@ -322,7 +322,7 @@
                break;

        case IP_VS_CONN_F_LOCALNODE:
-               cp->packet_xmit = ip_vs_null_xmit;
+               cp->packet_xmit = ip_vs_loop_xmit;
                break;

        case IP_VS_CONN_F_BYPASS:
--- linux-2.6.9/net/ipv4/ipvs/ip_vs_xmit.c.orig 2007-08-01
19:28:52.000000000 +0200
+++ linux-2.6.9/net/ipv4/ipvs/ip_vs_xmit.c      2007-08-03 16:47:16.000000000
+0200
@@ -24,6 +24,8 @@
 #include <net/route.h>                  /* for ip_route_output */
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
+#include <linux/netfilter_ipv4/ip_nat.h>
+#include <linux/netfilter_ipv4/ip_conntrack.h>

 #include <net/ip_vs.h>

@@ -141,12 +143,47 @@
 ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
                struct ip_vs_protocol *pp)
 {
+       IP_VS_DBG(10, "NULL transmitter called\n");
        /* we do not touch skb and do not need pskb ptr */
        return NF_ACCEPT;
 }


 /*
+ *      LOOP transmitter (reinject on NF_IP_PRE_ROUTING)
+ */
+int
+ip_vs_loop_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
+               struct ip_vs_protocol *pp)
+{
+
+       struct ip_conntrack *ct;
+       enum ip_conntrack_info ctinfo;
+       struct ip_nat_info *info;
+
+       IP_VS_DBG(5, "LOOP transmitter called\n");
+       if (skb->nfcache & NFC_IPVS_PROPERTY) {
+               IP_VS_DBG(10, "Already passed LVS. Receive it normally\n");
+               return NF_ACCEPT;
+       }
+
+       IP_VS_DBG(10, "Retransmit to IP_PRE_ROUTING hook starting with
priority NF_IP_PRI_MANGLE\n");
+       nf_reset_debug(skb);
+       skb->nfcache |= NFC_IPVS_PROPERTY;
+       skb->ip_summed = CHECKSUM_NONE;
+
+       ct = ip_conntrack_get(skb, &ctinfo);
+       if (ct && (ctinfo == IP_CT_NEW)) {
+               info = &ct->nat.info;
+               info->initialized = 0;
+       }
+       NF_HOOK_THRESH(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev,
+                      NULL, ip_rercv, NF_IP_PRI_MANGLE);
+       return NF_STOLEN;
+}
+
+
+/*
  *      Bypass transmitter
  *      Let packets bypass the destination when the destination is not
  *      available, it may be only used in transparent cache cluster.
--- linux-2.6.9/net/ipv4/ip_input.c.orig        2007-08-01 19:29:54.000000000 
+0200
+++ linux-2.6.9/net/ipv4/ip_input.c     2007-08-01 19:32:42.000000000 +0200
@@ -355,6 +355,14 @@
 }

 /*
+ *     Retransmit packet
+ */
+int ip_rercv(struct sk_buff *skb)
+{
+       return ip_rcv_finish(skb);
+}
+
+/*
  *     Main IP Receive routine.
  */
 int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct
packet_type *pt)
@@ -429,4 +437,5 @@
 }

 EXPORT_SYMBOL(ip_rcv);
+EXPORT_SYMBOL(ip_rercv);
 EXPORT_SYMBOL(ip_statistics);


-- 
:: e n d i a n
:: open source - open minds

:: peter warasin
:: http://www.endian.com   :: peter at endian.com

<Prev in Thread] Current Thread [Next in Thread>