Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc...
[powerpc.git] / net / ipv4 / netfilter / ipt_MASQUERADE.c
index 28b9233..b5955f3 100644 (file)
@@ -25,7 +25,7 @@
 #else
 #include <linux/netfilter_ipv4/ip_nat_rule.h>
 #endif
-#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/netfilter/x_tables.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
@@ -86,7 +86,7 @@ masquerade_target(struct sk_buff **pskb,
        nat = nfct_nat(ct);
 #endif
        IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
-                           || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
+                           || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
 
        /* Source address is 0.0.0.0 - locally generated packet that is
         * probably not supposed to be masqueraded.
@@ -127,10 +127,13 @@ masquerade_target(struct sk_buff **pskb,
 static inline int
 device_cmp(struct ip_conntrack *i, void *ifindex)
 {
+       int ret;
 #ifdef CONFIG_NF_NAT_NEEDED
        struct nf_conn_nat *nat = nfct_nat(i);
+
+       if (!nat)
+               return 0;
 #endif
-       int ret;
 
        read_lock_bh(&masq_lock);
 #ifdef CONFIG_NF_NAT_NEEDED
@@ -187,8 +190,9 @@ static struct notifier_block masq_inet_notifier = {
        .notifier_call  = masq_inet_event,
 };
 
-static struct ipt_target masquerade = {
+static struct xt_target masquerade = {
        .name           = "MASQUERADE",
+       .family         = AF_INET,
        .target         = masquerade_target,
        .targetsize     = sizeof(struct ip_nat_multi_range_compat),
        .table          = "nat",
@@ -201,7 +205,7 @@ static int __init ipt_masquerade_init(void)
 {
        int ret;
 
-       ret = ipt_register_target(&masquerade);
+       ret = xt_register_target(&masquerade);
 
        if (ret == 0) {
                /* Register for device down reports */
@@ -215,9 +219,9 @@ static int __init ipt_masquerade_init(void)
 
 static void __exit ipt_masquerade_fini(void)
 {
-       ipt_unregister_target(&masquerade);
+       xt_unregister_target(&masquerade);
        unregister_netdevice_notifier(&masq_dev_notifier);
-       unregister_inetaddr_notifier(&masq_inet_notifier);      
+       unregister_inetaddr_notifier(&masq_inet_notifier);
 }
 
 module_init(ipt_masquerade_init);