[NETFILTER]: Convert old checksum helper names
authorPatrick McHardy <kaber@trash.net>
Thu, 29 Nov 2007 14:17:11 +0000 (01:17 +1100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:55:15 +0000 (14:55 -0800)
Kill the defines again, convert to the new checksum helper names and
remove the dependency of NET_ACT_NAT on NETFILTER.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
include/linux/netfilter.h
net/ipv4/netfilter/ipt_ECN.c
net/ipv4/netfilter/ipt_TOS.c
net/ipv4/netfilter/ipt_TTL.c
net/ipv4/netfilter/nf_nat_core.c
net/ipv4/netfilter/nf_nat_helper.c
net/ipv4/netfilter/nf_nat_proto_icmp.c
net/ipv4/netfilter/nf_nat_proto_tcp.c
net/ipv4/netfilter/nf_nat_proto_udp.c
net/netfilter/xt_TCPMSS.c
net/sched/Kconfig
net/sched/act_nat.c

index e2bf6d2ffb6c5dfe70cb725ccb1fb26c77bf427a..f42e4362d50da94908eacbad52a46ad76bbf532d 100644 (file)
@@ -298,11 +298,6 @@ extern void nf_invalidate_cache(int pf);
    Returns true or false. */
 extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
 
-#define nf_csum_replace4       csum_replace4
-#define nf_csum_replace2       csum_replace2
-#define nf_proto_csum_replace4 inet_proto_csum_replace4
-#define nf_proto_csum_replace2 inet_proto_csum_replace2
-
 struct nf_afinfo {
        unsigned short  family;
        __sum16         (*checksum)(struct sk_buff *skb, unsigned int hook,
index add110060a22f8d1ef4179a3f15fcfbe6daf6741..e8d5f68679703c02ba630735f98c5d894821b148 100644 (file)
@@ -38,7 +38,7 @@ set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
                oldtos = iph->tos;
                iph->tos &= ~IPT_ECN_IP_MASK;
                iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK);
-               nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
+               csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
        }
        return true;
 }
@@ -71,8 +71,8 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
        if (einfo->operation & IPT_ECN_OP_SET_CWR)
                tcph->cwr = einfo->proto.tcp.cwr;
 
-       nf_proto_csum_replace2(&tcph->check, skb,
-                               oldval, ((__be16 *)tcph)[6], 0);
+       inet_proto_csum_replace2(&tcph->check, skb,
+                                oldval, ((__be16 *)tcph)[6], 0);
        return true;
 }
 
index d4573baa7f277b2939d204a959b4479133ac8f3c..7b4a6cac399e6ff9f929a505af5e6dd8e3864748 100644 (file)
@@ -38,7 +38,7 @@ target(struct sk_buff *skb,
                iph = ip_hdr(skb);
                oldtos = iph->tos;
                iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
-               nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
+               csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
        }
        return XT_CONTINUE;
 }
index c620a052766616349f561e119fe0087d41ea6607..00ddfbea2799ec7d1a2cedabebc239c3b2d60bf3 100644 (file)
@@ -54,8 +54,8 @@ ipt_ttl_target(struct sk_buff *skb,
        }
 
        if (new_ttl != iph->ttl) {
-               nf_csum_replace2(&iph->check, htons(iph->ttl << 8),
-                                             htons(new_ttl << 8));
+               csum_replace2(&iph->check, htons(iph->ttl << 8),
+                                          htons(new_ttl << 8));
                iph->ttl = new_ttl;
        }
 
index d237511cf46c4eba1ca10cc9ba47f7474dde6766..746c2efddcd1b80c453e7ddaa2ed4c3a372661ec 100644 (file)
@@ -372,10 +372,10 @@ manip_pkt(u_int16_t proto,
        iph = (void *)skb->data + iphdroff;
 
        if (maniptype == IP_NAT_MANIP_SRC) {
-               nf_csum_replace4(&iph->check, iph->saddr, target->src.u3.ip);
+               csum_replace4(&iph->check, iph->saddr, target->src.u3.ip);
                iph->saddr = target->src.u3.ip;
        } else {
-               nf_csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip);
+               csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip);
                iph->daddr = target->dst.u3.ip;
        }
        return 1;
index d00b8b2891fbb0906741e2005f63021b4094dad0..53f79a310b438508167b04d69dc004fb97bfc790 100644 (file)
@@ -180,8 +180,8 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
                                                                datalen, 0));
                }
        } else
-               nf_proto_csum_replace2(&tcph->check, skb,
-                                      htons(oldlen), htons(datalen), 1);
+               inet_proto_csum_replace2(&tcph->check, skb,
+                                        htons(oldlen), htons(datalen), 1);
 
        if (rep_len != match_len) {
                set_bit(IPS_SEQ_ADJUST_BIT, &ct->status);
@@ -270,8 +270,8 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
                                udph->check = CSUM_MANGLED_0;
                }
        } else
-               nf_proto_csum_replace2(&udph->check, skb,
-                                      htons(oldlen), htons(datalen), 1);
+               inet_proto_csum_replace2(&udph->check, skb,
+                                        htons(oldlen), htons(datalen), 1);
 
        return 1;
 }
@@ -310,10 +310,10 @@ sack_adjust(struct sk_buff *skb,
                         ntohl(sack->start_seq), new_start_seq,
                         ntohl(sack->end_seq), new_end_seq);
 
-               nf_proto_csum_replace4(&tcph->check, skb,
-                                      sack->start_seq, new_start_seq, 0);
-               nf_proto_csum_replace4(&tcph->check, skb,
-                                      sack->end_seq, new_end_seq, 0);
+               inet_proto_csum_replace4(&tcph->check, skb,
+                                        sack->start_seq, new_start_seq, 0);
+               inet_proto_csum_replace4(&tcph->check, skb,
+                                        sack->end_seq, new_end_seq, 0);
                sack->start_seq = new_start_seq;
                sack->end_seq = new_end_seq;
                sackoff += sizeof(*sack);
@@ -397,8 +397,8 @@ nf_nat_seq_adjust(struct sk_buff *skb,
        else
                newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
 
-       nf_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
-       nf_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
+       inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
+       inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
 
        pr_debug("Adjusting sequence number from %u->%u, ack from %u->%u\n",
                 ntohl(tcph->seq), ntohl(newseq), ntohl(tcph->ack_seq),
index b9fc724388fc6485212310609cd4ac8a01f73a29..088bb141c15d9409fdef0d1720a2077720a3b69e 100644 (file)
@@ -65,8 +65,8 @@ icmp_manip_pkt(struct sk_buff *skb,
                return 0;
 
        hdr = (struct icmphdr *)(skb->data + hdroff);
-       nf_proto_csum_replace2(&hdr->checksum, skb,
-                              hdr->un.echo.id, tuple->src.u.icmp.id, 0);
+       inet_proto_csum_replace2(&hdr->checksum, skb,
+                                hdr->un.echo.id, tuple->src.u.icmp.id, 0);
        hdr->un.echo.id = tuple->src.u.icmp.id;
        return 1;
 }
index 6bab2e184455fa1dd74c0cdf95e7bd43766e4148..633c53ff3d329bdb9e9ce5545a78f69c8d794f09 100644 (file)
@@ -132,8 +132,8 @@ tcp_manip_pkt(struct sk_buff *skb,
        if (hdrsize < sizeof(*hdr))
                return 1;
 
-       nf_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
-       nf_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0);
+       inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
+       inet_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0);
        return 1;
 }
 
index cbf1a61e2908351ebc813800faf163121d614e82..9c6519cd15f5f19c7bd8f81994a413a09e1c3fa0 100644 (file)
@@ -117,9 +117,9 @@ udp_manip_pkt(struct sk_buff *skb,
                portptr = &hdr->dest;
        }
        if (hdr->check || skb->ip_summed == CHECKSUM_PARTIAL) {
-               nf_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
-               nf_proto_csum_replace2(&hdr->check, skb, *portptr, newport,
-                                      0);
+               inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
+               inet_proto_csum_replace2(&hdr->check, skb, *portptr, newport,
+                                        0);
                if (!hdr->check)
                        hdr->check = CSUM_MANGLED_0;
        }
index f183c8fa47a57fd0a5d13dad9f6786fdd81bac14..bf6249e44068f51b524ae42da32faf59cb92c674 100644 (file)
@@ -95,8 +95,9 @@ tcpmss_mangle_packet(struct sk_buff *skb,
                        opt[i+2] = (newmss & 0xff00) >> 8;
                        opt[i+3] = newmss & 0x00ff;
 
-                       nf_proto_csum_replace2(&tcph->check, skb,
-                                              htons(oldmss), htons(newmss), 0);
+                       inet_proto_csum_replace2(&tcph->check, skb,
+                                                htons(oldmss), htons(newmss),
+                                                0);
                        return 0;
                }
        }
@@ -117,19 +118,19 @@ tcpmss_mangle_packet(struct sk_buff *skb,
        opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
        memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
 
-       nf_proto_csum_replace2(&tcph->check, skb,
-                              htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1);
+       inet_proto_csum_replace2(&tcph->check, skb,
+                                htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1);
        opt[0] = TCPOPT_MSS;
        opt[1] = TCPOLEN_MSS;
        opt[2] = (newmss & 0xff00) >> 8;
        opt[3] = newmss & 0x00ff;
 
-       nf_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), 0);
+       inet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), 0);
 
        oldval = ((__be16 *)tcph)[6];
        tcph->doff += TCPOLEN_MSS/4;
-       nf_proto_csum_replace2(&tcph->check, skb,
-                               oldval, ((__be16 *)tcph)[6], 0);
+       inet_proto_csum_replace2(&tcph->check, skb,
+                                oldval, ((__be16 *)tcph)[6], 0);
        return TCPOLEN_MSS;
 }
 
@@ -152,7 +153,7 @@ xt_tcpmss_target4(struct sk_buff *skb,
        if (ret > 0) {
                iph = ip_hdr(skb);
                newlen = htons(ntohs(iph->tot_len) + ret);
-               nf_csum_replace2(&iph->check, iph->tot_len, newlen);
+               csum_replace2(&iph->check, iph->tot_len, newlen);
                iph->tot_len = newlen;
        }
        return XT_CONTINUE;
index 9c15c4888d1250481cc42dc58d59922915b25ca6..f5ab54b1edd39bb888dbf24dff79164e19c17e97 100644 (file)
@@ -445,7 +445,6 @@ config NET_ACT_IPT
 config NET_ACT_NAT
         tristate "Stateless NAT"
         depends on NET_CLS_ACT
-        select NETFILTER
         ---help---
          Say Y here to do stateless NAT on IPv4 packets.  You should use
          netfilter for NAT unless you know what you are doing.
index c96273bcaf9cbce08531b01f5ccdf785ef320c4c..da5c1eae42225ff1afc69ba102dd9a45b84bbab5 100644 (file)
@@ -151,7 +151,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
                else
                        iph->daddr = new_addr;
 
-               nf_csum_replace4(&iph->check, addr, new_addr);
+               csum_replace4(&iph->check, addr, new_addr);
        }
 
        ihl = iph->ihl * 4;
@@ -169,7 +169,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
                        goto drop;
 
                tcph = (void *)(skb_network_header(skb) + ihl);
-               nf_proto_csum_replace4(&tcph->check, skb, addr, new_addr, 1);
+               inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, 1);
                break;
        }
        case IPPROTO_UDP:
@@ -184,8 +184,8 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 
                udph = (void *)(skb_network_header(skb) + ihl);
                if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
-                       nf_proto_csum_replace4(&udph->check, skb, addr,
-                                              new_addr, 1);
+                       inet_proto_csum_replace4(&udph->check, skb, addr,
+                                                new_addr, 1);
                        if (!udph->check)
                                udph->check = CSUM_MANGLED_0;
                }
@@ -232,8 +232,8 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
                else
                        iph->saddr = new_addr;
 
-               nf_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
-                                      1);
+               inet_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
+                                        1);
                break;
        }
        default: