aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-13 16:10:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:29 -0400
commitbd82393ca23324d103b21aae43160728da6e6c9c (patch)
treec3795389947032eb8d79c269031232aa6293960e
parent39b89160df691045d1449cbaef43c02084c7543a (diff)
[SK_BUFF]: More skb_reset_transport_header conversions
These are a bit more subtle, they are of this type: - skb->h.raw = payload; __skb_pull(skb, payload - skb->data); + skb_reset_transport_header(skb); __skb_pull results in: skb->data = skb->data + payload - skb->data; skb->data = payload; So after __skb_pull we have skb->data pointing to payload and we can just call skb_reset_transport_header(skb), that will do: skb->h.raw = payload; The others are similar, allowing us to get rid of some more cases where a pointer was being attributed to the layer headers. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_sockglue.c12
-rw-r--r--net/ipv6/datagram.c4
2 files changed, 9 insertions, 7 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index ccdc59df015f..fcb35cd5ccfd 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -278,10 +278,12 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
278 skb_network_header(skb); 278 skb_network_header(skb);
279 serr->port = port; 279 serr->port = port;
280 280
281 skb->h.raw = payload; 281 if (skb_pull(skb, payload - skb->data) != NULL) {
282 if (!skb_pull(skb, payload - skb->data) || 282 skb_reset_transport_header(skb);
283 sock_queue_err_skb(sk, skb)) 283 if (sock_queue_err_skb(sk, skb) == 0)
284 kfree_skb(skb); 284 return;
285 }
286 kfree_skb(skb);
285} 287}
286 288
287void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 info) 289void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 info)
@@ -314,8 +316,8 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
314 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); 316 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
315 serr->port = port; 317 serr->port = port;
316 318
317 skb->h.raw = skb->tail;
318 __skb_pull(skb, skb->tail - skb->data); 319 __skb_pull(skb, skb->tail - skb->data);
320 skb_reset_transport_header(skb);
319 321
320 if (sock_queue_err_skb(sk, skb)) 322 if (sock_queue_err_skb(sk, skb))
321 kfree_skb(skb); 323 kfree_skb(skb);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index feba6b197fe9..f16f4f0c5814 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -231,8 +231,8 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
231 skb_network_header(skb); 231 skb_network_header(skb);
232 serr->port = port; 232 serr->port = port;
233 233
234 skb->h.raw = payload;
235 __skb_pull(skb, payload - skb->data); 234 __skb_pull(skb, payload - skb->data);
235 skb_reset_transport_header(skb);
236 236
237 if (sock_queue_err_skb(sk, skb)) 237 if (sock_queue_err_skb(sk, skb))
238 kfree_skb(skb); 238 kfree_skb(skb);
@@ -268,8 +268,8 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
268 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); 268 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
269 serr->port = fl->fl_ip_dport; 269 serr->port = fl->fl_ip_dport;
270 270
271 skb->h.raw = skb->tail;
272 __skb_pull(skb, skb->tail - skb->data); 271 __skb_pull(skb, skb->tail - skb->data);
272 skb_reset_transport_header(skb);
273 273
274 if (sock_queue_err_skb(sk, skb)) 274 if (sock_queue_err_skb(sk, skb))
275 kfree_skb(skb); 275 kfree_skb(skb);