aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipvs/ip_vs_proto_tcp.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-15 03:53:15 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-15 15:26:29 -0400
commit3db05fea51cdb162cfa8f69e9cfb9e228919d2a9 (patch)
tree0d0e4c18cdf2dcb7321035f6614628a2ddfb502d /net/ipv4/ipvs/ip_vs_proto_tcp.c
parent2ca7b0ac022aa0158599178fe1056b1ba9ec8b97 (diff)
[NETFILTER]: Replace sk_buff ** with sk_buff *
With all the users of the double pointers removed, this patch mops up by finally replacing all occurances of sk_buff ** in the netfilter API by sk_buff *. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_proto_tcp.c')
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c
index b65b1a352ba..12dc0d640b6 100644
--- a/net/ipv4/ipvs/ip_vs_proto_tcp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c
@@ -123,27 +123,27 @@ tcp_fast_csum_update(struct tcphdr *tcph, __be32 oldip, __be32 newip,
123 123
124 124
125static int 125static int
126tcp_snat_handler(struct sk_buff **pskb, 126tcp_snat_handler(struct sk_buff *skb,
127 struct ip_vs_protocol *pp, struct ip_vs_conn *cp) 127 struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
128{ 128{
129 struct tcphdr *tcph; 129 struct tcphdr *tcph;
130 const unsigned int tcphoff = ip_hdrlen(*pskb); 130 const unsigned int tcphoff = ip_hdrlen(skb);
131 131
132 /* csum_check requires unshared skb */ 132 /* csum_check requires unshared skb */
133 if (!skb_make_writable(*pskb, tcphoff+sizeof(*tcph))) 133 if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
134 return 0; 134 return 0;
135 135
136 if (unlikely(cp->app != NULL)) { 136 if (unlikely(cp->app != NULL)) {
137 /* Some checks before mangling */ 137 /* Some checks before mangling */
138 if (pp->csum_check && !pp->csum_check(*pskb, pp)) 138 if (pp->csum_check && !pp->csum_check(skb, pp))
139 return 0; 139 return 0;
140 140
141 /* Call application helper if needed */ 141 /* Call application helper if needed */
142 if (!ip_vs_app_pkt_out(cp, pskb)) 142 if (!ip_vs_app_pkt_out(cp, skb))
143 return 0; 143 return 0;
144 } 144 }
145 145
146 tcph = (void *)ip_hdr(*pskb) + tcphoff; 146 tcph = (void *)ip_hdr(skb) + tcphoff;
147 tcph->source = cp->vport; 147 tcph->source = cp->vport;
148 148
149 /* Adjust TCP checksums */ 149 /* Adjust TCP checksums */
@@ -151,17 +151,15 @@ tcp_snat_handler(struct sk_buff **pskb,
151 /* Only port and addr are changed, do fast csum update */ 151 /* Only port and addr are changed, do fast csum update */
152 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr, 152 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr,
153 cp->dport, cp->vport); 153 cp->dport, cp->vport);
154 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE) 154 if (skb->ip_summed == CHECKSUM_COMPLETE)
155 (*pskb)->ip_summed = CHECKSUM_NONE; 155 skb->ip_summed = CHECKSUM_NONE;
156 } else { 156 } else {
157 /* full checksum calculation */ 157 /* full checksum calculation */
158 tcph->check = 0; 158 tcph->check = 0;
159 (*pskb)->csum = skb_checksum(*pskb, tcphoff, 159 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
160 (*pskb)->len - tcphoff, 0);
161 tcph->check = csum_tcpudp_magic(cp->vaddr, cp->caddr, 160 tcph->check = csum_tcpudp_magic(cp->vaddr, cp->caddr,
162 (*pskb)->len - tcphoff, 161 skb->len - tcphoff,
163 cp->protocol, 162 cp->protocol, skb->csum);
164 (*pskb)->csum);
165 IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", 163 IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n",
166 pp->name, tcph->check, 164 pp->name, tcph->check,
167 (char*)&(tcph->check) - (char*)tcph); 165 (char*)&(tcph->check) - (char*)tcph);
@@ -171,30 +169,30 @@ tcp_snat_handler(struct sk_buff **pskb,
171 169
172 170
173static int 171static int
174tcp_dnat_handler(struct sk_buff **pskb, 172tcp_dnat_handler(struct sk_buff *skb,
175 struct ip_vs_protocol *pp, struct ip_vs_conn *cp) 173 struct ip_vs_protocol *pp, struct ip_vs_conn *cp)
176{ 174{
177 struct tcphdr *tcph; 175 struct tcphdr *tcph;
178 const unsigned int tcphoff = ip_hdrlen(*pskb); 176 const unsigned int tcphoff = ip_hdrlen(skb);
179 177
180 /* csum_check requires unshared skb */ 178 /* csum_check requires unshared skb */
181 if (!skb_make_writable(*pskb, tcphoff+sizeof(*tcph))) 179 if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
182 return 0; 180 return 0;
183 181
184 if (unlikely(cp->app != NULL)) { 182 if (unlikely(cp->app != NULL)) {
185 /* Some checks before mangling */ 183 /* Some checks before mangling */
186 if (pp->csum_check && !pp->csum_check(*pskb, pp)) 184 if (pp->csum_check && !pp->csum_check(skb, pp))
187 return 0; 185 return 0;
188 186
189 /* 187 /*
190 * Attempt ip_vs_app call. 188 * Attempt ip_vs_app call.
191 * It will fix ip_vs_conn and iph ack_seq stuff 189 * It will fix ip_vs_conn and iph ack_seq stuff
192 */ 190 */
193 if (!ip_vs_app_pkt_in(cp, pskb)) 191 if (!ip_vs_app_pkt_in(cp, skb))
194 return 0; 192 return 0;
195 } 193 }
196 194
197 tcph = (void *)ip_hdr(*pskb) + tcphoff; 195 tcph = (void *)ip_hdr(skb) + tcphoff;
198 tcph->dest = cp->dport; 196 tcph->dest = cp->dport;
199 197
200 /* 198 /*
@@ -204,18 +202,16 @@ tcp_dnat_handler(struct sk_buff **pskb,
204 /* Only port and addr are changed, do fast csum update */ 202 /* Only port and addr are changed, do fast csum update */
205 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr, 203 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr,
206 cp->vport, cp->dport); 204 cp->vport, cp->dport);
207 if ((*pskb)->ip_summed == CHECKSUM_COMPLETE) 205 if (skb->ip_summed == CHECKSUM_COMPLETE)
208 (*pskb)->ip_summed = CHECKSUM_NONE; 206 skb->ip_summed = CHECKSUM_NONE;
209 } else { 207 } else {
210 /* full checksum calculation */ 208 /* full checksum calculation */
211 tcph->check = 0; 209 tcph->check = 0;
212 (*pskb)->csum = skb_checksum(*pskb, tcphoff, 210 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
213 (*pskb)->len - tcphoff, 0);
214 tcph->check = csum_tcpudp_magic(cp->caddr, cp->daddr, 211 tcph->check = csum_tcpudp_magic(cp->caddr, cp->daddr,
215 (*pskb)->len - tcphoff, 212 skb->len - tcphoff,
216 cp->protocol, 213 cp->protocol, skb->csum);
217 (*pskb)->csum); 214 skb->ip_summed = CHECKSUM_UNNECESSARY;
218 (*pskb)->ip_summed = CHECKSUM_UNNECESSARY;
219 } 215 }
220 return 1; 216 return 1;
221} 217}