Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wirel...
[powerpc.git] / net / ipv4 / netfilter / ipt_REJECT.c
index ad0312d..e4a1ddb 100644 (file)
@@ -22,6 +22,7 @@
 #include <net/tcp.h>
 #include <net/route.h>
 #include <net/dst.h>
+#include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ipt_REJECT.h>
 #ifdef CONFIG_BRIDGE_NETFILTER
@@ -76,7 +77,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
 
        /* This packet will not be the same as the other: clear nf fields */
        nf_reset(nskb);
-       nskb->nfmark = 0;
+       nskb->mark = 0;
        skb_init_secmark(nskb);
 
        tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
@@ -114,6 +115,14 @@ static void send_reset(struct sk_buff *oldskb, int hook)
        tcph->window = 0;
        tcph->urg_ptr = 0;
 
+       /* Adjust TCP checksum */
+       tcph->check = 0;
+       tcph->check = tcp_v4_check(sizeof(struct tcphdr),
+                                  nskb->nh.iph->saddr,
+                                  nskb->nh.iph->daddr,
+                                  csum_partial((char *)tcph,
+                                               sizeof(struct tcphdr), 0));
+
        /* Set DF, id = 0 */
        nskb->nh.iph->frag_off = htons(IP_DF);
        nskb->nh.iph->id = 0;
@@ -129,14 +138,8 @@ static void send_reset(struct sk_buff *oldskb, int hook)
        if (ip_route_me_harder(&nskb, addr_type))
                goto free_nskb;
 
-       /* Adjust TCP checksum */
        nskb->ip_summed = CHECKSUM_NONE;
-       tcph->check = 0;
-       tcph->check = tcp_v4_check(tcph, sizeof(struct tcphdr),
-                                  nskb->nh.iph->saddr,
-                                  nskb->nh.iph->daddr,
-                                  csum_partial((char *)tcph,
-                                               sizeof(struct tcphdr), 0));
+
        /* Adjust IP TTL */
        nskb->nh.iph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT);
 
@@ -228,7 +231,7 @@ static int check(const char *tablename,
        } else if (rejinfo->with == IPT_TCP_RESET) {
                /* Must specify that it's a TCP packet */
                if (e->ip.proto != IPPROTO_TCP
-                   || (e->ip.invflags & IPT_INV_PROTO)) {
+                   || (e->ip.invflags & XT_INV_PROTO)) {
                        DEBUGP("REJECT: TCP_RESET invalid for non-tcp\n");
                        return 0;
                }
@@ -236,8 +239,9 @@ static int check(const char *tablename,
        return 1;
 }
 
-static struct ipt_target ipt_reject_reg = {
+static struct xt_target ipt_reject_reg = {
        .name           = "REJECT",
+       .family         = AF_INET,
        .target         = reject,
        .targetsize     = sizeof(struct ipt_reject_info),
        .table          = "filter",
@@ -249,12 +253,12 @@ static struct ipt_target ipt_reject_reg = {
 
 static int __init ipt_reject_init(void)
 {
-       return ipt_register_target(&ipt_reject_reg);
+       return xt_register_target(&ipt_reject_reg);
 }
 
 static void __exit ipt_reject_fini(void)
 {
-       ipt_unregister_target(&ipt_reject_reg);
+       xt_unregister_target(&ipt_reject_reg);
 }
 
 module_init(ipt_reject_init);