aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r--net/ipv6/ip6_output.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index bd25825c0ccd..1900c6226866 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -107,13 +107,13 @@ static int ip6_output2(struct sk_buff *skb)
107 skb->protocol = htons(ETH_P_IPV6); 107 skb->protocol = htons(ETH_P_IPV6);
108 skb->dev = dev; 108 skb->dev = dev;
109 109
110 if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr)) { 110 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
111 struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL; 111 struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
112 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 112 struct inet6_dev *idev = ip6_dst_idev(skb->dst);
113 113
114 if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) && 114 if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
115 ipv6_chk_mcast_addr(dev, &skb->nh.ipv6h->daddr, 115 ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
116 &skb->nh.ipv6h->saddr)) { 116 &ipv6_hdr(skb)->saddr)) {
117 struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); 117 struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
118 118
119 /* Do not check for IFF_ALLMULTI; multicast routing 119 /* Do not check for IFF_ALLMULTI; multicast routing
@@ -124,7 +124,7 @@ static int ip6_output2(struct sk_buff *skb)
124 newskb->dev, 124 newskb->dev,
125 ip6_dev_loopback_xmit); 125 ip6_dev_loopback_xmit);
126 126
127 if (skb->nh.ipv6h->hop_limit == 0) { 127 if (ipv6_hdr(skb)->hop_limit == 0) {
128 IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); 128 IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS);
129 kfree_skb(skb); 129 kfree_skb(skb);
130 return 0; 130 return 0;
@@ -193,7 +193,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
193 193
194 skb_push(skb, sizeof(struct ipv6hdr)); 194 skb_push(skb, sizeof(struct ipv6hdr));
195 skb_reset_network_header(skb); 195 skb_reset_network_header(skb);
196 hdr = skb->nh.ipv6h; 196 hdr = ipv6_hdr(skb);
197 197
198 /* 198 /*
199 * Fill in the IPv6 header 199 * Fill in the IPv6 header
@@ -263,8 +263,8 @@ int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
263 263
264 totlen = len + sizeof(struct ipv6hdr); 264 totlen = len + sizeof(struct ipv6hdr);
265 265
266 hdr = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr)); 266 skb->nh.raw = skb_put(skb, sizeof(struct ipv6hdr));
267 skb->nh.ipv6h = hdr; 267 hdr = ipv6_hdr(skb);
268 268
269 *(__be32*)hdr = htonl(0x60000000); 269 *(__be32*)hdr = htonl(0x60000000);
270 270
@@ -309,7 +309,7 @@ static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
309 309
310static int ip6_forward_proxy_check(struct sk_buff *skb) 310static int ip6_forward_proxy_check(struct sk_buff *skb)
311{ 311{
312 struct ipv6hdr *hdr = skb->nh.ipv6h; 312 struct ipv6hdr *hdr = ipv6_hdr(skb);
313 u8 nexthdr = hdr->nexthdr; 313 u8 nexthdr = hdr->nexthdr;
314 int offset; 314 int offset;
315 315
@@ -366,7 +366,7 @@ static inline int ip6_forward_finish(struct sk_buff *skb)
366int ip6_forward(struct sk_buff *skb) 366int ip6_forward(struct sk_buff *skb)
367{ 367{
368 struct dst_entry *dst = skb->dst; 368 struct dst_entry *dst = skb->dst;
369 struct ipv6hdr *hdr = skb->nh.ipv6h; 369 struct ipv6hdr *hdr = ipv6_hdr(skb);
370 struct inet6_skb_parm *opt = IP6CB(skb); 370 struct inet6_skb_parm *opt = IP6CB(skb);
371 371
372 if (ipv6_devconf.forwarding == 0) 372 if (ipv6_devconf.forwarding == 0)
@@ -475,7 +475,7 @@ int ip6_forward(struct sk_buff *skb)
475 goto drop; 475 goto drop;
476 } 476 }
477 477
478 hdr = skb->nh.ipv6h; 478 hdr = ipv6_hdr(skb);
479 479
480 /* Mangling hops number delayed to point after skb COW */ 480 /* Mangling hops number delayed to point after skb COW */
481 481
@@ -527,10 +527,11 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
527int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) 527int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
528{ 528{
529 u16 offset = sizeof(struct ipv6hdr); 529 u16 offset = sizeof(struct ipv6hdr);
530 struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1); 530 struct ipv6_opt_hdr *exthdr =
531 (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
531 unsigned int packet_len = skb->tail - skb_network_header(skb); 532 unsigned int packet_len = skb->tail - skb_network_header(skb);
532 int found_rhdr = 0; 533 int found_rhdr = 0;
533 *nexthdr = &skb->nh.ipv6h->nexthdr; 534 *nexthdr = &ipv6_hdr(skb)->nexthdr;
534 535
535 while (offset + 1 <= packet_len) { 536 while (offset + 1 <= packet_len) {
536 537
@@ -643,7 +644,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
643 first_len = skb_pagelen(skb); 644 first_len = skb_pagelen(skb);
644 skb->data_len = first_len - skb_headlen(skb); 645 skb->data_len = first_len - skb_headlen(skb);
645 skb->len = first_len; 646 skb->len = first_len;
646 skb->nh.ipv6h->payload_len = htons(first_len - sizeof(struct ipv6hdr)); 647 ipv6_hdr(skb)->payload_len = htons(first_len -
648 sizeof(struct ipv6hdr));
647 649
648 dst_hold(&rt->u.dst); 650 dst_hold(&rt->u.dst);
649 651
@@ -665,7 +667,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
665 if (frag->next != NULL) 667 if (frag->next != NULL)
666 fh->frag_off |= htons(IP6_MF); 668 fh->frag_off |= htons(IP6_MF);
667 fh->identification = frag_id; 669 fh->identification = frag_id;
668 frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); 670 ipv6_hdr(frag)->payload_len =
671 htons(frag->len -
672 sizeof(struct ipv6hdr));
669 ip6_copy_metadata(frag, skb); 673 ip6_copy_metadata(frag, skb);
670 } 674 }
671 675
@@ -779,7 +783,8 @@ slow_path:
779 fh->frag_off = htons(offset); 783 fh->frag_off = htons(offset);
780 if (left > 0) 784 if (left > 0)
781 fh->frag_off |= htons(IP6_MF); 785 fh->frag_off |= htons(IP6_MF);
782 frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); 786 ipv6_hdr(frag)->payload_len = htons(frag->len -
787 sizeof(struct ipv6hdr));
783 788
784 ptr += len; 789 ptr += len;
785 offset += len; 790 offset += len;
@@ -1355,7 +1360,7 @@ int ip6_push_pending_frames(struct sock *sk)
1355 1360
1356 skb_push(skb, sizeof(struct ipv6hdr)); 1361 skb_push(skb, sizeof(struct ipv6hdr));
1357 skb_reset_network_header(skb); 1362 skb_reset_network_header(skb);
1358 hdr = skb->nh.ipv6h; 1363 hdr = ipv6_hdr(skb);
1359 1364
1360 *(__be32*)hdr = fl->fl6_flowlabel | 1365 *(__be32*)hdr = fl->fl6_flowlabel |
1361 htonl(0x60000000 | ((int)np->cork.tclass << 20)); 1366 htonl(0x60000000 | ((int)np->cork.tclass << 20));