]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
Update compat code for new 2.6.25 code
authorJan Engelhardt <jengelh@computergmbh.de>
Thu, 21 Feb 2008 12:29:31 +0000 (13:29 +0100)
committerJan Engelhardt <jengelh@computergmbh.de>
Thu, 21 Feb 2008 12:29:31 +0000 (13:29 +0100)
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
extensions/compat_xtables.c
extensions/compat_xtables.h
extensions/compat_xtnu.h
extensions/xt_TEE.c

index fe948575ddc8266481b7342e1207b00ed2701b8f..b1d8808481eef642346c5316befd5e5f40ca7e4a 100644 (file)
@@ -5,6 +5,8 @@
 #include <linux/version.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter/x_tables.h>
+#include <net/ip.h>
+#include <net/route.h>
 #include "compat_xtnu.h"
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) && \
@@ -238,4 +240,58 @@ int xtnu_ip_route_me_harder(struct sk_buff *skb, unsigned int addr_type)
 EXPORT_SYMBOL_GPL(xtnu_ip_route_me_harder);
 #endif
 
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 24)
+static int __xtnu_ip_local_out(struct sk_buff *skb)
+{
+       struct iphdr *iph = ip_hdr(skb);
+
+       iph->tot_len = htons(skb->len);
+       ip_send_check(iph);
+       return nf_hook(PF_INET, NF_IP_LOCAL_OUT, skb, NULL,
+                      skb->dst->dev, dst_output);
+}
+
+int xtnu_ip_local_out(struct sk_buff *skb)
+{
+       int err;
+
+       err = __xtnu_ip_local_out(skb);
+       if (likely(err == 1))
+               err = dst_output(skb);
+
+       return err;
+}
+EXPORT_SYMBOL_GPL(xtnu_ip_local_out);
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
+static int __xtnu_ip_local_out(struct sk_buff **pskb)
+{
+       struct iphdr *iph = ip_hdr(*pskb);
+
+       iph->tot_len = htons((*pskb)->len);
+       ip_send_check(iph);
+       return nf_hook(PF_INET, NF_IP_LOCAL_OUT, pskb, NULL,
+                      (*pskb)->dst->dev, dst_output);
+}
+
+int xtnu_ip_local_out(struct sk_buff *skb)
+{
+       int err;
+
+       err = __xtnu_ip_local_out(&skb);
+       if (likely(err == 1))
+               err = dst_output(skb);
+
+       return err;
+}
+EXPORT_SYMBOL_GPL(xtnu_ip_local_out);
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
+int xtnu_ip_route_output_key(void *net, struct rtable **rp, struct flowi *flp)
+{
+       return ip_route_output_flow(rp, flp, NULL, 0);
+}
+EXPORT_SYMBOL_GPL(xtnu_ip_route_output_key);
+#endif
+
 MODULE_LICENSE("GPL");
index c63bfc2b9448cc70b4a3d5d7a067d159e9a2b9bb..ab9ca0152849cbe3f59894e2966598b13a95cc4b 100644 (file)
@@ -9,9 +9,8 @@
 #      define NF_INET_FORWARD      NF_IP_FORWARD
 #      define NF_INET_LOCAL_OUT    NF_IP_LOCAL_OUT
 #      define NF_INET_POST_ROUTING NF_IP_POST_ROUTING
-#endif
-
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
+#      define init_net             xtnu_ip_route_output_key /* yes */
+#      define ip_route_output_key  xtnu_ip_route_output_key
 #      include "compat_nfinetaddr.h"
 #endif
 
index 64aeaa82a38b3062910ddb072995adfaac68ebe7..62d5c651369e334a138c23516d8345bd028fbbd9 100644 (file)
@@ -5,8 +5,10 @@
 #include <linux/netfilter/x_tables.h>
 #include <linux/spinlock.h>
 
+struct flowi;
 struct module;
 struct net_device;
+struct rtable;
 struct sk_buff;
 
 struct xtnu_match {
@@ -61,6 +63,7 @@ static inline struct xtnu_target *xtcompat_nutarget(const struct xt_target *t)
 
 extern int xtnu_ip_route_me_harder(struct sk_buff *, unsigned int);
 extern int xtnu_register_match(struct xtnu_match *);
+extern int xtnu_ip_route_output_key(void *, struct rtable **, struct flowi *);
 extern void xtnu_unregister_match(struct xtnu_match *);
 extern int xtnu_register_matches(struct xtnu_match *, unsigned int);
 extern void xtnu_unregister_matches(struct xtnu_match *, unsigned int);
index 93980f2467af74fa22acb94d493405dd47664015..c006913e56f1157708a7084a1d66c86c1e2f2140 100644 (file)
@@ -62,7 +62,7 @@ static bool tee_routing(struct sk_buff *skb,
        };
 
        /* Trying to route the packet using the standard routing table. */
-       err = ip_route_output_key(&rt, &fl);
+       err = ip_route_output_key(&init_net, &rt, &fl);
        if (err != 0) {
                if (net_ratelimit())
                        pr_debug(KBUILD_MODNAME