aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_sockglue.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:50:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:59 -0400
commitd56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch)
tree3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /net/ipv4/ip_sockglue.c
parentbbe735e4247dba32568a305553b010081c8dea99 (diff)
[SK_BUFF]: Introduce skb_network_header()
For the places where we need a pointer to the network header, it is still legal to touch skb->nh.raw directly if just adding to, subtracting from or setting it to another layer header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r--net/ipv4/ip_sockglue.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index f8ab654b6a35..70888e1ef6b7 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -273,7 +273,8 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
273 serr->ee.ee_pad = 0; 273 serr->ee.ee_pad = 0;
274 serr->ee.ee_info = info; 274 serr->ee.ee_info = info;
275 serr->ee.ee_data = 0; 275 serr->ee.ee_data = 0;
276 serr->addr_offset = (u8*)&(((struct iphdr*)(skb->h.icmph+1))->daddr) - skb->nh.raw; 276 serr->addr_offset = (u8 *)&(((struct iphdr *)(skb->h.icmph + 1))->daddr) -
277 skb_network_header(skb);
277 serr->port = port; 278 serr->port = port;
278 279
279 skb->h.raw = payload; 280 skb->h.raw = payload;
@@ -309,7 +310,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
309 serr->ee.ee_pad = 0; 310 serr->ee.ee_pad = 0;
310 serr->ee.ee_info = info; 311 serr->ee.ee_info = info;
311 serr->ee.ee_data = 0; 312 serr->ee.ee_data = 0;
312 serr->addr_offset = (u8*)&iph->daddr - skb->nh.raw; 313 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
313 serr->port = port; 314 serr->port = port;
314 315
315 skb->h.raw = skb->tail; 316 skb->h.raw = skb->tail;
@@ -355,7 +356,8 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len)
355 sin = (struct sockaddr_in *)msg->msg_name; 356 sin = (struct sockaddr_in *)msg->msg_name;
356 if (sin) { 357 if (sin) {
357 sin->sin_family = AF_INET; 358 sin->sin_family = AF_INET;
358 sin->sin_addr.s_addr = *(__be32*)(skb->nh.raw + serr->addr_offset); 359 sin->sin_addr.s_addr = *(__be32 *)(skb_network_header(skb) +
360 serr->addr_offset);
359 sin->sin_port = serr->port; 361 sin->sin_port = serr->port;
360 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); 362 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
361 } 363 }