aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-11-29 09:17:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:15 -0500
commitbe0ea7d5da3d99140bde7e5cea328eb111731700 (patch)
treefc7e0702bf03eff7409c1bd8361fca5737cbe365 /net
parenta99a00cf1adef2d3dce745c93c9cc8b0a1612c50 (diff)
[NETFILTER]: Convert old checksum helper names
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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/ipt_ECN.c6
-rw-r--r--net/ipv4/netfilter/ipt_TOS.c2
-rw-r--r--net/ipv4/netfilter/ipt_TTL.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_helper.c20
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_icmp.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_tcp.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_udp.c6
-rw-r--r--net/netfilter/xt_TCPMSS.c17
-rw-r--r--net/sched/Kconfig1
-rw-r--r--net/sched/act_nat.c12
11 files changed, 40 insertions, 40 deletions
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c
index add110060a22..e8d5f6867970 100644
--- a/net/ipv4/netfilter/ipt_ECN.c
+++ b/net/ipv4/netfilter/ipt_ECN.c
@@ -38,7 +38,7 @@ set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
38 oldtos = iph->tos; 38 oldtos = iph->tos;
39 iph->tos &= ~IPT_ECN_IP_MASK; 39 iph->tos &= ~IPT_ECN_IP_MASK;
40 iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); 40 iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK);
41 nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos)); 41 csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
42 } 42 }
43 return true; 43 return true;
44} 44}
@@ -71,8 +71,8 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
71 if (einfo->operation & IPT_ECN_OP_SET_CWR) 71 if (einfo->operation & IPT_ECN_OP_SET_CWR)
72 tcph->cwr = einfo->proto.tcp.cwr; 72 tcph->cwr = einfo->proto.tcp.cwr;
73 73
74 nf_proto_csum_replace2(&tcph->check, skb, 74 inet_proto_csum_replace2(&tcph->check, skb,
75 oldval, ((__be16 *)tcph)[6], 0); 75 oldval, ((__be16 *)tcph)[6], 0);
76 return true; 76 return true;
77} 77}
78 78
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
index d4573baa7f27..7b4a6cac399e 100644
--- a/net/ipv4/netfilter/ipt_TOS.c
+++ b/net/ipv4/netfilter/ipt_TOS.c
@@ -38,7 +38,7 @@ target(struct sk_buff *skb,
38 iph = ip_hdr(skb); 38 iph = ip_hdr(skb);
39 oldtos = iph->tos; 39 oldtos = iph->tos;
40 iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; 40 iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
41 nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos)); 41 csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
42 } 42 }
43 return XT_CONTINUE; 43 return XT_CONTINUE;
44} 44}
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c
index c620a0527666..00ddfbea2799 100644
--- a/net/ipv4/netfilter/ipt_TTL.c
+++ b/net/ipv4/netfilter/ipt_TTL.c
@@ -54,8 +54,8 @@ ipt_ttl_target(struct sk_buff *skb,
54 } 54 }
55 55
56 if (new_ttl != iph->ttl) { 56 if (new_ttl != iph->ttl) {
57 nf_csum_replace2(&iph->check, htons(iph->ttl << 8), 57 csum_replace2(&iph->check, htons(iph->ttl << 8),
58 htons(new_ttl << 8)); 58 htons(new_ttl << 8));
59 iph->ttl = new_ttl; 59 iph->ttl = new_ttl;
60 } 60 }
61 61
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index d237511cf46c..746c2efddcd1 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -372,10 +372,10 @@ manip_pkt(u_int16_t proto,
372 iph = (void *)skb->data + iphdroff; 372 iph = (void *)skb->data + iphdroff;
373 373
374 if (maniptype == IP_NAT_MANIP_SRC) { 374 if (maniptype == IP_NAT_MANIP_SRC) {
375 nf_csum_replace4(&iph->check, iph->saddr, target->src.u3.ip); 375 csum_replace4(&iph->check, iph->saddr, target->src.u3.ip);
376 iph->saddr = target->src.u3.ip; 376 iph->saddr = target->src.u3.ip;
377 } else { 377 } else {
378 nf_csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip); 378 csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip);
379 iph->daddr = target->dst.u3.ip; 379 iph->daddr = target->dst.u3.ip;
380 } 380 }
381 return 1; 381 return 1;
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index d00b8b2891fb..53f79a310b43 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -180,8 +180,8 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
180 datalen, 0)); 180 datalen, 0));
181 } 181 }
182 } else 182 } else
183 nf_proto_csum_replace2(&tcph->check, skb, 183 inet_proto_csum_replace2(&tcph->check, skb,
184 htons(oldlen), htons(datalen), 1); 184 htons(oldlen), htons(datalen), 1);
185 185
186 if (rep_len != match_len) { 186 if (rep_len != match_len) {
187 set_bit(IPS_SEQ_ADJUST_BIT, &ct->status); 187 set_bit(IPS_SEQ_ADJUST_BIT, &ct->status);
@@ -270,8 +270,8 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
270 udph->check = CSUM_MANGLED_0; 270 udph->check = CSUM_MANGLED_0;
271 } 271 }
272 } else 272 } else
273 nf_proto_csum_replace2(&udph->check, skb, 273 inet_proto_csum_replace2(&udph->check, skb,
274 htons(oldlen), htons(datalen), 1); 274 htons(oldlen), htons(datalen), 1);
275 275
276 return 1; 276 return 1;
277} 277}
@@ -310,10 +310,10 @@ sack_adjust(struct sk_buff *skb,
310 ntohl(sack->start_seq), new_start_seq, 310 ntohl(sack->start_seq), new_start_seq,
311 ntohl(sack->end_seq), new_end_seq); 311 ntohl(sack->end_seq), new_end_seq);
312 312
313 nf_proto_csum_replace4(&tcph->check, skb, 313 inet_proto_csum_replace4(&tcph->check, skb,
314 sack->start_seq, new_start_seq, 0); 314 sack->start_seq, new_start_seq, 0);
315 nf_proto_csum_replace4(&tcph->check, skb, 315 inet_proto_csum_replace4(&tcph->check, skb,
316 sack->end_seq, new_end_seq, 0); 316 sack->end_seq, new_end_seq, 0);
317 sack->start_seq = new_start_seq; 317 sack->start_seq = new_start_seq;
318 sack->end_seq = new_end_seq; 318 sack->end_seq = new_end_seq;
319 sackoff += sizeof(*sack); 319 sackoff += sizeof(*sack);
@@ -397,8 +397,8 @@ nf_nat_seq_adjust(struct sk_buff *skb,
397 else 397 else
398 newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before); 398 newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
399 399
400 nf_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0); 400 inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
401 nf_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0); 401 inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
402 402
403 pr_debug("Adjusting sequence number from %u->%u, ack from %u->%u\n", 403 pr_debug("Adjusting sequence number from %u->%u, ack from %u->%u\n",
404 ntohl(tcph->seq), ntohl(newseq), ntohl(tcph->ack_seq), 404 ntohl(tcph->seq), ntohl(newseq), ntohl(tcph->ack_seq),
diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c
index b9fc724388fc..088bb141c15d 100644
--- a/net/ipv4/netfilter/nf_nat_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c
@@ -65,8 +65,8 @@ icmp_manip_pkt(struct sk_buff *skb,
65 return 0; 65 return 0;
66 66
67 hdr = (struct icmphdr *)(skb->data + hdroff); 67 hdr = (struct icmphdr *)(skb->data + hdroff);
68 nf_proto_csum_replace2(&hdr->checksum, skb, 68 inet_proto_csum_replace2(&hdr->checksum, skb,
69 hdr->un.echo.id, tuple->src.u.icmp.id, 0); 69 hdr->un.echo.id, tuple->src.u.icmp.id, 0);
70 hdr->un.echo.id = tuple->src.u.icmp.id; 70 hdr->un.echo.id = tuple->src.u.icmp.id;
71 return 1; 71 return 1;
72} 72}
diff --git a/net/ipv4/netfilter/nf_nat_proto_tcp.c b/net/ipv4/netfilter/nf_nat_proto_tcp.c
index 6bab2e184455..633c53ff3d32 100644
--- a/net/ipv4/netfilter/nf_nat_proto_tcp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_tcp.c
@@ -132,8 +132,8 @@ tcp_manip_pkt(struct sk_buff *skb,
132 if (hdrsize < sizeof(*hdr)) 132 if (hdrsize < sizeof(*hdr))
133 return 1; 133 return 1;
134 134
135 nf_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1); 135 inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
136 nf_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0); 136 inet_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0);
137 return 1; 137 return 1;
138} 138}
139 139
diff --git a/net/ipv4/netfilter/nf_nat_proto_udp.c b/net/ipv4/netfilter/nf_nat_proto_udp.c
index cbf1a61e2908..9c6519cd15f5 100644
--- a/net/ipv4/netfilter/nf_nat_proto_udp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_udp.c
@@ -117,9 +117,9 @@ udp_manip_pkt(struct sk_buff *skb,
117 portptr = &hdr->dest; 117 portptr = &hdr->dest;
118 } 118 }
119 if (hdr->check || skb->ip_summed == CHECKSUM_PARTIAL) { 119 if (hdr->check || skb->ip_summed == CHECKSUM_PARTIAL) {
120 nf_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1); 120 inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1);
121 nf_proto_csum_replace2(&hdr->check, skb, *portptr, newport, 121 inet_proto_csum_replace2(&hdr->check, skb, *portptr, newport,
122 0); 122 0);
123 if (!hdr->check) 123 if (!hdr->check)
124 hdr->check = CSUM_MANGLED_0; 124 hdr->check = CSUM_MANGLED_0;
125 } 125 }
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index f183c8fa47a5..bf6249e44068 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -95,8 +95,9 @@ tcpmss_mangle_packet(struct sk_buff *skb,
95 opt[i+2] = (newmss & 0xff00) >> 8; 95 opt[i+2] = (newmss & 0xff00) >> 8;
96 opt[i+3] = newmss & 0x00ff; 96 opt[i+3] = newmss & 0x00ff;
97 97
98 nf_proto_csum_replace2(&tcph->check, skb, 98 inet_proto_csum_replace2(&tcph->check, skb,
99 htons(oldmss), htons(newmss), 0); 99 htons(oldmss), htons(newmss),
100 0);
100 return 0; 101 return 0;
101 } 102 }
102 } 103 }
@@ -117,19 +118,19 @@ tcpmss_mangle_packet(struct sk_buff *skb,
117 opt = (u_int8_t *)tcph + sizeof(struct tcphdr); 118 opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
118 memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); 119 memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
119 120
120 nf_proto_csum_replace2(&tcph->check, skb, 121 inet_proto_csum_replace2(&tcph->check, skb,
121 htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1); 122 htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1);
122 opt[0] = TCPOPT_MSS; 123 opt[0] = TCPOPT_MSS;
123 opt[1] = TCPOLEN_MSS; 124 opt[1] = TCPOLEN_MSS;
124 opt[2] = (newmss & 0xff00) >> 8; 125 opt[2] = (newmss & 0xff00) >> 8;
125 opt[3] = newmss & 0x00ff; 126 opt[3] = newmss & 0x00ff;
126 127
127 nf_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), 0); 128 inet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), 0);
128 129
129 oldval = ((__be16 *)tcph)[6]; 130 oldval = ((__be16 *)tcph)[6];
130 tcph->doff += TCPOLEN_MSS/4; 131 tcph->doff += TCPOLEN_MSS/4;
131 nf_proto_csum_replace2(&tcph->check, skb, 132 inet_proto_csum_replace2(&tcph->check, skb,
132 oldval, ((__be16 *)tcph)[6], 0); 133 oldval, ((__be16 *)tcph)[6], 0);
133 return TCPOLEN_MSS; 134 return TCPOLEN_MSS;
134} 135}
135 136
@@ -152,7 +153,7 @@ xt_tcpmss_target4(struct sk_buff *skb,
152 if (ret > 0) { 153 if (ret > 0) {
153 iph = ip_hdr(skb); 154 iph = ip_hdr(skb);
154 newlen = htons(ntohs(iph->tot_len) + ret); 155 newlen = htons(ntohs(iph->tot_len) + ret);
155 nf_csum_replace2(&iph->check, iph->tot_len, newlen); 156 csum_replace2(&iph->check, iph->tot_len, newlen);
156 iph->tot_len = newlen; 157 iph->tot_len = newlen;
157 } 158 }
158 return XT_CONTINUE; 159 return XT_CONTINUE;
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 9c15c4888d12..f5ab54b1edd3 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -445,7 +445,6 @@ config NET_ACT_IPT
445config NET_ACT_NAT 445config NET_ACT_NAT
446 tristate "Stateless NAT" 446 tristate "Stateless NAT"
447 depends on NET_CLS_ACT 447 depends on NET_CLS_ACT
448 select NETFILTER
449 ---help--- 448 ---help---
450 Say Y here to do stateless NAT on IPv4 packets. You should use 449 Say Y here to do stateless NAT on IPv4 packets. You should use
451 netfilter for NAT unless you know what you are doing. 450 netfilter for NAT unless you know what you are doing.
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index c96273bcaf9c..da5c1eae4222 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -151,7 +151,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
151 else 151 else
152 iph->daddr = new_addr; 152 iph->daddr = new_addr;
153 153
154 nf_csum_replace4(&iph->check, addr, new_addr); 154 csum_replace4(&iph->check, addr, new_addr);
155 } 155 }
156 156
157 ihl = iph->ihl * 4; 157 ihl = iph->ihl * 4;
@@ -169,7 +169,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
169 goto drop; 169 goto drop;
170 170
171 tcph = (void *)(skb_network_header(skb) + ihl); 171 tcph = (void *)(skb_network_header(skb) + ihl);
172 nf_proto_csum_replace4(&tcph->check, skb, addr, new_addr, 1); 172 inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, 1);
173 break; 173 break;
174 } 174 }
175 case IPPROTO_UDP: 175 case IPPROTO_UDP:
@@ -184,8 +184,8 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
184 184
185 udph = (void *)(skb_network_header(skb) + ihl); 185 udph = (void *)(skb_network_header(skb) + ihl);
186 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) { 186 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
187 nf_proto_csum_replace4(&udph->check, skb, addr, 187 inet_proto_csum_replace4(&udph->check, skb, addr,
188 new_addr, 1); 188 new_addr, 1);
189 if (!udph->check) 189 if (!udph->check)
190 udph->check = CSUM_MANGLED_0; 190 udph->check = CSUM_MANGLED_0;
191 } 191 }
@@ -232,8 +232,8 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
232 else 232 else
233 iph->saddr = new_addr; 233 iph->saddr = new_addr;
234 234
235 nf_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr, 235 inet_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
236 1); 236 1);
237 break; 237 break;
238 } 238 }
239 default: 239 default: