aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_netfilter.c6
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/dccp/ipv6.c32
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c2
-rw-r--r--net/ipv6/ah6.c14
-rw-r--r--net/ipv6/datagram.c16
-rw-r--r--net/ipv6/esp6.c2
-rw-r--r--net/ipv6/exthdrs.c20
-rw-r--r--net/ipv6/icmp.c20
-rw-r--r--net/ipv6/ip6_input.c8
-rw-r--r--net/ipv6/ip6_output.c37
-rw-r--r--net/ipv6/ip6_tunnel.c16
-rw-r--r--net/ipv6/ipcomp6.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c6
-rw-r--r--net/ipv6/mcast.c15
-rw-r--r--net/ipv6/mip6.c20
-rw-r--r--net/ipv6/ndisc.c50
-rw-r--r--net/ipv6/netfilter.c8
-rw-r--r--net/ipv6/netfilter/ip6_tables.c8
-rw-r--r--net/ipv6/netfilter/ip6t_HL.c2
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c2
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c8
-rw-r--r--net/ipv6/netfilter/ip6t_eui64.c4
-rw-r--r--net/ipv6/netfilter/ip6t_hl.c2
-rw-r--r--net/ipv6/netfilter/ip6t_ipv6header.c2
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c14
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c19
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c16
-rw-r--r--net/ipv6/raw.c17
-rw-r--r--net/ipv6/reassembly.c12
-rw-r--r--net/ipv6/route.c4
-rw-r--r--net/ipv6/sit.c8
-rw-r--r--net/ipv6/tcp_ipv6.c75
-rw-r--r--net/ipv6/udp.c17
-rw-r--r--net/ipv6/xfrm6_input.c4
-rw-r--r--net/ipv6/xfrm6_mode_beet.c6
-rw-r--r--net/ipv6/xfrm6_mode_ro.c2
-rw-r--r--net/ipv6/xfrm6_mode_transport.c4
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c10
-rw-r--r--net/ipv6/xfrm6_policy.c2
-rw-r--r--net/ipv6/xfrm6_tunnel.c2
-rw-r--r--net/netfilter/xt_DSCP.c4
-rw-r--r--net/netfilter/xt_TCPMSS.c4
-rw-r--r--net/netfilter/xt_dscp.c2
-rw-r--r--net/netfilter/xt_hashlimit.c4
-rw-r--r--net/netfilter/xt_length.c3
-rw-r--r--net/sched/cls_rsvp.h2
-rw-r--r--net/sched/sch_dsmark.c4
-rw-r--r--net/sched/sch_sfq.c2
-rw-r--r--net/sctp/ipv6.c8
51 files changed, 276 insertions, 277 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 0ee74b1e4770..f2796c97b4a2 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -372,7 +372,7 @@ static struct net_device *setup_pre_routing(struct sk_buff *skb)
372/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ 372/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
373static int check_hbh_len(struct sk_buff *skb) 373static int check_hbh_len(struct sk_buff *skb)
374{ 374{
375 unsigned char *raw = (u8 *) (skb->nh.ipv6h + 1); 375 unsigned char *raw = (u8 *)(ipv6_hdr(skb) + 1);
376 u32 pkt_len; 376 u32 pkt_len;
377 const unsigned char *nh = skb_network_header(skb); 377 const unsigned char *nh = skb_network_header(skb);
378 int off = raw - nh; 378 int off = raw - nh;
@@ -400,7 +400,7 @@ static int check_hbh_len(struct sk_buff *skb)
400 goto bad; 400 goto bad;
401 pkt_len = ntohl(*(__be32 *) (nh + off + 2)); 401 pkt_len = ntohl(*(__be32 *) (nh + off + 2));
402 if (pkt_len <= IPV6_MAXPLEN || 402 if (pkt_len <= IPV6_MAXPLEN ||
403 skb->nh.ipv6h->payload_len) 403 ipv6_hdr(skb)->payload_len)
404 goto bad; 404 goto bad;
405 if (pkt_len > skb->len - sizeof(struct ipv6hdr)) 405 if (pkt_len > skb->len - sizeof(struct ipv6hdr))
406 goto bad; 406 goto bad;
@@ -441,7 +441,7 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
441 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 441 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
442 goto inhdr_error; 442 goto inhdr_error;
443 443
444 hdr = skb->nh.ipv6h; 444 hdr = ipv6_hdr(skb);
445 445
446 if (hdr->version != 6) 446 if (hdr->version != 6)
447 goto inhdr_error; 447 goto inhdr_error;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index e0faff8eb652..ee82364c8f31 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2736,7 +2736,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2736 skb->protocol = protocol; 2736 skb->protocol = protocol;
2737 skb->dev = odev; 2737 skb->dev = odev;
2738 skb->pkt_type = PACKET_HOST; 2738 skb->pkt_type = PACKET_HOST;
2739 skb->nh.ipv6h = iph; 2739 skb->nh.raw = (unsigned char *)iph;
2740 skb->h.uh = udph; 2740 skb->h.uh = udph;
2741 2741
2742 if (pkt_dev->nfrags <= 0) 2742 if (pkt_dev->nfrags <= 0)
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 627d0c3c51cf..64eac2515aa2 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -84,8 +84,8 @@ static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
84 84
85static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb) 85static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb)
86{ 86{
87 return secure_dccpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32, 87 return secure_dccpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
88 skb->nh.ipv6h->saddr.s6_addr32, 88 ipv6_hdr(skb)->saddr.s6_addr32,
89 dccp_hdr(skb)->dccph_dport, 89 dccp_hdr(skb)->dccph_dport,
90 dccp_hdr(skb)->dccph_sport ); 90 dccp_hdr(skb)->dccph_sport );
91 91
@@ -313,6 +313,7 @@ static void dccp_v6_reqsk_destructor(struct request_sock *req)
313static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) 313static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
314{ 314{
315 struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh; 315 struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
316 struct ipv6hdr *rxip6h;
316 const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) + 317 const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) +
317 sizeof(struct dccp_hdr_ext) + 318 sizeof(struct dccp_hdr_ext) +
318 sizeof(struct dccp_hdr_reset); 319 sizeof(struct dccp_hdr_reset);
@@ -352,12 +353,13 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
352 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq); 353 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
353 354
354 dccp_csum_outgoing(skb); 355 dccp_csum_outgoing(skb);
355 dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr, 356 rxip6h = ipv6_hdr(rxskb);
356 &rxskb->nh.ipv6h->daddr); 357 dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
358 &rxip6h->daddr);
357 359
358 memset(&fl, 0, sizeof(fl)); 360 memset(&fl, 0, sizeof(fl));
359 ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr); 361 ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
360 ipv6_addr_copy(&fl.fl6_src, &rxskb->nh.ipv6h->daddr); 362 ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
361 363
362 fl.proto = IPPROTO_DCCP; 364 fl.proto = IPPROTO_DCCP;
363 fl.oif = inet6_iif(rxskb); 365 fl.oif = inet6_iif(rxskb);
@@ -390,7 +392,7 @@ static struct request_sock_ops dccp6_request_sock_ops = {
390static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) 392static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
391{ 393{
392 const struct dccp_hdr *dh = dccp_hdr(skb); 394 const struct dccp_hdr *dh = dccp_hdr(skb);
393 const struct ipv6hdr *iph = skb->nh.ipv6h; 395 const struct ipv6hdr *iph = ipv6_hdr(skb);
394 struct sock *nsk; 396 struct sock *nsk;
395 struct request_sock **prev; 397 struct request_sock **prev;
396 /* Find possible connection requests. */ 398 /* Find possible connection requests. */
@@ -460,8 +462,8 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
460 goto drop_and_free; 462 goto drop_and_free;
461 463
462 ireq6 = inet6_rsk(req); 464 ireq6 = inet6_rsk(req);
463 ipv6_addr_copy(&ireq6->rmt_addr, &skb->nh.ipv6h->saddr); 465 ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
464 ipv6_addr_copy(&ireq6->loc_addr, &skb->nh.ipv6h->daddr); 466 ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);
465 ireq6->pktopts = NULL; 467 ireq6->pktopts = NULL;
466 468
467 if (ipv6_opt_accepted(sk, skb) || 469 if (ipv6_opt_accepted(sk, skb) ||
@@ -546,7 +548,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
546 newnp->pktoptions = NULL; 548 newnp->pktoptions = NULL;
547 newnp->opt = NULL; 549 newnp->opt = NULL;
548 newnp->mcast_oif = inet6_iif(skb); 550 newnp->mcast_oif = inet6_iif(skb);
549 newnp->mcast_hops = skb->nh.ipv6h->hop_limit; 551 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
550 552
551 /* 553 /*
552 * No need to charge this sock to the relevant IPv6 refcnt debug socks count 554 * No need to charge this sock to the relevant IPv6 refcnt debug socks count
@@ -653,7 +655,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
653 } 655 }
654 newnp->opt = NULL; 656 newnp->opt = NULL;
655 newnp->mcast_oif = inet6_iif(skb); 657 newnp->mcast_oif = inet6_iif(skb);
656 newnp->mcast_hops = skb->nh.ipv6h->hop_limit; 658 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
657 659
658 /* 660 /*
659 * Clone native IPv6 options from listening socket (if any) 661 * Clone native IPv6 options from listening socket (if any)
@@ -826,8 +828,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
826 goto discard_it; 828 goto discard_it;
827 829
828 /* Step 1: If header checksum is incorrect, drop packet and return. */ 830 /* Step 1: If header checksum is incorrect, drop packet and return. */
829 if (dccp_v6_csum_finish(skb, &skb->nh.ipv6h->saddr, 831 if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
830 &skb->nh.ipv6h->daddr)) { 832 &ipv6_hdr(skb)->daddr)) {
831 DCCP_WARN("dropped packet with invalid checksum\n"); 833 DCCP_WARN("dropped packet with invalid checksum\n");
832 goto discard_it; 834 goto discard_it;
833 } 835 }
@@ -844,9 +846,9 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
844 846
845 /* Step 2: 847 /* Step 2:
846 * Look up flow ID in table and get corresponding socket */ 848 * Look up flow ID in table and get corresponding socket */
847 sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr, 849 sk = __inet6_lookup(&dccp_hashinfo, &ipv6_hdr(skb)->saddr,
848 dh->dccph_sport, 850 dh->dccph_sport,
849 &skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport), 851 &ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport),
850 inet6_iif(skb)); 852 inet6_iif(skb));
851 /* 853 /*
852 * Step 2: 854 * Step 2:
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 851f46b910f2..969fe31723a7 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -535,7 +535,7 @@ static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
535 if (skb->protocol == htons(ETH_P_IP)) { 535 if (skb->protocol == htons(ETH_P_IP)) {
536 IP_ECN_set_ce(ip_hdr(skb)); 536 IP_ECN_set_ce(ip_hdr(skb));
537 } else if (skb->protocol == htons(ETH_P_IPV6)) { 537 } else if (skb->protocol == htons(ETH_P_IPV6)) {
538 IP6_ECN_set_ce(skb->nh.ipv6h); 538 IP6_ECN_set_ce(ipv6_hdr(skb));
539 } 539 }
540 } 540 }
541} 541}
@@ -721,7 +721,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
721 addr_type = ipv6_addr_type(addr6); 721 addr_type = ipv6_addr_type(addr6);
722 722
723 if (addr_type == IPV6_ADDR_ANY) { 723 if (addr_type == IPV6_ADDR_ANY) {
724 addr6 = &skb->nh.ipv6h->daddr; 724 addr6 = &ipv6_hdr(skb)->daddr;
725 addr_type = ipv6_addr_type(addr6); 725 addr_type = ipv6_addr_type(addr6);
726 } 726 }
727 727
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index faa1b9a76e76..edba75610a46 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -26,7 +26,7 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
26static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) 26static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
27{ 27{
28 if (INET_ECN_is_ce(iph->tos)) 28 if (INET_ECN_is_ce(iph->tos))
29 IP6_ECN_set_ce(skb->nh.ipv6h); 29 IP6_ECN_set_ce(ipv6_hdr(skb));
30} 30}
31 31
32/* Add encapsulation header. 32/* Add encapsulation header.
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 1c914386982f..b682d2368c2a 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -325,6 +325,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
325 */ 325 */
326 326
327 struct ipv6_auth_hdr *ah; 327 struct ipv6_auth_hdr *ah;
328 struct ipv6hdr *ip6h;
328 struct ah_data *ahp; 329 struct ah_data *ahp;
329 unsigned char *tmp_hdr = NULL; 330 unsigned char *tmp_hdr = NULL;
330 u16 hdr_len; 331 u16 hdr_len;
@@ -357,13 +358,14 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
357 tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC); 358 tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC);
358 if (!tmp_hdr) 359 if (!tmp_hdr)
359 goto out; 360 goto out;
360 if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len, XFRM_POLICY_IN)) 361 ip6h = ipv6_hdr(skb);
362 if (ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN))
361 goto free_out; 363 goto free_out;
362 skb->nh.ipv6h->priority = 0; 364 ip6h->priority = 0;
363 skb->nh.ipv6h->flow_lbl[0] = 0; 365 ip6h->flow_lbl[0] = 0;
364 skb->nh.ipv6h->flow_lbl[1] = 0; 366 ip6h->flow_lbl[1] = 0;
365 skb->nh.ipv6h->flow_lbl[2] = 0; 367 ip6h->flow_lbl[2] = 0;
366 skb->nh.ipv6h->hop_limit = 0; 368 ip6h->hop_limit = 0;
367 369
368 { 370 {
369 u8 auth_data[MAX_AH_AUTH_LEN]; 371 u8 auth_data[MAX_AH_AUTH_LEN];
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index ac95d3bfdfb7..f429290c2c37 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -254,7 +254,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
254 254
255 skb_put(skb, sizeof(struct ipv6hdr)); 255 skb_put(skb, sizeof(struct ipv6hdr));
256 skb_reset_network_header(skb); 256 skb_reset_network_header(skb);
257 iph = skb->nh.ipv6h; 257 iph = ipv6_hdr(skb);
258 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); 258 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
259 259
260 serr = SKB_EXT_ERR(skb); 260 serr = SKB_EXT_ERR(skb);
@@ -340,7 +340,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
340 sin->sin6_flowinfo = 0; 340 sin->sin6_flowinfo = 0;
341 sin->sin6_scope_id = 0; 341 sin->sin6_scope_id = 0;
342 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) { 342 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
343 ipv6_addr_copy(&sin->sin6_addr, &skb->nh.ipv6h->saddr); 343 ipv6_addr_copy(&sin->sin6_addr, &ipv6_hdr(skb)->saddr);
344 if (np->rxopt.all) 344 if (np->rxopt.all)
345 datagram_recv_ctl(sk, msg, skb); 345 datagram_recv_ctl(sk, msg, skb);
346 if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) 346 if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
@@ -391,17 +391,17 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
391 struct in6_pktinfo src_info; 391 struct in6_pktinfo src_info;
392 392
393 src_info.ipi6_ifindex = opt->iif; 393 src_info.ipi6_ifindex = opt->iif;
394 ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr); 394 ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
395 put_cmsg(msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info); 395 put_cmsg(msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);
396 } 396 }
397 397
398 if (np->rxopt.bits.rxhlim) { 398 if (np->rxopt.bits.rxhlim) {
399 int hlim = skb->nh.ipv6h->hop_limit; 399 int hlim = ipv6_hdr(skb)->hop_limit;
400 put_cmsg(msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim); 400 put_cmsg(msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
401 } 401 }
402 402
403 if (np->rxopt.bits.rxtclass) { 403 if (np->rxopt.bits.rxtclass) {
404 int tclass = (ntohl(*(__be32 *)skb->nh.ipv6h) >> 20) & 0xff; 404 int tclass = (ntohl(*(__be32 *)ipv6_hdr(skb)) >> 20) & 0xff;
405 put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); 405 put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
406 } 406 }
407 407
@@ -428,7 +428,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
428 * IPV6_RECVDSTOPTS is more generic. --yoshfuji 428 * IPV6_RECVDSTOPTS is more generic. --yoshfuji
429 */ 429 */
430 unsigned int off = sizeof(struct ipv6hdr); 430 unsigned int off = sizeof(struct ipv6hdr);
431 u8 nexthdr = skb->nh.ipv6h->nexthdr; 431 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
432 432
433 while (off <= opt->lastopt) { 433 while (off <= opt->lastopt) {
434 unsigned len; 434 unsigned len;
@@ -466,11 +466,11 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
466 struct in6_pktinfo src_info; 466 struct in6_pktinfo src_info;
467 467
468 src_info.ipi6_ifindex = opt->iif; 468 src_info.ipi6_ifindex = opt->iif;
469 ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr); 469 ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
470 put_cmsg(msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info); 470 put_cmsg(msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);
471 } 471 }
472 if (np->rxopt.bits.rxohlim) { 472 if (np->rxopt.bits.rxohlim) {
473 int hlim = skb->nh.ipv6h->hop_limit; 473 int hlim = ipv6_hdr(skb)->hop_limit;
474 put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim); 474 put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);
475 } 475 }
476 if (np->rxopt.bits.ohopopts && opt->hop) { 476 if (np->rxopt.bits.ohopopts && opt->hop) {
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 6e6b57ac8013..7aff380e74ef 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -191,7 +191,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
191 skb->ip_summed = CHECKSUM_NONE; 191 skb->ip_summed = CHECKSUM_NONE;
192 192
193 esph = (struct ipv6_esp_hdr*)skb->data; 193 esph = (struct ipv6_esp_hdr*)skb->data;
194 iph = skb->nh.ipv6h; 194 iph = ipv6_hdr(skb);
195 195
196 /* Get ivec. This can be wrong, check against another impls. */ 196 /* Get ivec. This can be wrong, check against another impls. */
197 if (esp->conf.ivlen) 197 if (esp->conf.ivlen)
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 9ebf120ba6d3..dab069b0b3f6 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -125,7 +125,7 @@ static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
125 /* Actually, it is redundant check. icmp_send 125 /* Actually, it is redundant check. icmp_send
126 will recheck in any case. 126 will recheck in any case.
127 */ 127 */
128 if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr)) 128 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr))
129 break; 129 break;
130 case 2: /* send ICMP PARM PROB regardless and drop packet */ 130 case 2: /* send ICMP PARM PROB regardless and drop packet */
131 icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff); 131 icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
@@ -202,7 +202,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
202 struct sk_buff *skb = *skbp; 202 struct sk_buff *skb = *skbp;
203 struct ipv6_destopt_hao *hao; 203 struct ipv6_destopt_hao *hao;
204 struct inet6_skb_parm *opt = IP6CB(skb); 204 struct inet6_skb_parm *opt = IP6CB(skb);
205 struct ipv6hdr *ipv6h = skb->nh.ipv6h; 205 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
206 struct in6_addr tmp_addr; 206 struct in6_addr tmp_addr;
207 int ret; 207 int ret;
208 208
@@ -248,7 +248,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
248 *skbp = skb = skb2; 248 *skbp = skb = skb2;
249 hao = (struct ipv6_destopt_hao *)(skb_network_header(skb2) + 249 hao = (struct ipv6_destopt_hao *)(skb_network_header(skb2) +
250 optoff); 250 optoff);
251 ipv6h = skb2->nh.ipv6h; 251 ipv6h = ipv6_hdr(skb2);
252 } 252 }
253 253
254 if (skb->ip_summed == CHECKSUM_COMPLETE) 254 if (skb->ip_summed == CHECKSUM_COMPLETE)
@@ -414,7 +414,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
414 return -1; 414 return -1;
415 } 415 }
416 416
417 if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) || 417 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) ||
418 skb->pkt_type != PACKET_HOST) { 418 skb->pkt_type != PACKET_HOST) {
419 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 419 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
420 IPSTATS_MIB_INADDRERRORS); 420 IPSTATS_MIB_INADDRERRORS);
@@ -522,7 +522,7 @@ looped_back:
522#ifdef CONFIG_IPV6_MIP6 522#ifdef CONFIG_IPV6_MIP6
523 case IPV6_SRCRT_TYPE_2: 523 case IPV6_SRCRT_TYPE_2:
524 if (xfrm6_input_addr(skb, (xfrm_address_t *)addr, 524 if (xfrm6_input_addr(skb, (xfrm_address_t *)addr,
525 (xfrm_address_t *)&skb->nh.ipv6h->saddr, 525 (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
526 IPPROTO_ROUTING) < 0) { 526 IPPROTO_ROUTING) < 0) {
527 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 527 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
528 IPSTATS_MIB_INADDRERRORS); 528 IPSTATS_MIB_INADDRERRORS);
@@ -549,8 +549,8 @@ looped_back:
549 } 549 }
550 550
551 ipv6_addr_copy(&daddr, addr); 551 ipv6_addr_copy(&daddr, addr);
552 ipv6_addr_copy(addr, &skb->nh.ipv6h->daddr); 552 ipv6_addr_copy(addr, &ipv6_hdr(skb)->daddr);
553 ipv6_addr_copy(&skb->nh.ipv6h->daddr, &daddr); 553 ipv6_addr_copy(&ipv6_hdr(skb)->daddr, &daddr);
554 554
555 dst_release(xchg(&skb->dst, NULL)); 555 dst_release(xchg(&skb->dst, NULL));
556 ip6_route_input(skb); 556 ip6_route_input(skb);
@@ -561,7 +561,7 @@ looped_back:
561 } 561 }
562 562
563 if (skb->dst->dev->flags&IFF_LOOPBACK) { 563 if (skb->dst->dev->flags&IFF_LOOPBACK) {
564 if (skb->nh.ipv6h->hop_limit <= 1) { 564 if (ipv6_hdr(skb)->hop_limit <= 1) {
565 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 565 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
566 IPSTATS_MIB_INHDRERRORS); 566 IPSTATS_MIB_INHDRERRORS);
567 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 567 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
@@ -569,7 +569,7 @@ looped_back:
569 kfree_skb(skb); 569 kfree_skb(skb);
570 return -1; 570 return -1;
571 } 571 }
572 skb->nh.ipv6h->hop_limit--; 572 ipv6_hdr(skb)->hop_limit--;
573 goto looped_back; 573 goto looped_back;
574 } 574 }
575 575
@@ -698,7 +698,7 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
698 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); 698 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
699 return 0; 699 return 0;
700 } 700 }
701 if (skb->nh.ipv6h->payload_len) { 701 if (ipv6_hdr(skb)->payload_len) {
702 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); 702 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
703 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); 703 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
704 return 0; 704 return 0;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index e5293b34229f..3a01effda695 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -129,9 +129,9 @@ void icmpv6_param_prob(struct sk_buff *skb, int code, int pos)
129 129
130static int is_ineligible(struct sk_buff *skb) 130static int is_ineligible(struct sk_buff *skb)
131{ 131{
132 int ptr = (u8*)(skb->nh.ipv6h+1) - skb->data; 132 int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
133 int len = skb->len - ptr; 133 int len = skb->len - ptr;
134 __u8 nexthdr = skb->nh.ipv6h->nexthdr; 134 __u8 nexthdr = ipv6_hdr(skb)->nexthdr;
135 135
136 if (len < 0) 136 if (len < 0)
137 return 1; 137 return 1;
@@ -275,7 +275,7 @@ static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, st
275#ifdef CONFIG_IPV6_MIP6 275#ifdef CONFIG_IPV6_MIP6
276static void mip6_addr_swap(struct sk_buff *skb) 276static void mip6_addr_swap(struct sk_buff *skb)
277{ 277{
278 struct ipv6hdr *iph = skb->nh.ipv6h; 278 struct ipv6hdr *iph = ipv6_hdr(skb);
279 struct inet6_skb_parm *opt = IP6CB(skb); 279 struct inet6_skb_parm *opt = IP6CB(skb);
280 struct ipv6_destopt_hao *hao; 280 struct ipv6_destopt_hao *hao;
281 struct in6_addr tmp; 281 struct in6_addr tmp;
@@ -303,7 +303,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
303 struct net_device *dev) 303 struct net_device *dev)
304{ 304{
305 struct inet6_dev *idev = NULL; 305 struct inet6_dev *idev = NULL;
306 struct ipv6hdr *hdr = skb->nh.ipv6h; 306 struct ipv6hdr *hdr = ipv6_hdr(skb);
307 struct sock *sk; 307 struct sock *sk;
308 struct ipv6_pinfo *np; 308 struct ipv6_pinfo *np;
309 struct in6_addr *saddr = NULL; 309 struct in6_addr *saddr = NULL;
@@ -485,7 +485,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
485 int hlimit; 485 int hlimit;
486 int tclass; 486 int tclass;
487 487
488 saddr = &skb->nh.ipv6h->daddr; 488 saddr = &ipv6_hdr(skb)->daddr;
489 489
490 if (!ipv6_unicast_destination(skb)) 490 if (!ipv6_unicast_destination(skb))
491 saddr = NULL; 491 saddr = NULL;
@@ -495,7 +495,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
495 495
496 memset(&fl, 0, sizeof(fl)); 496 memset(&fl, 0, sizeof(fl));
497 fl.proto = IPPROTO_ICMPV6; 497 fl.proto = IPPROTO_ICMPV6;
498 ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); 498 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
499 if (saddr) 499 if (saddr)
500 ipv6_addr_copy(&fl.fl6_src, saddr); 500 ipv6_addr_copy(&fl.fl6_src, saddr);
501 fl.oif = skb->dev->ifindex; 501 fl.oif = skb->dev->ifindex;
@@ -583,8 +583,8 @@ static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info)
583 if (!pskb_may_pull(skb, inner_offset+8)) 583 if (!pskb_may_pull(skb, inner_offset+8))
584 return; 584 return;
585 585
586 saddr = &skb->nh.ipv6h->saddr; 586 saddr = &ipv6_hdr(skb)->saddr;
587 daddr = &skb->nh.ipv6h->daddr; 587 daddr = &ipv6_hdr(skb)->daddr;
588 588
589 /* BUGGG_FUTURE: we should try to parse exthdrs in this packet. 589 /* BUGGG_FUTURE: we should try to parse exthdrs in this packet.
590 Without this we will not able f.e. to make source routed 590 Without this we will not able f.e. to make source routed
@@ -628,8 +628,8 @@ static int icmpv6_rcv(struct sk_buff **pskb)
628 628
629 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS); 629 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS);
630 630
631 saddr = &skb->nh.ipv6h->saddr; 631 saddr = &ipv6_hdr(skb)->saddr;
632 daddr = &skb->nh.ipv6h->daddr; 632 daddr = &ipv6_hdr(skb)->daddr;
633 633
634 /* Perform checksum. */ 634 /* Perform checksum. */
635 switch (skb->ip_summed) { 635 switch (skb->ip_summed) {
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index aecc74da0721..9c3c787a21c1 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -96,7 +96,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
96 if (unlikely(!pskb_may_pull(skb, sizeof(*hdr)))) 96 if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
97 goto err; 97 goto err;
98 98
99 hdr = skb->nh.ipv6h; 99 hdr = ipv6_hdr(skb);
100 100
101 if (hdr->version != 6) 101 if (hdr->version != 6)
102 goto err; 102 goto err;
@@ -116,7 +116,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
116 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); 116 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
117 goto drop; 117 goto drop;
118 } 118 }
119 hdr = skb->nh.ipv6h; 119 hdr = ipv6_hdr(skb);
120 } 120 }
121 121
122 if (hdr->nexthdr == NEXTHDR_HOP) { 122 if (hdr->nexthdr == NEXTHDR_HOP) {
@@ -183,7 +183,7 @@ resubmit:
183 183
184 skb_postpull_rcsum(skb, skb_network_header(skb), 184 skb_postpull_rcsum(skb, skb_network_header(skb),
185 skb->h.raw - skb->nh.raw); 185 skb->h.raw - skb->nh.raw);
186 hdr = skb->nh.ipv6h; 186 hdr = ipv6_hdr(skb);
187 if (ipv6_addr_is_multicast(&hdr->daddr) && 187 if (ipv6_addr_is_multicast(&hdr->daddr) &&
188 !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, 188 !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
189 &hdr->saddr) && 189 &hdr->saddr) &&
@@ -234,7 +234,7 @@ int ip6_mc_input(struct sk_buff *skb)
234 234
235 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); 235 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
236 236
237 hdr = skb->nh.ipv6h; 237 hdr = ipv6_hdr(skb);
238 deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) || 238 deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
239 ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); 239 ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
240 240
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));
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index bb65779be7a6..05b59a77bc69 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -602,7 +602,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
602 skb_reset_network_header(skb2); 602 skb_reset_network_header(skb2);
603 603
604 /* Try to guess incoming interface */ 604 /* Try to guess incoming interface */
605 rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0); 605 rt = rt6_lookup(&ipv6_hdr(skb2)->saddr, NULL, 0, 0);
606 606
607 if (rt && rt->rt6i_dev) 607 if (rt && rt->rt6i_dev)
608 skb2->dev = rt->rt6i_dev; 608 skb2->dev = rt->rt6i_dev;
@@ -636,10 +636,10 @@ static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
636 struct sk_buff *skb) 636 struct sk_buff *skb)
637{ 637{
638 if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) 638 if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
639 ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); 639 ipv6_copy_dscp(ipv6h, ipv6_hdr(skb));
640 640
641 if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h))) 641 if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
642 IP6_ECN_set_ce(skb->nh.ipv6h); 642 IP6_ECN_set_ce(ipv6_hdr(skb));
643} 643}
644 644
645static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t) 645static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
@@ -679,10 +679,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
679 struct ipv6hdr *ipv6h, 679 struct ipv6hdr *ipv6h,
680 struct sk_buff *skb)) 680 struct sk_buff *skb))
681{ 681{
682 struct ipv6hdr *ipv6h;
683 struct ip6_tnl *t; 682 struct ip6_tnl *t;
684 683 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
685 ipv6h = skb->nh.ipv6h;
686 684
687 read_lock(&ip6_tnl_lock); 685 read_lock(&ip6_tnl_lock);
688 686
@@ -836,7 +834,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
836{ 834{
837 struct ip6_tnl *t = netdev_priv(dev); 835 struct ip6_tnl *t = netdev_priv(dev);
838 struct net_device_stats *stats = &t->stat; 836 struct net_device_stats *stats = &t->stat;
839 struct ipv6hdr *ipv6h = skb->nh.ipv6h; 837 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
840 struct ipv6_tel_txoption opt; 838 struct ipv6_tel_txoption opt;
841 struct dst_entry *dst; 839 struct dst_entry *dst;
842 struct net_device *tdev; 840 struct net_device *tdev;
@@ -909,7 +907,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
909 } 907 }
910 skb_push(skb, sizeof(struct ipv6hdr)); 908 skb_push(skb, sizeof(struct ipv6hdr));
911 skb_reset_network_header(skb); 909 skb_reset_network_header(skb);
912 ipv6h = skb->nh.ipv6h; 910 ipv6h = ipv6_hdr(skb);
913 *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000); 911 *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
914 dsfield = INET_ECN_encapsulate(0, dsfield); 912 dsfield = INET_ECN_encapsulate(0, dsfield);
915 ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); 913 ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
@@ -983,7 +981,7 @@ static inline int
983ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 981ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
984{ 982{
985 struct ip6_tnl *t = netdev_priv(dev); 983 struct ip6_tnl *t = netdev_priv(dev);
986 struct ipv6hdr *ipv6h = skb->nh.ipv6h; 984 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
987 int encap_limit = -1; 985 int encap_limit = -1;
988 __u16 offset; 986 __u16 offset;
989 struct flowi fl; 987 struct flowi fl;
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 3e71d1691b7d..e2404a629680 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -79,7 +79,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
79 skb->ip_summed = CHECKSUM_NONE; 79 skb->ip_summed = CHECKSUM_NONE;
80 80
81 /* Remove ipcomp header and decompress original payload */ 81 /* Remove ipcomp header and decompress original payload */
82 iph = skb->nh.ipv6h; 82 iph = ipv6_hdr(skb);
83 ipch = (void *)skb->data; 83 ipch = (void *)skb->data;
84 skb->h.raw = skb->nh.raw + sizeof(*ipch); 84 skb->h.raw = skb->nh.raw + sizeof(*ipch);
85 __skb_pull(skb, sizeof(*ipch)); 85 __skb_pull(skb, sizeof(*ipch));
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 1d56b465bddb..d16e0fd2cd89 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -101,7 +101,7 @@ static int ipv6_gso_send_check(struct sk_buff *skb)
101 if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) 101 if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
102 goto out; 102 goto out;
103 103
104 ipv6h = skb->nh.ipv6h; 104 ipv6h = ipv6_hdr(skb);
105 __skb_pull(skb, sizeof(*ipv6h)); 105 __skb_pull(skb, sizeof(*ipv6h));
106 err = -EPROTONOSUPPORT; 106 err = -EPROTONOSUPPORT;
107 107
@@ -137,7 +137,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
137 if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) 137 if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
138 goto out; 138 goto out;
139 139
140 ipv6h = skb->nh.ipv6h; 140 ipv6h = ipv6_hdr(skb);
141 __skb_pull(skb, sizeof(*ipv6h)); 141 __skb_pull(skb, sizeof(*ipv6h));
142 segs = ERR_PTR(-EPROTONOSUPPORT); 142 segs = ERR_PTR(-EPROTONOSUPPORT);
143 143
@@ -153,7 +153,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
153 goto out; 153 goto out;
154 154
155 for (skb = segs; skb; skb = skb->next) { 155 for (skb = segs; skb; skb = skb->next) {
156 ipv6h = skb->nh.ipv6h; 156 ipv6h = ipv6_hdr(skb);
157 ipv6h->payload_len = htons(skb->len - skb->mac_len - 157 ipv6h->payload_len = htons(skb->len - skb->mac_len -
158 sizeof(*ipv6h)); 158 sizeof(*ipv6h));
159 } 159 }
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 924e24907c3e..b2b37ba48b9c 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1167,11 +1167,11 @@ int igmp6_event_query(struct sk_buff *skb)
1167 return -EINVAL; 1167 return -EINVAL;
1168 1168
1169 /* compute payload length excluding extension headers */ 1169 /* compute payload length excluding extension headers */
1170 len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); 1170 len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr);
1171 len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; 1171 len -= skb->h.raw - skb->nh.raw;
1172 1172
1173 /* Drop queries with not link local source */ 1173 /* Drop queries with not link local source */
1174 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL)) 1174 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL))
1175 return -EINVAL; 1175 return -EINVAL;
1176 1176
1177 idev = in6_dev_get(skb->dev); 1177 idev = in6_dev_get(skb->dev);
@@ -1303,7 +1303,7 @@ int igmp6_event_report(struct sk_buff *skb)
1303 hdr = (struct icmp6hdr*) skb->h.raw; 1303 hdr = (struct icmp6hdr*) skb->h.raw;
1304 1304
1305 /* Drop reports with not link local source */ 1305 /* Drop reports with not link local source */
1306 addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr); 1306 addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
1307 if (addr_type != IPV6_ADDR_ANY && 1307 if (addr_type != IPV6_ADDR_ANY &&
1308 !(addr_type&IPV6_ADDR_LINKLOCAL)) 1308 !(addr_type&IPV6_ADDR_LINKLOCAL))
1309 return -EINVAL; 1309 return -EINVAL;
@@ -1441,7 +1441,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
1441 unsigned char ha[MAX_ADDR_LEN]; 1441 unsigned char ha[MAX_ADDR_LEN];
1442 int err; 1442 int err;
1443 1443
1444 ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1); 1444 ndisc_mc_map(&ipv6_hdr(skb)->daddr, ha, dev, 1);
1445 err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len); 1445 err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
1446 if (err < 0) { 1446 if (err < 0) {
1447 kfree_skb(skb); 1447 kfree_skb(skb);
@@ -1459,15 +1459,14 @@ static inline int mld_dev_queue_xmit(struct sk_buff *skb)
1459 1459
1460static void mld_sendpack(struct sk_buff *skb) 1460static void mld_sendpack(struct sk_buff *skb)
1461{ 1461{
1462 struct ipv6hdr *pip6 = skb->nh.ipv6h; 1462 struct ipv6hdr *pip6 = ipv6_hdr(skb);
1463 struct mld2_report *pmr = (struct mld2_report *)skb->h.raw; 1463 struct mld2_report *pmr = (struct mld2_report *)skb->h.raw;
1464 int payload_len, mldlen; 1464 int payload_len, mldlen;
1465 struct inet6_dev *idev = in6_dev_get(skb->dev); 1465 struct inet6_dev *idev = in6_dev_get(skb->dev);
1466 int err; 1466 int err;
1467 1467
1468 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); 1468 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
1469 payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h - 1469 payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6);
1470 sizeof(struct ipv6hdr);
1471 mldlen = skb->tail - skb->h.raw; 1470 mldlen = skb->tail - skb->h.raw;
1472 pip6->payload_len = htons(payload_len); 1471 pip6->payload_len = htons(payload_len);
1473 1472
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index bb4033553f3b..7b5f9d82e801 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -129,7 +129,7 @@ static struct mip6_report_rate_limiter mip6_report_rl = {
129 129
130static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb) 130static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
131{ 131{
132 struct ipv6hdr *iph = skb->nh.ipv6h; 132 struct ipv6hdr *iph = ipv6_hdr(skb);
133 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; 133 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
134 134
135 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) && 135 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
@@ -223,16 +223,16 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
223 223
224 skb_get_timestamp(skb, &stamp); 224 skb_get_timestamp(skb, &stamp);
225 225
226 if (!mip6_report_rl_allow(&stamp, &skb->nh.ipv6h->daddr, 226 if (!mip6_report_rl_allow(&stamp, &ipv6_hdr(skb)->daddr,
227 hao ? &hao->addr : &skb->nh.ipv6h->saddr, 227 hao ? &hao->addr : &ipv6_hdr(skb)->saddr,
228 opt->iif)) 228 opt->iif))
229 goto out; 229 goto out;
230 230
231 memset(&sel, 0, sizeof(sel)); 231 memset(&sel, 0, sizeof(sel));
232 memcpy(&sel.daddr, (xfrm_address_t *)&skb->nh.ipv6h->daddr, 232 memcpy(&sel.daddr, (xfrm_address_t *)&ipv6_hdr(skb)->daddr,
233 sizeof(sel.daddr)); 233 sizeof(sel.daddr));
234 sel.prefixlen_d = 128; 234 sel.prefixlen_d = 128;
235 memcpy(&sel.saddr, (xfrm_address_t *)&skb->nh.ipv6h->saddr, 235 memcpy(&sel.saddr, (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
236 sizeof(sel.saddr)); 236 sizeof(sel.saddr));
237 sel.prefixlen_s = 128; 237 sel.prefixlen_s = 128;
238 sel.family = AF_INET6; 238 sel.family = AF_INET6;
@@ -256,12 +256,13 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb,
256 u8 **nexthdr) 256 u8 **nexthdr)
257{ 257{
258 u16 offset = sizeof(struct ipv6hdr); 258 u16 offset = sizeof(struct ipv6hdr);
259 struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1); 259 struct ipv6_opt_hdr *exthdr =
260 (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
260 const unsigned char *nh = skb_network_header(skb); 261 const unsigned char *nh = skb_network_header(skb);
261 unsigned int packet_len = skb->tail - nh; 262 unsigned int packet_len = skb->tail - nh;
262 int found_rhdr = 0; 263 int found_rhdr = 0;
263 264
264 *nexthdr = &skb->nh.ipv6h->nexthdr; 265 *nexthdr = &ipv6_hdr(skb)->nexthdr;
265 266
266 while (offset + 1 <= packet_len) { 267 while (offset + 1 <= packet_len) {
267 268
@@ -387,12 +388,13 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb,
387 u8 **nexthdr) 388 u8 **nexthdr)
388{ 389{
389 u16 offset = sizeof(struct ipv6hdr); 390 u16 offset = sizeof(struct ipv6hdr);
390 struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1); 391 struct ipv6_opt_hdr *exthdr =
392 (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
391 const unsigned char *nh = skb_network_header(skb); 393 const unsigned char *nh = skb_network_header(skb);
392 unsigned int packet_len = skb->tail - nh; 394 unsigned int packet_len = skb->tail - nh;
393 int found_rhdr = 0; 395 int found_rhdr = 0;
394 396
395 *nexthdr = &skb->nh.ipv6h->nexthdr; 397 *nexthdr = &ipv6_hdr(skb)->nexthdr;
396 398
397 while (offset + 1 <= packet_len) { 399 while (offset + 1 <= packet_len) {
398 400
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index a3e3d9e2f44b..00feb4c4d98b 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -598,7 +598,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
598 dev->addr_len, dev->type); 598 dev->addr_len, dev->type);
599 599
600 /* checksum */ 600 /* checksum */
601 msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, 601 msg->icmph.icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
602 daddr, len, 602 daddr, len,
603 IPPROTO_ICMPV6, 603 IPPROTO_ICMPV6,
604 csum_partial((__u8 *) msg, 604 csum_partial((__u8 *) msg,
@@ -697,7 +697,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
697 dev->addr_len, dev->type); 697 dev->addr_len, dev->type);
698 698
699 /* checksum */ 699 /* checksum */
700 hdr->icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, daddr, len, 700 hdr->icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr, daddr, len,
701 IPPROTO_ICMPV6, 701 IPPROTO_ICMPV6,
702 csum_partial((__u8 *) hdr, len, 0)); 702 csum_partial((__u8 *) hdr, len, 0));
703 703
@@ -736,8 +736,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
736 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; 736 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
737 int probes = atomic_read(&neigh->probes); 737 int probes = atomic_read(&neigh->probes);
738 738
739 if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev, 1)) 739 if (skb && ipv6_chk_addr(&ipv6_hdr(skb)->saddr, dev, 1))
740 saddr = &skb->nh.ipv6h->saddr; 740 saddr = &ipv6_hdr(skb)->saddr;
741 741
742 if ((probes -= neigh->parms->ucast_probes) < 0) { 742 if ((probes -= neigh->parms->ucast_probes) < 0) {
743 if (!(neigh->nud_state & NUD_VALID)) { 743 if (!(neigh->nud_state & NUD_VALID)) {
@@ -761,8 +761,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
761static void ndisc_recv_ns(struct sk_buff *skb) 761static void ndisc_recv_ns(struct sk_buff *skb)
762{ 762{
763 struct nd_msg *msg = (struct nd_msg *)skb->h.raw; 763 struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
764 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 764 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
765 struct in6_addr *daddr = &skb->nh.ipv6h->daddr; 765 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
766 u8 *lladdr = NULL; 766 u8 *lladdr = NULL;
767 u32 ndoptlen = skb->tail - msg->opt; 767 u32 ndoptlen = skb->tail - msg->opt;
768 struct ndisc_options ndopts; 768 struct ndisc_options ndopts;
@@ -939,8 +939,8 @@ out:
939static void ndisc_recv_na(struct sk_buff *skb) 939static void ndisc_recv_na(struct sk_buff *skb)
940{ 940{
941 struct nd_msg *msg = (struct nd_msg *)skb->h.raw; 941 struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
942 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 942 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
943 struct in6_addr *daddr = &skb->nh.ipv6h->daddr; 943 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
944 u8 *lladdr = NULL; 944 u8 *lladdr = NULL;
945 u32 ndoptlen = skb->tail - msg->opt; 945 u32 ndoptlen = skb->tail - msg->opt;
946 struct ndisc_options ndopts; 946 struct ndisc_options ndopts;
@@ -1044,7 +1044,7 @@ static void ndisc_recv_rs(struct sk_buff *skb)
1044 unsigned long ndoptlen = skb->len - sizeof(*rs_msg); 1044 unsigned long ndoptlen = skb->len - sizeof(*rs_msg);
1045 struct neighbour *neigh; 1045 struct neighbour *neigh;
1046 struct inet6_dev *idev; 1046 struct inet6_dev *idev;
1047 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 1047 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
1048 struct ndisc_options ndopts; 1048 struct ndisc_options ndopts;
1049 u8 *lladdr = NULL; 1049 u8 *lladdr = NULL;
1050 1050
@@ -1110,7 +1110,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1110 1110
1111 optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg); 1111 optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg);
1112 1112
1113 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) { 1113 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
1114 ND_PRINTK2(KERN_WARNING 1114 ND_PRINTK2(KERN_WARNING
1115 "ICMPv6 RA: source address is not link-local.\n"); 1115 "ICMPv6 RA: source address is not link-local.\n");
1116 return; 1116 return;
@@ -1176,7 +1176,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1176 pref = ICMPV6_ROUTER_PREF_MEDIUM; 1176 pref = ICMPV6_ROUTER_PREF_MEDIUM;
1177#endif 1177#endif
1178 1178
1179 rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev); 1179 rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
1180 1180
1181 if (rt) 1181 if (rt)
1182 neigh = rt->rt6i_nexthop; 1182 neigh = rt->rt6i_nexthop;
@@ -1191,7 +1191,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1191 ND_PRINTK3(KERN_DEBUG 1191 ND_PRINTK3(KERN_DEBUG
1192 "ICMPv6 RA: adding default router.\n"); 1192 "ICMPv6 RA: adding default router.\n");
1193 1193
1194 rt = rt6_add_dflt_router(&skb->nh.ipv6h->saddr, skb->dev, pref); 1194 rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
1195 if (rt == NULL) { 1195 if (rt == NULL) {
1196 ND_PRINTK0(KERN_ERR 1196 ND_PRINTK0(KERN_ERR
1197 "ICMPv6 RA: %s() failed to add default route.\n", 1197 "ICMPv6 RA: %s() failed to add default route.\n",
@@ -1263,7 +1263,7 @@ skip_defrtr:
1263 */ 1263 */
1264 1264
1265 if (!neigh) 1265 if (!neigh)
1266 neigh = __neigh_lookup(&nd_tbl, &skb->nh.ipv6h->saddr, 1266 neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
1267 skb->dev, 1); 1267 skb->dev, 1);
1268 if (neigh) { 1268 if (neigh) {
1269 u8 *lladdr = NULL; 1269 u8 *lladdr = NULL;
@@ -1292,7 +1292,7 @@ skip_defrtr:
1292 if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) 1292 if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
1293 continue; 1293 continue;
1294 rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, 1294 rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
1295 &skb->nh.ipv6h->saddr); 1295 &ipv6_hdr(skb)->saddr);
1296 } 1296 }
1297 } 1297 }
1298#endif 1298#endif
@@ -1351,7 +1351,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1351 int optlen; 1351 int optlen;
1352 u8 *lladdr = NULL; 1352 u8 *lladdr = NULL;
1353 1353
1354 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) { 1354 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
1355 ND_PRINTK2(KERN_WARNING 1355 ND_PRINTK2(KERN_WARNING
1356 "ICMPv6 Redirect: source address is not link-local.\n"); 1356 "ICMPv6 Redirect: source address is not link-local.\n");
1357 return; 1357 return;
@@ -1416,8 +1416,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1416 1416
1417 neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1); 1417 neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1);
1418 if (neigh) { 1418 if (neigh) {
1419 rt6_redirect(dest, &skb->nh.ipv6h->daddr, 1419 rt6_redirect(dest, &ipv6_hdr(skb)->daddr,
1420 &skb->nh.ipv6h->saddr, neigh, lladdr, 1420 &ipv6_hdr(skb)->saddr, neigh, lladdr,
1421 on_link); 1421 on_link);
1422 neigh_release(neigh); 1422 neigh_release(neigh);
1423 } 1423 }
@@ -1453,14 +1453,14 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1453 return; 1453 return;
1454 } 1454 }
1455 1455
1456 if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) && 1456 if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
1457 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { 1457 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
1458 ND_PRINTK2(KERN_WARNING 1458 ND_PRINTK2(KERN_WARNING
1459 "ICMPv6 Redirect: target address is not link-local.\n"); 1459 "ICMPv6 Redirect: target address is not link-local.\n");
1460 return; 1460 return;
1461 } 1461 }
1462 1462
1463 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr, 1463 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &ipv6_hdr(skb)->saddr,
1464 dev->ifindex); 1464 dev->ifindex);
1465 1465
1466 dst = ip6_route_output(NULL, &fl); 1466 dst = ip6_route_output(NULL, &fl);
@@ -1515,7 +1515,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1515 hlen = 0; 1515 hlen = 0;
1516 1516
1517 skb_reserve(buff, LL_RESERVED_SPACE(dev)); 1517 skb_reserve(buff, LL_RESERVED_SPACE(dev));
1518 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr, 1518 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
1519 IPPROTO_ICMPV6, len); 1519 IPPROTO_ICMPV6, len);
1520 1520
1521 icmph = (struct icmp6hdr *)skb_put(buff, len); 1521 icmph = (struct icmp6hdr *)skb_put(buff, len);
@@ -1531,7 +1531,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1531 addrp = (struct in6_addr *)(icmph + 1); 1531 addrp = (struct in6_addr *)(icmph + 1);
1532 ipv6_addr_copy(addrp, target); 1532 ipv6_addr_copy(addrp, target);
1533 addrp++; 1533 addrp++;
1534 ipv6_addr_copy(addrp, &skb->nh.ipv6h->daddr); 1534 ipv6_addr_copy(addrp, &ipv6_hdr(skb)->daddr);
1535 1535
1536 opt = (u8*) (addrp + 1); 1536 opt = (u8*) (addrp + 1);
1537 1537
@@ -1552,9 +1552,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1552 *(opt++) = (rd_len >> 3); 1552 *(opt++) = (rd_len >> 3);
1553 opt += 6; 1553 opt += 6;
1554 1554
1555 memcpy(opt, skb->nh.ipv6h, rd_len - 8); 1555 memcpy(opt, ipv6_hdr(skb), rd_len - 8);
1556 1556
1557 icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &skb->nh.ipv6h->saddr, 1557 icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
1558 len, IPPROTO_ICMPV6, 1558 len, IPPROTO_ICMPV6,
1559 csum_partial((u8 *) icmph, len, 0)); 1559 csum_partial((u8 *) icmph, len, 0));
1560 1560
@@ -1588,10 +1588,10 @@ int ndisc_rcv(struct sk_buff *skb)
1588 1588
1589 __skb_push(skb, skb->data-skb->h.raw); 1589 __skb_push(skb, skb->data-skb->h.raw);
1590 1590
1591 if (skb->nh.ipv6h->hop_limit != 255) { 1591 if (ipv6_hdr(skb)->hop_limit != 255) {
1592 ND_PRINTK2(KERN_WARNING 1592 ND_PRINTK2(KERN_WARNING
1593 "ICMPv6 NDISC: invalid hop-limit: %d\n", 1593 "ICMPv6 NDISC: invalid hop-limit: %d\n",
1594 skb->nh.ipv6h->hop_limit); 1594 ipv6_hdr(skb)->hop_limit);
1595 return 0; 1595 return 0;
1596 } 1596 }
1597 1597
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 1c405dd30c67..38b149613915 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -11,7 +11,7 @@
11 11
12int ip6_route_me_harder(struct sk_buff *skb) 12int ip6_route_me_harder(struct sk_buff *skb)
13{ 13{
14 struct ipv6hdr *iph = skb->nh.ipv6h; 14 struct ipv6hdr *iph = ipv6_hdr(skb);
15 struct dst_entry *dst; 15 struct dst_entry *dst;
16 struct flowi fl = { 16 struct flowi fl = {
17 .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, 17 .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
@@ -61,7 +61,7 @@ static void nf_ip6_saveroute(const struct sk_buff *skb, struct nf_info *info)
61 struct ip6_rt_info *rt_info = nf_info_reroute(info); 61 struct ip6_rt_info *rt_info = nf_info_reroute(info);
62 62
63 if (info->hook == NF_IP6_LOCAL_OUT) { 63 if (info->hook == NF_IP6_LOCAL_OUT) {
64 struct ipv6hdr *iph = skb->nh.ipv6h; 64 struct ipv6hdr *iph = ipv6_hdr(skb);
65 65
66 rt_info->daddr = iph->daddr; 66 rt_info->daddr = iph->daddr;
67 rt_info->saddr = iph->saddr; 67 rt_info->saddr = iph->saddr;
@@ -73,7 +73,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
73 struct ip6_rt_info *rt_info = nf_info_reroute(info); 73 struct ip6_rt_info *rt_info = nf_info_reroute(info);
74 74
75 if (info->hook == NF_IP6_LOCAL_OUT) { 75 if (info->hook == NF_IP6_LOCAL_OUT) {
76 struct ipv6hdr *iph = (*pskb)->nh.ipv6h; 76 struct ipv6hdr *iph = ipv6_hdr(*pskb);
77 if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || 77 if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
78 !ipv6_addr_equal(&iph->saddr, &rt_info->saddr)) 78 !ipv6_addr_equal(&iph->saddr, &rt_info->saddr))
79 return ip6_route_me_harder(*pskb); 79 return ip6_route_me_harder(*pskb);
@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
84__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 84__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
85 unsigned int dataoff, u_int8_t protocol) 85 unsigned int dataoff, u_int8_t protocol)
86{ 86{
87 struct ipv6hdr *ip6h = skb->nh.ipv6h; 87 struct ipv6hdr *ip6h = ipv6_hdr(skb);
88 __sum16 csum = 0; 88 __sum16 csum = 0;
89 89
90 switch (skb->ip_summed) { 90 switch (skb->ip_summed) {
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7c512e13f956..caf9e375a0f1 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -115,7 +115,7 @@ ip6_packet_match(const struct sk_buff *skb,
115{ 115{
116 size_t i; 116 size_t i;
117 unsigned long ret; 117 unsigned long ret;
118 const struct ipv6hdr *ipv6 = skb->nh.ipv6h; 118 const struct ipv6hdr *ipv6 = ipv6_hdr(skb);
119 119
120#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg)) 120#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg))
121 121
@@ -301,7 +301,7 @@ ip6t_do_table(struct sk_buff **pskb,
301 goto no_match; 301 goto no_match;
302 302
303 ADD_COUNTER(e->counters, 303 ADD_COUNTER(e->counters,
304 ntohs((*pskb)->nh.ipv6h->payload_len) 304 ntohs(ipv6_hdr(*pskb)->payload_len)
305 + IPV6_HDR_LEN, 305 + IPV6_HDR_LEN,
306 1); 306 1);
307 307
@@ -1448,8 +1448,8 @@ static void __exit ip6_tables_fini(void)
1448int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 1448int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
1449 int target, unsigned short *fragoff) 1449 int target, unsigned short *fragoff)
1450{ 1450{
1451 unsigned int start = (u8*)(skb->nh.ipv6h + 1) - skb->data; 1451 unsigned int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
1452 u8 nexthdr = skb->nh.ipv6h->nexthdr; 1452 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
1453 unsigned int len = skb->len - start; 1453 unsigned int len = skb->len - start;
1454 1454
1455 if (fragoff) 1455 if (fragoff)
diff --git a/net/ipv6/netfilter/ip6t_HL.c b/net/ipv6/netfilter/ip6t_HL.c
index ccbab66277e3..4115a576ba25 100644
--- a/net/ipv6/netfilter/ip6t_HL.c
+++ b/net/ipv6/netfilter/ip6t_HL.c
@@ -32,7 +32,7 @@ static unsigned int ip6t_hl_target(struct sk_buff **pskb,
32 if (!skb_make_writable(pskb, (*pskb)->len)) 32 if (!skb_make_writable(pskb, (*pskb)->len))
33 return NF_DROP; 33 return NF_DROP;
34 34
35 ip6h = (*pskb)->nh.ipv6h; 35 ip6h = ipv6_hdr(*pskb);
36 36
37 switch (info->mode) { 37 switch (info->mode) {
38 case IP6T_HL_SET: 38 case IP6T_HL_SET:
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index fc9e51a77784..54d176187f3f 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -422,7 +422,7 @@ ip6t_log_packet(unsigned int pf,
422 printk(" "); 422 printk(" ");
423 } 423 }
424 424
425 dump_packet(loginfo, skb, (u8*)skb->nh.ipv6h - skb->data, 1); 425 dump_packet(loginfo, skb, skb_network_offset(skb), 1);
426 printk("\n"); 426 printk("\n");
427 spin_unlock_bh(&log_lock); 427 spin_unlock_bh(&log_lock);
428} 428}
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 4441bed430f8..cb3d2415a064 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -47,7 +47,7 @@ static void send_reset(struct sk_buff *oldskb)
47 struct tcphdr otcph, *tcph; 47 struct tcphdr otcph, *tcph;
48 unsigned int otcplen, hh_len; 48 unsigned int otcplen, hh_len;
49 int tcphoff, needs_ack; 49 int tcphoff, needs_ack;
50 struct ipv6hdr *oip6h = oldskb->nh.ipv6h, *ip6h; 50 struct ipv6hdr *oip6h = ipv6_hdr(oldskb), *ip6h;
51 struct dst_entry *dst = NULL; 51 struct dst_entry *dst = NULL;
52 u8 proto; 52 u8 proto;
53 struct flowi fl; 53 struct flowi fl;
@@ -122,7 +122,7 @@ static void send_reset(struct sk_buff *oldskb)
122 122
123 skb_put(nskb, sizeof(struct ipv6hdr)); 123 skb_put(nskb, sizeof(struct ipv6hdr));
124 skb_reset_network_header(nskb); 124 skb_reset_network_header(nskb);
125 ip6h = nskb->nh.ipv6h; 125 ip6h = ipv6_hdr(nskb);
126 ip6h->version = 6; 126 ip6h->version = 6;
127 ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT); 127 ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT);
128 ip6h->nexthdr = IPPROTO_TCP; 128 ip6h->nexthdr = IPPROTO_TCP;
@@ -156,8 +156,8 @@ static void send_reset(struct sk_buff *oldskb)
156 tcph->check = 0; 156 tcph->check = 0;
157 157
158 /* Adjust TCP checksum */ 158 /* Adjust TCP checksum */
159 tcph->check = csum_ipv6_magic(&nskb->nh.ipv6h->saddr, 159 tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
160 &nskb->nh.ipv6h->daddr, 160 &ipv6_hdr(nskb)->daddr,
161 sizeof(struct tcphdr), IPPROTO_TCP, 161 sizeof(struct tcphdr), IPPROTO_TCP,
162 csum_partial((char *)tcph, 162 csum_partial((char *)tcph,
163 sizeof(struct tcphdr), 0)); 163 sizeof(struct tcphdr), 0));
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c
index c2676066a80f..0f3dd932f0a6 100644
--- a/net/ipv6/netfilter/ip6t_eui64.c
+++ b/net/ipv6/netfilter/ip6t_eui64.c
@@ -42,7 +42,7 @@ match(const struct sk_buff *skb,
42 memset(eui64, 0, sizeof(eui64)); 42 memset(eui64, 0, sizeof(eui64));
43 43
44 if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) { 44 if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {
45 if (skb->nh.ipv6h->version == 0x6) { 45 if (ipv6_hdr(skb)->version == 0x6) {
46 memcpy(eui64, eth_hdr(skb)->h_source, 3); 46 memcpy(eui64, eth_hdr(skb)->h_source, 3);
47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); 47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
48 eui64[3] = 0xff; 48 eui64[3] = 0xff;
@@ -50,7 +50,7 @@ match(const struct sk_buff *skb,
50 eui64[0] |= 0x02; 50 eui64[0] |= 0x02;
51 51
52 i = 0; 52 i = 0;
53 while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == eui64[i]) 53 while ((ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i])
54 && (i < 8)) 54 && (i < 8))
55 i++; 55 i++;
56 56
diff --git a/net/ipv6/netfilter/ip6t_hl.c b/net/ipv6/netfilter/ip6t_hl.c
index 37c8a4d4ed78..d606c0e6d6fd 100644
--- a/net/ipv6/netfilter/ip6t_hl.c
+++ b/net/ipv6/netfilter/ip6t_hl.c
@@ -25,7 +25,7 @@ static int match(const struct sk_buff *skb,
25 int offset, unsigned int protoff, int *hotdrop) 25 int offset, unsigned int protoff, int *hotdrop)
26{ 26{
27 const struct ip6t_hl_info *info = matchinfo; 27 const struct ip6t_hl_info *info = matchinfo;
28 const struct ipv6hdr *ip6h = skb->nh.ipv6h; 28 const struct ipv6hdr *ip6h = ipv6_hdr(skb);
29 29
30 switch (info->mode) { 30 switch (info->mode) {
31 case IP6T_HL_EQ: 31 case IP6T_HL_EQ:
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c
index 700a11d25deb..fd6a0869099b 100644
--- a/net/ipv6/netfilter/ip6t_ipv6header.c
+++ b/net/ipv6/netfilter/ip6t_ipv6header.c
@@ -45,7 +45,7 @@ ipv6header_match(const struct sk_buff *skb,
45 /* Make sure this isn't an evil packet */ 45 /* Make sure this isn't an evil packet */
46 46
47 /* type of the 1st exthdr */ 47 /* type of the 1st exthdr */
48 nexthdr = skb->nh.ipv6h->nexthdr; 48 nexthdr = ipv6_hdr(skb)->nexthdr;
49 /* pointer to the 1st exthdr */ 49 /* pointer to the 1st exthdr */
50 ptr = sizeof(struct ipv6hdr); 50 ptr = sizeof(struct ipv6hdr);
51 /* available length */ 51 /* available length */
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index da2c1994539b..85b1c272946c 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -146,21 +146,21 @@ ip6t_local_hook(unsigned int hook,
146#endif 146#endif
147 147
148 /* save source/dest address, mark, hoplimit, flowlabel, priority, */ 148 /* save source/dest address, mark, hoplimit, flowlabel, priority, */
149 memcpy(&saddr, &(*pskb)->nh.ipv6h->saddr, sizeof(saddr)); 149 memcpy(&saddr, &ipv6_hdr(*pskb)->saddr, sizeof(saddr));
150 memcpy(&daddr, &(*pskb)->nh.ipv6h->daddr, sizeof(daddr)); 150 memcpy(&daddr, &ipv6_hdr(*pskb)->daddr, sizeof(daddr));
151 mark = (*pskb)->mark; 151 mark = (*pskb)->mark;
152 hop_limit = (*pskb)->nh.ipv6h->hop_limit; 152 hop_limit = ipv6_hdr(*pskb)->hop_limit;
153 153
154 /* flowlabel and prio (includes version, which shouldn't change either */ 154 /* flowlabel and prio (includes version, which shouldn't change either */
155 flowlabel = *((u_int32_t *) (*pskb)->nh.ipv6h); 155 flowlabel = *((u_int32_t *)ipv6_hdr(*pskb));
156 156
157 ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler); 157 ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
158 158
159 if (ret != NF_DROP && ret != NF_STOLEN 159 if (ret != NF_DROP && ret != NF_STOLEN
160 && (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr)) 160 && (memcmp(&ipv6_hdr(*pskb)->saddr, &saddr, sizeof(saddr))
161 || memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr)) 161 || memcmp(&ipv6_hdr(*pskb)->daddr, &daddr, sizeof(daddr))
162 || (*pskb)->mark != mark 162 || (*pskb)->mark != mark
163 || (*pskb)->nh.ipv6h->hop_limit != hop_limit)) 163 || ipv6_hdr(*pskb)->hop_limit != hop_limit))
164 return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP; 164 return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP;
165 165
166 return ret; 166 return ret;
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index d1102455668d..fe7f46c4dbff 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -138,16 +138,10 @@ static int
138ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff, 138ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,
139 u_int8_t *protonum) 139 u_int8_t *protonum)
140{ 140{
141 unsigned int extoff; 141 unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
142 unsigned char pnum; 142 unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
143 int protoff; 143 int protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
144 144 (*pskb)->len - extoff);
145 extoff = (u8*)((*pskb)->nh.ipv6h + 1) - (*pskb)->data;
146 pnum = (*pskb)->nh.ipv6h->nexthdr;
147
148 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
149 (*pskb)->len - extoff);
150
151 /* 145 /*
152 * (protoff == (*pskb)->len) mean that the packet doesn't have no data 146 * (protoff == (*pskb)->len) mean that the packet doesn't have no data
153 * except of IPv6 & ext headers. but it's tracked anyway. - YK 147 * except of IPv6 & ext headers. but it's tracked anyway. - YK
@@ -179,9 +173,8 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
179 struct nf_conn_help *help; 173 struct nf_conn_help *help;
180 enum ip_conntrack_info ctinfo; 174 enum ip_conntrack_info ctinfo;
181 unsigned int ret, protoff; 175 unsigned int ret, protoff;
182 unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1) 176 unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
183 - (*pskb)->data; 177 unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
184 unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
185 178
186 179
187 /* This is where we call the helper: as the packet goes out. */ 180 /* This is where we call the helper: as the packet goes out. */
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index bc1d09584008..d3fbb1f1caf5 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -400,8 +400,8 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
400 } 400 }
401 401
402 offset = ntohs(fhdr->frag_off) & ~0x7; 402 offset = ntohs(fhdr->frag_off) & ~0x7;
403 end = offset + (ntohs(skb->nh.ipv6h->payload_len) - 403 end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
404 ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1))); 404 ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
405 405
406 if ((unsigned int)end > IPV6_MAXPLEN) { 406 if ((unsigned int)end > IPV6_MAXPLEN) {
407 DEBUGP("offset is too large.\n"); 407 DEBUGP("offset is too large.\n");
@@ -652,7 +652,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
652 head->next = NULL; 652 head->next = NULL;
653 head->dev = dev; 653 head->dev = dev;
654 head->tstamp = fq->stamp; 654 head->tstamp = fq->stamp;
655 head->nh.ipv6h->payload_len = htons(payload_len); 655 ipv6_hdr(head)->payload_len = htons(payload_len);
656 656
657 /* Yes, and fold redundant checksum back. 8) */ 657 /* Yes, and fold redundant checksum back. 8) */
658 if (head->ip_summed == CHECKSUM_COMPLETE) 658 if (head->ip_summed == CHECKSUM_COMPLETE)
@@ -706,9 +706,9 @@ out_fail:
706static int 706static int
707find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) 707find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
708{ 708{
709 u8 nexthdr = skb->nh.ipv6h->nexthdr; 709 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
710 u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data; 710 u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data;
711 int start = (u8 *)(skb->nh.ipv6h+1) - skb->data; 711 int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
712 int len = skb->len - start; 712 int len = skb->len - start;
713 u8 prevhdr = NEXTHDR_IPV6; 713 u8 prevhdr = NEXTHDR_IPV6;
714 714
@@ -764,7 +764,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
764 struct sk_buff *ret_skb = NULL; 764 struct sk_buff *ret_skb = NULL;
765 765
766 /* Jumbo payload inhibits frag. header */ 766 /* Jumbo payload inhibits frag. header */
767 if (skb->nh.ipv6h->payload_len == 0) { 767 if (ipv6_hdr(skb)->payload_len == 0) {
768 DEBUGP("payload len = 0\n"); 768 DEBUGP("payload len = 0\n");
769 return skb; 769 return skb;
770 } 770 }
@@ -786,7 +786,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
786 } 786 }
787 787
788 clone->h.raw = clone->data + fhoff; 788 clone->h.raw = clone->data + fhoff;
789 hdr = clone->nh.ipv6h; 789 hdr = ipv6_hdr(clone);
790 fhdr = (struct frag_hdr *)clone->h.raw; 790 fhdr = (struct frag_hdr *)clone->h.raw;
791 791
792 if (!(fhdr->frag_off & htons(0xFFF9))) { 792 if (!(fhdr->frag_off & htons(0xFFF9))) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 9b2bcde73f19..0e2b56ce0a56 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -152,7 +152,7 @@ int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
152 int delivered = 0; 152 int delivered = 0;
153 __u8 hash; 153 __u8 hash;
154 154
155 saddr = &skb->nh.ipv6h->saddr; 155 saddr = &ipv6_hdr(skb)->saddr;
156 daddr = saddr + 1; 156 daddr = saddr + 1;
157 157
158 hash = nexthdr & (MAX_INET_PROTOS - 1); 158 hash = nexthdr & (MAX_INET_PROTOS - 1);
@@ -363,15 +363,16 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
363 if (skb->ip_summed == CHECKSUM_COMPLETE) { 363 if (skb->ip_summed == CHECKSUM_COMPLETE) {
364 skb_postpull_rcsum(skb, skb_network_header(skb), 364 skb_postpull_rcsum(skb, skb_network_header(skb),
365 skb->h.raw - skb->nh.raw); 365 skb->h.raw - skb->nh.raw);
366 if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr, 366 if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
367 &skb->nh.ipv6h->daddr, 367 &ipv6_hdr(skb)->daddr,
368 skb->len, inet->num, skb->csum)) 368 skb->len, inet->num, skb->csum))
369 skb->ip_summed = CHECKSUM_UNNECESSARY; 369 skb->ip_summed = CHECKSUM_UNNECESSARY;
370 } 370 }
371 if (skb->ip_summed != CHECKSUM_UNNECESSARY) 371 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
372 skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, 372 skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
373 &skb->nh.ipv6h->daddr, 373 &ipv6_hdr(skb)->daddr,
374 skb->len, inet->num, 0)); 374 skb->len,
375 inet->num, 0));
375 376
376 if (inet->hdrincl) { 377 if (inet->hdrincl) {
377 if (skb_checksum_complete(skb)) { 378 if (skb_checksum_complete(skb)) {
@@ -438,7 +439,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
438 if (sin6) { 439 if (sin6) {
439 sin6->sin6_family = AF_INET6; 440 sin6->sin6_family = AF_INET6;
440 sin6->sin6_port = 0; 441 sin6->sin6_port = 0;
441 ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr); 442 ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
442 sin6->sin6_flowinfo = 0; 443 sin6->sin6_flowinfo = 0;
443 sin6->sin6_scope_id = 0; 444 sin6->sin6_scope_id = 0;
444 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) 445 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
@@ -578,7 +579,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
578 579
579 skb_put(skb, length); 580 skb_put(skb, length);
580 skb_reset_network_header(skb); 581 skb_reset_network_header(skb);
581 iph = skb->nh.ipv6h; 582 iph = ipv6_hdr(skb);
582 583
583 skb->ip_summed = CHECKSUM_NONE; 584 skb->ip_summed = CHECKSUM_NONE;
584 585
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index f85e49acb91a..156a37fe3ff3 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -430,8 +430,8 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
430 goto err; 430 goto err;
431 431
432 offset = ntohs(fhdr->frag_off) & ~0x7; 432 offset = ntohs(fhdr->frag_off) & ~0x7;
433 end = offset + (ntohs(skb->nh.ipv6h->payload_len) - 433 end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
434 ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1))); 434 ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
435 435
436 if ((unsigned int)end > IPV6_MAXPLEN) { 436 if ((unsigned int)end > IPV6_MAXPLEN) {
437 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 437 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
@@ -671,7 +671,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
671 head->next = NULL; 671 head->next = NULL;
672 head->dev = dev; 672 head->dev = dev;
673 head->tstamp = fq->stamp; 673 head->tstamp = fq->stamp;
674 head->nh.ipv6h->payload_len = htons(payload_len); 674 ipv6_hdr(head)->payload_len = htons(payload_len);
675 IP6CB(head)->nhoff = nhoff; 675 IP6CB(head)->nhoff = nhoff;
676 676
677 *skb_in = head; 677 *skb_in = head;
@@ -708,9 +708,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
708 struct net_device *dev = skb->dev; 708 struct net_device *dev = skb->dev;
709 struct frag_hdr *fhdr; 709 struct frag_hdr *fhdr;
710 struct frag_queue *fq; 710 struct frag_queue *fq;
711 struct ipv6hdr *hdr; 711 struct ipv6hdr *hdr = ipv6_hdr(skb);
712
713 hdr = skb->nh.ipv6h;
714 712
715 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); 713 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
716 714
@@ -726,7 +724,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
726 return -1; 724 return -1;
727 } 725 }
728 726
729 hdr = skb->nh.ipv6h; 727 hdr = ipv6_hdr(skb);
730 fhdr = (struct frag_hdr *)skb->h.raw; 728 fhdr = (struct frag_hdr *)skb->h.raw;
731 729
732 if (!(fhdr->frag_off & htons(0xFFF9))) { 730 if (!(fhdr->frag_off & htons(0xFFF9))) {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0aa4762f53f7..52cbe1cd4045 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -726,7 +726,7 @@ out2:
726 726
727void ip6_route_input(struct sk_buff *skb) 727void ip6_route_input(struct sk_buff *skb)
728{ 728{
729 struct ipv6hdr *iph = skb->nh.ipv6h; 729 struct ipv6hdr *iph = ipv6_hdr(skb);
730 int flags = RT6_LOOKUP_F_HAS_SADDR; 730 int flags = RT6_LOOKUP_F_HAS_SADDR;
731 struct flowi fl = { 731 struct flowi fl = {
732 .iif = skb->dev->ifindex, 732 .iif = skb->dev->ifindex,
@@ -1775,7 +1775,7 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
1775 int type; 1775 int type;
1776 switch (ipstats_mib_noroutes) { 1776 switch (ipstats_mib_noroutes) {
1777 case IPSTATS_MIB_INNOROUTES: 1777 case IPSTATS_MIB_INNOROUTES:
1778 type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1778 type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
1779 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { 1779 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
1780 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); 1780 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
1781 break; 1781 break;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e33ac3c3a9ca..18ec86f177d9 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -366,7 +366,7 @@ out:
366static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) 366static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
367{ 367{
368 if (INET_ECN_is_ce(iph->tos)) 368 if (INET_ECN_is_ce(iph->tos))
369 IP6_ECN_set_ce(skb->nh.ipv6h); 369 IP6_ECN_set_ce(ipv6_hdr(skb));
370} 370}
371 371
372static int ipip6_rcv(struct sk_buff *skb) 372static int ipip6_rcv(struct sk_buff *skb)
@@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
430 struct ip_tunnel *tunnel = netdev_priv(dev); 430 struct ip_tunnel *tunnel = netdev_priv(dev);
431 struct net_device_stats *stats = &tunnel->stat; 431 struct net_device_stats *stats = &tunnel->stat;
432 struct iphdr *tiph = &tunnel->parms.iph; 432 struct iphdr *tiph = &tunnel->parms.iph;
433 struct ipv6hdr *iph6 = skb->nh.ipv6h; 433 struct ipv6hdr *iph6 = ipv6_hdr(skb);
434 u8 tos = tunnel->parms.iph.tos; 434 u8 tos = tunnel->parms.iph.tos;
435 struct rtable *rt; /* Route to the other host */ 435 struct rtable *rt; /* Route to the other host */
436 struct net_device *tdev; /* Device to other host */ 436 struct net_device *tdev; /* Device to other host */
@@ -468,7 +468,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
468 addr_type = ipv6_addr_type(addr6); 468 addr_type = ipv6_addr_type(addr6);
469 469
470 if (addr_type == IPV6_ADDR_ANY) { 470 if (addr_type == IPV6_ADDR_ANY) {
471 addr6 = &skb->nh.ipv6h->daddr; 471 addr6 = &ipv6_hdr(skb)->daddr;
472 addr_type = ipv6_addr_type(addr6); 472 addr_type = ipv6_addr_type(addr6);
473 } 473 }
474 474
@@ -550,7 +550,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
550 skb_set_owner_w(new_skb, skb->sk); 550 skb_set_owner_w(new_skb, skb->sk);
551 dev_kfree_skb(skb); 551 dev_kfree_skb(skb);
552 skb = new_skb; 552 skb = new_skb;
553 iph6 = skb->nh.ipv6h; 553 iph6 = ipv6_hdr(skb);
554 } 554 }
555 555
556 skb->h.raw = skb->nh.raw; 556 skb->h.raw = skb->nh.raw;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 80a52ab1e384..85b3e89110f9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -115,8 +115,8 @@ static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
115 115
116static __u32 tcp_v6_init_sequence(struct sk_buff *skb) 116static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
117{ 117{
118 return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32, 118 return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
119 skb->nh.ipv6h->saddr.s6_addr32, 119 ipv6_hdr(skb)->saddr.s6_addr32,
120 skb->h.th->dest, 120 skb->h.th->dest,
121 skb->h.th->source); 121 skb->h.th->source);
122} 122}
@@ -837,7 +837,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
837{ 837{
838 __u8 *hash_location = NULL; 838 __u8 *hash_location = NULL;
839 struct tcp_md5sig_key *hash_expected; 839 struct tcp_md5sig_key *hash_expected;
840 struct ipv6hdr *ip6h = skb->nh.ipv6h; 840 struct ipv6hdr *ip6h = ipv6_hdr(skb);
841 struct tcphdr *th = skb->h.th; 841 struct tcphdr *th = skb->h.th;
842 int length = (th->doff << 2) - sizeof (*th); 842 int length = (th->doff << 2) - sizeof (*th);
843 int genhash; 843 int genhash;
@@ -966,7 +966,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
966 if (!pskb_may_pull(skb, sizeof(*th))) 966 if (!pskb_may_pull(skb, sizeof(*th)))
967 return -EINVAL; 967 return -EINVAL;
968 968
969 ipv6h = skb->nh.ipv6h; 969 ipv6h = ipv6_hdr(skb);
970 th = skb->h.th; 970 th = skb->h.th;
971 971
972 th->check = 0; 972 th->check = 0;
@@ -995,7 +995,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
995 995
996#ifdef CONFIG_TCP_MD5SIG 996#ifdef CONFIG_TCP_MD5SIG
997 if (sk) 997 if (sk)
998 key = tcp_v6_md5_do_lookup(sk, &skb->nh.ipv6h->daddr); 998 key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
999 else 999 else
1000 key = NULL; 1000 key = NULL;
1001 1001
@@ -1039,20 +1039,18 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1039 (TCPOPT_NOP << 16) | 1039 (TCPOPT_NOP << 16) |
1040 (TCPOPT_MD5SIG << 8) | 1040 (TCPOPT_MD5SIG << 8) |
1041 TCPOLEN_MD5SIG); 1041 TCPOLEN_MD5SIG);
1042 tcp_v6_do_calc_md5_hash((__u8*)&opt[1], 1042 tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key,
1043 key, 1043 &ipv6_hdr(skb)->daddr,
1044 &skb->nh.ipv6h->daddr, 1044 &ipv6_hdr(skb)->saddr,
1045 &skb->nh.ipv6h->saddr, 1045 t1, IPPROTO_TCP, tot_len);
1046 t1, IPPROTO_TCP,
1047 tot_len);
1048 } 1046 }
1049#endif 1047#endif
1050 1048
1051 buff->csum = csum_partial((char *)t1, sizeof(*t1), 0); 1049 buff->csum = csum_partial((char *)t1, sizeof(*t1), 0);
1052 1050
1053 memset(&fl, 0, sizeof(fl)); 1051 memset(&fl, 0, sizeof(fl));
1054 ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); 1052 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
1055 ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); 1053 ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
1056 1054
1057 t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, 1055 t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
1058 sizeof(*t1), IPPROTO_TCP, 1056 sizeof(*t1), IPPROTO_TCP,
@@ -1093,7 +1091,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
1093 1091
1094#ifdef CONFIG_TCP_MD5SIG 1092#ifdef CONFIG_TCP_MD5SIG
1095 if (!tw && skb->sk) { 1093 if (!tw && skb->sk) {
1096 key = tcp_v6_md5_do_lookup(skb->sk, &skb->nh.ipv6h->daddr); 1094 key = tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr);
1097 } else if (tw && tw->tw_md5_keylen) { 1095 } else if (tw && tw->tw_md5_keylen) {
1098 tw_key.key = tw->tw_md5_key; 1096 tw_key.key = tw->tw_md5_key;
1099 tw_key.keylen = tw->tw_md5_keylen; 1097 tw_key.keylen = tw->tw_md5_keylen;
@@ -1142,20 +1140,18 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
1142 if (key) { 1140 if (key) {
1143 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 1141 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1144 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); 1142 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
1145 tcp_v6_do_calc_md5_hash((__u8 *)topt, 1143 tcp_v6_do_calc_md5_hash((__u8 *)topt, key,
1146 key, 1144 &ipv6_hdr(skb)->daddr,
1147 &skb->nh.ipv6h->daddr, 1145 &ipv6_hdr(skb)->saddr,
1148 &skb->nh.ipv6h->saddr, 1146 t1, IPPROTO_TCP, tot_len);
1149 t1, IPPROTO_TCP,
1150 tot_len);
1151 } 1147 }
1152#endif 1148#endif
1153 1149
1154 buff->csum = csum_partial((char *)t1, tot_len, 0); 1150 buff->csum = csum_partial((char *)t1, tot_len, 0);
1155 1151
1156 memset(&fl, 0, sizeof(fl)); 1152 memset(&fl, 0, sizeof(fl));
1157 ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); 1153 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
1158 ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); 1154 ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
1159 1155
1160 t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, 1156 t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
1161 tot_len, IPPROTO_TCP, 1157 tot_len, IPPROTO_TCP,
@@ -1204,13 +1200,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
1204 1200
1205 /* Find possible connection requests. */ 1201 /* Find possible connection requests. */
1206 req = inet6_csk_search_req(sk, &prev, th->source, 1202 req = inet6_csk_search_req(sk, &prev, th->source,
1207 &skb->nh.ipv6h->saddr, 1203 &ipv6_hdr(skb)->saddr,
1208 &skb->nh.ipv6h->daddr, inet6_iif(skb)); 1204 &ipv6_hdr(skb)->daddr, inet6_iif(skb));
1209 if (req) 1205 if (req)
1210 return tcp_check_req(sk, skb, req, prev); 1206 return tcp_check_req(sk, skb, req, prev);
1211 1207
1212 nsk = __inet6_lookup_established(&tcp_hashinfo, &skb->nh.ipv6h->saddr, 1208 nsk = __inet6_lookup_established(&tcp_hashinfo, &ipv6_hdr(skb)->saddr,
1213 th->source, &skb->nh.ipv6h->daddr, 1209 th->source, &ipv6_hdr(skb)->daddr,
1214 ntohs(th->dest), inet6_iif(skb)); 1210 ntohs(th->dest), inet6_iif(skb));
1215 1211
1216 if (nsk) { 1212 if (nsk) {
@@ -1277,8 +1273,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1277 tcp_openreq_init(req, &tmp_opt, skb); 1273 tcp_openreq_init(req, &tmp_opt, skb);
1278 1274
1279 treq = inet6_rsk(req); 1275 treq = inet6_rsk(req);
1280 ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr); 1276 ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr);
1281 ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr); 1277 ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr);
1282 TCP_ECN_create_request(req, skb->h.th); 1278 TCP_ECN_create_request(req, skb->h.th);
1283 treq->pktopts = NULL; 1279 treq->pktopts = NULL;
1284 if (ipv6_opt_accepted(sk, skb) || 1280 if (ipv6_opt_accepted(sk, skb) ||
@@ -1365,7 +1361,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1365 newnp->pktoptions = NULL; 1361 newnp->pktoptions = NULL;
1366 newnp->opt = NULL; 1362 newnp->opt = NULL;
1367 newnp->mcast_oif = inet6_iif(skb); 1363 newnp->mcast_oif = inet6_iif(skb);
1368 newnp->mcast_hops = skb->nh.ipv6h->hop_limit; 1364 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
1369 1365
1370 /* 1366 /*
1371 * No need to charge this sock to the relevant IPv6 refcnt debug socks count 1367 * No need to charge this sock to the relevant IPv6 refcnt debug socks count
@@ -1473,7 +1469,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1473 } 1469 }
1474 newnp->opt = NULL; 1470 newnp->opt = NULL;
1475 newnp->mcast_oif = inet6_iif(skb); 1471 newnp->mcast_oif = inet6_iif(skb);
1476 newnp->mcast_hops = skb->nh.ipv6h->hop_limit; 1472 newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
1477 1473
1478 /* Clone native IPv6 options from listening socket (if any) 1474 /* Clone native IPv6 options from listening socket (if any)
1479 1475
@@ -1532,15 +1528,16 @@ out:
1532static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) 1528static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
1533{ 1529{
1534 if (skb->ip_summed == CHECKSUM_COMPLETE) { 1530 if (skb->ip_summed == CHECKSUM_COMPLETE) {
1535 if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, 1531 if (!tcp_v6_check(skb->h.th, skb->len, &ipv6_hdr(skb)->saddr,
1536 &skb->nh.ipv6h->daddr,skb->csum)) { 1532 &ipv6_hdr(skb)->daddr, skb->csum)) {
1537 skb->ip_summed = CHECKSUM_UNNECESSARY; 1533 skb->ip_summed = CHECKSUM_UNNECESSARY;
1538 return 0; 1534 return 0;
1539 } 1535 }
1540 } 1536 }
1541 1537
1542 skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, 1538 skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th, skb->len,
1543 &skb->nh.ipv6h->daddr, 0)); 1539 &ipv6_hdr(skb)->saddr,
1540 &ipv6_hdr(skb)->daddr, 0));
1544 1541
1545 if (skb->len <= 76) { 1542 if (skb->len <= 76) {
1546 return __skb_checksum_complete(skb); 1543 return __skb_checksum_complete(skb);
@@ -1668,7 +1665,7 @@ ipv6_pktoptions:
1668 if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo) 1665 if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo)
1669 np->mcast_oif = inet6_iif(opt_skb); 1666 np->mcast_oif = inet6_iif(opt_skb);
1670 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) 1667 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
1671 np->mcast_hops = opt_skb->nh.ipv6h->hop_limit; 1668 np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
1672 if (ipv6_opt_accepted(sk, opt_skb)) { 1669 if (ipv6_opt_accepted(sk, opt_skb)) {
1673 skb_set_owner_r(opt_skb, sk); 1670 skb_set_owner_r(opt_skb, sk);
1674 opt_skb = xchg(&np->pktoptions, opt_skb); 1671 opt_skb = xchg(&np->pktoptions, opt_skb);
@@ -1718,11 +1715,11 @@ static int tcp_v6_rcv(struct sk_buff **pskb)
1718 skb->len - th->doff*4); 1715 skb->len - th->doff*4);
1719 TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); 1716 TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
1720 TCP_SKB_CB(skb)->when = 0; 1717 TCP_SKB_CB(skb)->when = 0;
1721 TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h); 1718 TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb));
1722 TCP_SKB_CB(skb)->sacked = 0; 1719 TCP_SKB_CB(skb)->sacked = 0;
1723 1720
1724 sk = __inet6_lookup(&tcp_hashinfo, &skb->nh.ipv6h->saddr, th->source, 1721 sk = __inet6_lookup(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, th->source,
1725 &skb->nh.ipv6h->daddr, ntohs(th->dest), 1722 &ipv6_hdr(skb)->daddr, ntohs(th->dest),
1726 inet6_iif(skb)); 1723 inet6_iif(skb));
1727 1724
1728 if (!sk) 1725 if (!sk)
@@ -1802,7 +1799,7 @@ do_time_wait:
1802 struct sock *sk2; 1799 struct sock *sk2;
1803 1800
1804 sk2 = inet6_lookup_listener(&tcp_hashinfo, 1801 sk2 = inet6_lookup_listener(&tcp_hashinfo,
1805 &skb->nh.ipv6h->daddr, 1802 &ipv6_hdr(skb)->daddr,
1806 ntohs(th->dest), inet6_iif(skb)); 1803 ntohs(th->dest), inet6_iif(skb));
1807 if (sk2 != NULL) { 1804 if (sk2 != NULL) {
1808 struct inet_timewait_sock *tw = inet_twsk(sk); 1805 struct inet_timewait_sock *tw = inet_twsk(sk);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e991e606ab1f..55affe39b2eb 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -180,7 +180,8 @@ try_again:
180 ipv6_addr_set(&sin6->sin6_addr, 0, 0, 180 ipv6_addr_set(&sin6->sin6_addr, 0, 0,
181 htonl(0xffff), ip_hdr(skb)->saddr); 181 htonl(0xffff), ip_hdr(skb)->saddr);
182 else { 182 else {
183 ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr); 183 ipv6_addr_copy(&sin6->sin6_addr,
184 &ipv6_hdr(skb)->saddr);
184 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) 185 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
185 sin6->sin6_scope_id = IP6CB(skb)->iif; 186 sin6->sin6_scope_id = IP6CB(skb)->iif;
186 } 187 }
@@ -392,13 +393,13 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
392 return 1; 393 return 1;
393 } 394 }
394 if (skb->ip_summed == CHECKSUM_COMPLETE && 395 if (skb->ip_summed == CHECKSUM_COMPLETE &&
395 !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, 396 !csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
396 skb->len, proto, skb->csum)) 397 skb->len, proto, skb->csum))
397 skb->ip_summed = CHECKSUM_UNNECESSARY; 398 skb->ip_summed = CHECKSUM_UNNECESSARY;
398 399
399 if (skb->ip_summed != CHECKSUM_UNNECESSARY) 400 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
400 skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, 401 skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
401 &skb->nh.ipv6h->daddr, 402 &ipv6_hdr(skb)->daddr,
402 skb->len, proto, 0)); 403 skb->len, proto, 0));
403 404
404 return 0; 405 return 0;
@@ -417,8 +418,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
417 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 418 if (!pskb_may_pull(skb, sizeof(struct udphdr)))
418 goto short_packet; 419 goto short_packet;
419 420
420 saddr = &skb->nh.ipv6h->saddr; 421 saddr = &ipv6_hdr(skb)->saddr;
421 daddr = &skb->nh.ipv6h->daddr; 422 daddr = &ipv6_hdr(skb)->daddr;
422 uh = skb->h.uh; 423 uh = skb->h.uh;
423 424
424 ulen = ntohs(uh->len); 425 ulen = ntohs(uh->len);
@@ -438,8 +439,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
438 if (ulen < skb->len) { 439 if (ulen < skb->len) {
439 if (pskb_trim_rcsum(skb, ulen)) 440 if (pskb_trim_rcsum(skb, ulen))
440 goto short_packet; 441 goto short_packet;
441 saddr = &skb->nh.ipv6h->saddr; 442 saddr = &ipv6_hdr(skb)->saddr;
442 daddr = &skb->nh.ipv6h->daddr; 443 daddr = &ipv6_hdr(skb)->daddr;
443 uh = skb->h.uh; 444 uh = skb->h.uh;
444 } 445 }
445 } 446 }
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 5c929f886129..f30ef16072f6 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -35,7 +35,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
35 goto drop; 35 goto drop;
36 36
37 do { 37 do {
38 struct ipv6hdr *iph = skb->nh.ipv6h; 38 struct ipv6hdr *iph = ipv6_hdr(skb);
39 39
40 if (xfrm_nr == XFRM_MAX_DEPTH) 40 if (xfrm_nr == XFRM_MAX_DEPTH)
41 goto drop; 41 goto drop;
@@ -112,7 +112,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
112 return -1; 112 return -1;
113 } else { 113 } else {
114#ifdef CONFIG_NETFILTER 114#ifdef CONFIG_NETFILTER
115 skb->nh.ipv6h->payload_len = htons(skb->len); 115 ipv6_hdr(skb)->payload_len = htons(skb->len);
116 __skb_push(skb, skb->data - skb_network_header(skb)); 116 __skb_push(skb, skb->data - skb_network_header(skb));
117 117
118 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, 118 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 247e2d5d2acf..b5a48c255f07 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -38,7 +38,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
38 int hdr_len; 38 int hdr_len;
39 39
40 skb_push(skb, x->props.header_len); 40 skb_push(skb, x->props.header_len);
41 iph = skb->nh.ipv6h; 41 iph = ipv6_hdr(skb);
42 42
43 hdr_len = ip6_find_1stfragopt(skb, &prevhdr); 43 hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
44 skb->nh.raw = prevhdr - x->props.header_len; 44 skb->nh.raw = prevhdr - x->props.header_len;
@@ -46,7 +46,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
46 memmove(skb->data, iph, hdr_len); 46 memmove(skb->data, iph, hdr_len);
47 47
48 skb_reset_network_header(skb); 48 skb_reset_network_header(skb);
49 top_iph = skb->nh.ipv6h; 49 top_iph = ipv6_hdr(skb);
50 skb->nh.raw = &top_iph->nexthdr; 50 skb->nh.raw = &top_iph->nexthdr;
51 skb->h.ipv6h = top_iph + 1; 51 skb->h.ipv6h = top_iph + 1;
52 52
@@ -74,7 +74,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
74 skb_set_mac_header(skb, -skb->mac_len); 74 skb_set_mac_header(skb, -skb->mac_len);
75 memmove(skb_mac_header(skb), old_mac, skb->mac_len); 75 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
76 76
77 ip6h = skb->nh.ipv6h; 77 ip6h = ipv6_hdr(skb);
78 ip6h->payload_len = htons(skb->len - size); 78 ip6h->payload_len = htons(skb->len - size);
79 ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6); 79 ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
80 ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6); 80 ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c
index 6031c16d46ca..d01958d921ac 100644
--- a/net/ipv6/xfrm6_mode_ro.c
+++ b/net/ipv6/xfrm6_mode_ro.c
@@ -50,7 +50,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
50 int hdr_len; 50 int hdr_len;
51 51
52 skb_push(skb, x->props.header_len); 52 skb_push(skb, x->props.header_len);
53 iph = skb->nh.ipv6h; 53 iph = ipv6_hdr(skb);
54 54
55 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 55 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
56 skb->nh.raw = prevhdr - x->props.header_len; 56 skb->nh.raw = prevhdr - x->props.header_len;
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
index ace0bbf4f25d..358b60d9d912 100644
--- a/net/ipv6/xfrm6_mode_transport.c
+++ b/net/ipv6/xfrm6_mode_transport.c
@@ -32,7 +32,7 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
32 int hdr_len; 32 int hdr_len;
33 33
34 skb_push(skb, x->props.header_len); 34 skb_push(skb, x->props.header_len);
35 iph = skb->nh.ipv6h; 35 iph = ipv6_hdr(skb);
36 36
37 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 37 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
38 skb->nh.raw = prevhdr - x->props.header_len; 38 skb->nh.raw = prevhdr - x->props.header_len;
@@ -57,7 +57,7 @@ static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
57 memmove(skb->h.raw, skb_network_header(skb), ihl); 57 memmove(skb->h.raw, skb_network_header(skb), ihl);
58 skb->nh.raw = skb->h.raw; 58 skb->nh.raw = skb->h.raw;
59 } 59 }
60 skb->nh.ipv6h->payload_len = htons(skb->len + ihl - 60 ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
61 sizeof(struct ipv6hdr)); 61 sizeof(struct ipv6hdr));
62 skb->h.raw = skb->data; 62 skb->h.raw = skb->data;
63 return 0; 63 return 0;
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 498f17b5c42f..28f36b363d1f 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -18,7 +18,7 @@
18 18
19static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) 19static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
20{ 20{
21 struct ipv6hdr *outer_iph = skb->nh.ipv6h; 21 struct ipv6hdr *outer_iph = ipv6_hdr(skb);
22 struct ipv6hdr *inner_iph = skb->h.ipv6h; 22 struct ipv6hdr *inner_iph = skb->h.ipv6h;
23 23
24 if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) 24 if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
@@ -27,7 +27,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
27 27
28static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb) 28static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb)
29{ 29{
30 if (INET_ECN_is_ce(ipv6_get_dsfield(skb->nh.ipv6h))) 30 if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6_hdr(skb))))
31 IP_ECN_set_ce(skb->h.ipiph); 31 IP_ECN_set_ce(skb->h.ipiph);
32} 32}
33 33
@@ -51,10 +51,10 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
51 int dsfield; 51 int dsfield;
52 52
53 skb_push(skb, x->props.header_len); 53 skb_push(skb, x->props.header_len);
54 iph = skb->nh.ipv6h; 54 iph = ipv6_hdr(skb);
55 55
56 skb_reset_network_header(skb); 56 skb_reset_network_header(skb);
57 top_iph = skb->nh.ipv6h; 57 top_iph = ipv6_hdr(skb);
58 skb->nh.raw = &top_iph->nexthdr; 58 skb->nh.raw = &top_iph->nexthdr;
59 skb->h.ipv6h = top_iph + 1; 59 skb->h.ipv6h = top_iph + 1;
60 60
@@ -102,7 +102,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
102 nh = skb_network_header(skb); 102 nh = skb_network_header(skb);
103 if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) { 103 if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) {
104 if (x->props.flags & XFRM_STATE_DECAP_DSCP) 104 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
105 ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h); 105 ipv6_copy_dscp(ipv6_hdr(skb), skb->h.ipv6h);
106 if (!(x->props.flags & XFRM_STATE_NOECN)) 106 if (!(x->props.flags & XFRM_STATE_NOECN))
107 ipip6_ecn_decapsulate(skb); 107 ipip6_ecn_decapsulate(skb);
108 } else { 108 } else {
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index cb5a723d4cb4..b93bfb87f494 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -271,7 +271,7 @@ static inline void
271_decode_session6(struct sk_buff *skb, struct flowi *fl) 271_decode_session6(struct sk_buff *skb, struct flowi *fl)
272{ 272{
273 u16 offset = skb->h.raw - skb->nh.raw; 273 u16 offset = skb->h.raw - skb->nh.raw;
274 struct ipv6hdr *hdr = skb->nh.ipv6h; 274 struct ipv6hdr *hdr = ipv6_hdr(skb);
275 struct ipv6_opt_hdr *exthdr; 275 struct ipv6_opt_hdr *exthdr;
276 const unsigned char *nh = skb_network_header(skb); 276 const unsigned char *nh = skb_network_header(skb);
277 u8 nexthdr = nh[IP6CB(skb)->nhoff]; 277 u8 nexthdr = nh[IP6CB(skb)->nhoff];
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 93c42232aa39..538499a89975 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -257,7 +257,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
257 257
258static int xfrm6_tunnel_rcv(struct sk_buff *skb) 258static int xfrm6_tunnel_rcv(struct sk_buff *skb)
259{ 259{
260 struct ipv6hdr *iph = skb->nh.ipv6h; 260 struct ipv6hdr *iph = ipv6_hdr(skb);
261 __be32 spi; 261 __be32 spi;
262 262
263 spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); 263 spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
diff --git a/net/netfilter/xt_DSCP.c b/net/netfilter/xt_DSCP.c
index de647bd54893..a97704a3f95c 100644
--- a/net/netfilter/xt_DSCP.c
+++ b/net/netfilter/xt_DSCP.c
@@ -56,13 +56,13 @@ static unsigned int target6(struct sk_buff **pskb,
56 const void *targinfo) 56 const void *targinfo)
57{ 57{
58 const struct xt_DSCP_info *dinfo = targinfo; 58 const struct xt_DSCP_info *dinfo = targinfo;
59 u_int8_t dscp = ipv6_get_dsfield((*pskb)->nh.ipv6h) >> XT_DSCP_SHIFT; 59 u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(*pskb)) >> XT_DSCP_SHIFT;
60 60
61 if (dscp != dinfo->dscp) { 61 if (dscp != dinfo->dscp) {
62 if (!skb_make_writable(pskb, sizeof(struct ipv6hdr))) 62 if (!skb_make_writable(pskb, sizeof(struct ipv6hdr)))
63 return NF_DROP; 63 return NF_DROP;
64 64
65 ipv6_change_dsfield((*pskb)->nh.ipv6h, (__u8)(~XT_DSCP_MASK), 65 ipv6_change_dsfield(ipv6_hdr(*pskb), (__u8)(~XT_DSCP_MASK),
66 dinfo->dscp << XT_DSCP_SHIFT); 66 dinfo->dscp << XT_DSCP_SHIFT);
67 } 67 }
68 return XT_CONTINUE; 68 return XT_CONTINUE;
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 9e948ce27600..15fe8f649510 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -171,7 +171,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
171 const struct xt_target *target, 171 const struct xt_target *target,
172 const void *targinfo) 172 const void *targinfo)
173{ 173{
174 struct ipv6hdr *ipv6h = (*pskb)->nh.ipv6h; 174 struct ipv6hdr *ipv6h = ipv6_hdr(*pskb);
175 u8 nexthdr; 175 u8 nexthdr;
176 int tcphoff; 176 int tcphoff;
177 int ret; 177 int ret;
@@ -187,7 +187,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
187 if (ret < 0) 187 if (ret < 0)
188 return NF_DROP; 188 return NF_DROP;
189 if (ret > 0) { 189 if (ret > 0) {
190 ipv6h = (*pskb)->nh.ipv6h; 190 ipv6h = ipv6_hdr(*pskb);
191 ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret); 191 ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret);
192 } 192 }
193 return XT_CONTINUE; 193 return XT_CONTINUE;
diff --git a/net/netfilter/xt_dscp.c b/net/netfilter/xt_dscp.c
index 9ec294cd2436..000e9c2f8d1f 100644
--- a/net/netfilter/xt_dscp.c
+++ b/net/netfilter/xt_dscp.c
@@ -49,7 +49,7 @@ static int match6(const struct sk_buff *skb,
49 int *hotdrop) 49 int *hotdrop)
50{ 50{
51 const struct xt_dscp_info *info = matchinfo; 51 const struct xt_dscp_info *info = matchinfo;
52 u_int8_t dscp = ipv6_get_dsfield(skb->nh.ipv6h) >> XT_DSCP_SHIFT; 52 u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
53 53
54 return (dscp == info->dscp) ^ !!info->invert; 54 return (dscp == info->dscp) ^ !!info->invert;
55} 55}
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 47af19ab03cf..eb932913693b 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -392,10 +392,10 @@ hashlimit_init_dst(struct xt_hashlimit_htable *hinfo, struct dsthash_dst *dst,
392#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 392#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
393 case AF_INET6: 393 case AF_INET6:
394 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) 394 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
395 memcpy(&dst->addr.ip6.dst, &skb->nh.ipv6h->daddr, 395 memcpy(&dst->addr.ip6.dst, &ipv6_hdr(skb)->daddr,
396 sizeof(dst->addr.ip6.dst)); 396 sizeof(dst->addr.ip6.dst));
397 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP) 397 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
398 memcpy(&dst->addr.ip6.src, &skb->nh.ipv6h->saddr, 398 memcpy(&dst->addr.ip6.src, &ipv6_hdr(skb)->saddr,
399 sizeof(dst->addr.ip6.src)); 399 sizeof(dst->addr.ip6.src));
400 400
401 if (!(hinfo->cfg.mode & 401 if (!(hinfo->cfg.mode &
diff --git a/net/netfilter/xt_length.c b/net/netfilter/xt_length.c
index 65fdb2166996..77288c5ada78 100644
--- a/net/netfilter/xt_length.c
+++ b/net/netfilter/xt_length.c
@@ -47,7 +47,8 @@ match6(const struct sk_buff *skb,
47 int *hotdrop) 47 int *hotdrop)
48{ 48{
49 const struct xt_length_info *info = matchinfo; 49 const struct xt_length_info *info = matchinfo;
50 u_int16_t pktlen = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); 50 const u_int16_t pktlen = (ntohs(ipv6_hdr(skb)->payload_len) +
51 sizeof(struct ipv6hdr));
51 52
52 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; 53 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
53} 54}
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index cb8cf5bfa053..6f373b020eb4 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -143,7 +143,7 @@ static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
143 u8 tunnelid = 0; 143 u8 tunnelid = 0;
144 u8 *xprt; 144 u8 *xprt;
145#if RSVP_DST_LEN == 4 145#if RSVP_DST_LEN == 4
146 struct ipv6hdr *nhptr = skb->nh.ipv6h; 146 struct ipv6hdr *nhptr = ipv6_hdr(skb);
147#else 147#else
148 struct iphdr *nhptr = ip_hdr(skb); 148 struct iphdr *nhptr = ip_hdr(skb);
149#endif 149#endif
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 45b5734dd72a..2c857af79a1e 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -220,7 +220,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
220 & ~INET_ECN_MASK; 220 & ~INET_ECN_MASK;
221 break; 221 break;
222 case __constant_htons(ETH_P_IPV6): 222 case __constant_htons(ETH_P_IPV6):
223 skb->tc_index = ipv6_get_dsfield(skb->nh.ipv6h) 223 skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
224 & ~INET_ECN_MASK; 224 & ~INET_ECN_MASK;
225 break; 225 break;
226 default: 226 default:
@@ -296,7 +296,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
296 p->value[index]); 296 p->value[index]);
297 break; 297 break;
298 case __constant_htons(ETH_P_IPV6): 298 case __constant_htons(ETH_P_IPV6):
299 ipv6_change_dsfield(skb->nh.ipv6h, p->mask[index], 299 ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index],
300 p->value[index]); 300 p->value[index]);
301 break; 301 break;
302 default: 302 default:
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 02081bc9e0d1..e3695407afc6 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -152,7 +152,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
152 } 152 }
153 case __constant_htons(ETH_P_IPV6): 153 case __constant_htons(ETH_P_IPV6):
154 { 154 {
155 struct ipv6hdr *iph = skb->nh.ipv6h; 155 struct ipv6hdr *iph = ipv6_hdr(skb);
156 h = iph->daddr.s6_addr32[3]; 156 h = iph->daddr.s6_addr32[3];
157 h2 = iph->saddr.s6_addr32[3]^iph->nexthdr; 157 h2 = iph->saddr.s6_addr32[3]^iph->nexthdr;
158 if (iph->nexthdr == IPPROTO_TCP || 158 if (iph->nexthdr == IPPROTO_TCP ||
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 742f9ff42fbf..001be2de0b3c 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -393,10 +393,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
393 sh = (struct sctphdr *) skb->h.raw; 393 sh = (struct sctphdr *) skb->h.raw;
394 if (is_saddr) { 394 if (is_saddr) {
395 *port = sh->source; 395 *port = sh->source;
396 from = &skb->nh.ipv6h->saddr; 396 from = &ipv6_hdr(skb)->saddr;
397 } else { 397 } else {
398 *port = sh->dest; 398 *port = sh->dest;
399 from = &skb->nh.ipv6h->daddr; 399 from = &ipv6_hdr(skb)->daddr;
400 } 400 }
401 ipv6_addr_copy(&addr->v6.sin6_addr, from); 401 ipv6_addr_copy(&addr->v6.sin6_addr, from);
402} 402}
@@ -698,7 +698,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb)
698/* Was this packet marked by Explicit Congestion Notification? */ 698/* Was this packet marked by Explicit Congestion Notification? */
699static int sctp_v6_is_ce(const struct sk_buff *skb) 699static int sctp_v6_is_ce(const struct sk_buff *skb)
700{ 700{
701 return *((__u32 *)(skb->nh.ipv6h)) & htonl(1<<20); 701 return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20);
702} 702}
703 703
704/* Dump the v6 addr to the seq file. */ 704/* Dump the v6 addr to the seq file. */
@@ -777,7 +777,7 @@ static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname,
777 } 777 }
778 778
779 /* Otherwise, just copy the v6 address. */ 779 /* Otherwise, just copy the v6 address. */
780 ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr); 780 ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
781 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) { 781 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
782 struct sctp_ulpevent *ev = sctp_skb2event(skb); 782 struct sctp_ulpevent *ev = sctp_skb2event(skb);
783 sin6->sin6_scope_id = ev->iif; 783 sin6->sin6_scope_id = ev->iif;