]> err.no Git - linux-2.6/commitdiff
[SK_BUFF]: Introduce ipv6_hdr(), remove skb->nh.ipv6h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 Apr 2007 00:54:47 +0000 (17:54 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:14 +0000 (22:25 -0700)
Now the skb->nh union has just one member, .raw, i.e. it is just like the
skb->mac union, strange, no? I'm just leaving it like that till the transport
layer is done with, when we'll rename skb->mac.raw to skb->mac_header (or
->mac_header_offset?), ditto for ->{h,nh}.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
59 files changed:
drivers/net/bonding/bond_alb.c
drivers/net/e1000/e1000_main.c
drivers/s390/net/qeth_eddp.c
drivers/s390/net/qeth_main.c
drivers/s390/net/qeth_tso.h
include/linux/ipv6.h
include/linux/skbuff.h
include/net/inet_ecn.h
net/bridge/br_netfilter.c
net/core/pktgen.c
net/dccp/ipv6.c
net/ipv4/ip_gre.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/ah6.c
net/ipv6/datagram.c
net/ipv6/esp6.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_input.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/ipcomp6.c
net/ipv6/ipv6_sockglue.c
net/ipv6/mcast.c
net/ipv6/mip6.c
net/ipv6/ndisc.c
net/ipv6/netfilter.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6t_HL.c
net/ipv6/netfilter/ip6t_LOG.c
net/ipv6/netfilter/ip6t_REJECT.c
net/ipv6/netfilter/ip6t_eui64.c
net/ipv6/netfilter/ip6t_hl.c
net/ipv6/netfilter/ip6t_ipv6header.c
net/ipv6/netfilter/ip6table_mangle.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/raw.c
net/ipv6/reassembly.c
net/ipv6/route.c
net/ipv6/sit.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipv6/xfrm6_input.c
net/ipv6/xfrm6_mode_beet.c
net/ipv6/xfrm6_mode_ro.c
net/ipv6/xfrm6_mode_transport.c
net/ipv6/xfrm6_mode_tunnel.c
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_tunnel.c
net/netfilter/xt_DSCP.c
net/netfilter/xt_TCPMSS.c
net/netfilter/xt_dscp.c
net/netfilter/xt_hashlimit.c
net/netfilter/xt_length.c
net/sched/cls_rsvp.h
net/sched/sch_dsmark.c
net/sched/sch_sfq.c
net/sctp/ipv6.c

index 8555afa574a4ee4562da58cdbc1f686895538b2d..b8cf777542fa27fab4b88d7de86c0cfa4095717d 100644 (file)
@@ -1304,8 +1304,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
                        break;
                }
 
-               hash_start = (char*)&(skb->nh.ipv6h->daddr);
-               hash_size = sizeof(skb->nh.ipv6h->daddr);
+               hash_start = (char *)&(ipv6_hdr(skb)->daddr);
+               hash_size = sizeof(ipv6_hdr(skb)->daddr);
                break;
        case ETH_P_IPX:
                if (ipx_hdr(skb)->ipx_checksum !=
index c324866c97893537abd456fc28eae9f2994ad2ee..a3d9986b4170526f4deffa92c99e88a24fee7c10 100644 (file)
@@ -2899,13 +2899,11 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                        cmd_length = E1000_TXD_CMD_IP;
                        ipcse = skb->h.raw - skb->data - 1;
                } else if (skb->protocol == htons(ETH_P_IPV6)) {
-                       skb->nh.ipv6h->payload_len = 0;
+                       ipv6_hdr(skb)->payload_len = 0;
                        skb->h.th->check =
-                               ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                                &skb->nh.ipv6h->daddr,
-                                                0,
-                                                IPPROTO_TCP,
-                                                0);
+                               ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                &ipv6_hdr(skb)->daddr,
+                                                0, IPPROTO_TCP, 0);
                        ipcse = 0;
                }
                ipcss = skb_network_offset(skb);
index 1574247abaa17f62e0aa7674442b181b64a04ae8..90da58b4e532c78e944eb1116d981e37f0e590c2 100644 (file)
@@ -479,9 +479,11 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                                                  skb->h.raw,
                                                  skb->h.th->doff * 4);
        else
-               eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.ipv6h,
-                               sizeof(struct ipv6hdr),
-                               (u8 *)skb->h.th, skb->h.th->doff*4);
+               eddp = qeth_eddp_create_eddp_data(qhdr,
+                                                 skb_network_header(skb),
+                                                 sizeof(struct ipv6hdr),
+                                                 skb->h.raw,
+                                                 skb->h.th->doff * 4);
 
        if (eddp == NULL) {
                QETH_DBF_TEXT(trace, 2, "eddpfcnm");
index 8a07d548a05a1d35514a96432c7aa02e5ba5de25..df7f279ec4082a1781aebb54756cf8ffbb054db0 100644 (file)
@@ -4053,7 +4053,8 @@ qeth_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
                               skb->dst->neighbour->primary_key, 16);
                } else {
                        /* fill in destination address used in ip header */
-                       memcpy(hdr->hdr.l3.dest_addr, &skb->nh.ipv6h->daddr, 16);
+                       memcpy(hdr->hdr.l3.dest_addr,
+                              &ipv6_hdr(skb)->daddr, 16);
                }
        } else { /* passthrough */
                 if((skb->dev->type == ARPHRD_IEEE802_TR) &&
index 255cb2e9c7965f40ca1042167459301d43923c96..4040bdd8c327d2fa872983b9b4e6fd38fc133dbe 100644 (file)
@@ -64,7 +64,7 @@ static inline void
 qeth_tso_set_tcpip_header(struct qeth_card *card, struct sk_buff *skb)
 {
        struct iphdr *iph    = ip_hdr(skb);
-       struct ipv6hdr *ip6h = skb->nh.ipv6h;
+       struct ipv6hdr *ip6h = ipv6_hdr(skb);
        struct tcphdr *tcph  = skb->h.th;
 
        tcph->check = 0;
index e046b22a2222070679ced6a1eed37b5a78178931..ec79c59b2077fe41fc41ce6864c5487f3586b80c 100644 (file)
@@ -223,6 +223,11 @@ enum {
 #include <net/if_inet6.h>       /* struct ipv6_mc_socklist */
 #include <net/inet_sock.h>
 
+static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
+{
+       return (struct ipv6hdr *)skb_network_header(skb);
+}
+
 /* 
    This structure contains results of exthdrs parsing
    as offsets from skb->nh.
index 9cb674b12b29c7a23b07265d60ae1c09b6084938..31806a7ce40ef8021d2395e797e49e1f7bef84d1 100644 (file)
@@ -247,7 +247,6 @@ struct sk_buff {
        } h;
 
        union {
-               struct ipv6hdr  *ipv6h;
                unsigned char   *raw;
        } nh;
 
index 6fd4452c15d95c0b9d84bc033150183e9108801c..06a2c69a89e5f4706f826737745ee82f60dad156 100644 (file)
@@ -122,7 +122,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
        case __constant_htons(ETH_P_IPV6):
                if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
                    skb->tail)
-                       return IP6_ECN_set_ce(skb->nh.ipv6h);
+                       return IP6_ECN_set_ce(ipv6_hdr(skb));
                break;
        }
 
index 0ee74b1e47700c37b4209ff46f159316a41c0f96..f2796c97b4a2fe844c2f861dea6f1df21612e039 100644 (file)
@@ -372,7 +372,7 @@ static struct net_device *setup_pre_routing(struct sk_buff *skb)
 /* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
 static int check_hbh_len(struct sk_buff *skb)
 {
-       unsigned char *raw = (u8 *) (skb->nh.ipv6h + 1);
+       unsigned char *raw = (u8 *)(ipv6_hdr(skb) + 1);
        u32 pkt_len;
        const unsigned char *nh = skb_network_header(skb);
        int off = raw - nh;
@@ -400,7 +400,7 @@ static int check_hbh_len(struct sk_buff *skb)
                                goto bad;
                        pkt_len = ntohl(*(__be32 *) (nh + off + 2));
                        if (pkt_len <= IPV6_MAXPLEN ||
-                           skb->nh.ipv6h->payload_len)
+                           ipv6_hdr(skb)->payload_len)
                                goto bad;
                        if (pkt_len > skb->len - sizeof(struct ipv6hdr))
                                goto bad;
@@ -441,7 +441,7 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
        if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
                goto inhdr_error;
 
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
 
        if (hdr->version != 6)
                goto inhdr_error;
index e0faff8eb652f0c5108315ec03f19705750740eb..ee82364c8f31ceb7d5792f6f1dfbde19d548a6ac 100644 (file)
@@ -2736,7 +2736,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
        skb->protocol = protocol;
        skb->dev = odev;
        skb->pkt_type = PACKET_HOST;
-       skb->nh.ipv6h = iph;
+       skb->nh.raw = (unsigned char *)iph;
        skb->h.uh = udph;
 
        if (pkt_dev->nfrags <= 0)
index 627d0c3c51cf90d0531308087b9ebbb404f3fb46..64eac2515aa2554205534426b5f1cfcf7626931e 100644 (file)
@@ -84,8 +84,8 @@ static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
 
 static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb)
 {
-       return secure_dccpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
-                                            skb->nh.ipv6h->saddr.s6_addr32,
+       return secure_dccpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
+                                            ipv6_hdr(skb)->saddr.s6_addr32,
                                             dccp_hdr(skb)->dccph_dport,
                                             dccp_hdr(skb)->dccph_sport     );
 
@@ -313,6 +313,7 @@ static void dccp_v6_reqsk_destructor(struct request_sock *req)
 static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
 {
        struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
+       struct ipv6hdr *rxip6h;
        const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) +
                                       sizeof(struct dccp_hdr_ext) +
                                       sizeof(struct dccp_hdr_reset);
@@ -352,12 +353,13 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
        dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
 
        dccp_csum_outgoing(skb);
-       dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr,
-                                                     &rxskb->nh.ipv6h->daddr);
+       rxip6h = ipv6_hdr(rxskb);
+       dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
+                                                     &rxip6h->daddr);
 
        memset(&fl, 0, sizeof(fl));
-       ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr);
-       ipv6_addr_copy(&fl.fl6_src, &rxskb->nh.ipv6h->daddr);
+       ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
+       ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
 
        fl.proto = IPPROTO_DCCP;
        fl.oif = inet6_iif(rxskb);
@@ -390,7 +392,7 @@ static struct request_sock_ops dccp6_request_sock_ops = {
 static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
 {
        const struct dccp_hdr *dh = dccp_hdr(skb);
-       const struct ipv6hdr *iph = skb->nh.ipv6h;
+       const struct ipv6hdr *iph = ipv6_hdr(skb);
        struct sock *nsk;
        struct request_sock **prev;
        /* Find possible connection requests. */
@@ -460,8 +462,8 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
                goto drop_and_free;
 
        ireq6 = inet6_rsk(req);
-       ipv6_addr_copy(&ireq6->rmt_addr, &skb->nh.ipv6h->saddr);
-       ipv6_addr_copy(&ireq6->loc_addr, &skb->nh.ipv6h->daddr);
+       ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
+       ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);
        ireq6->pktopts  = NULL;
 
        if (ipv6_opt_accepted(sk, skb) ||
@@ -546,7 +548,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
                newnp->pktoptions  = NULL;
                newnp->opt         = NULL;
                newnp->mcast_oif   = inet6_iif(skb);
-               newnp->mcast_hops  = skb->nh.ipv6h->hop_limit;
+               newnp->mcast_hops  = ipv6_hdr(skb)->hop_limit;
 
                /*
                 * 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,
        }
        newnp->opt        = NULL;
        newnp->mcast_oif  = inet6_iif(skb);
-       newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
+       newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
 
        /*
         * Clone native IPv6 options from listening socket (if any)
@@ -826,8 +828,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
                goto discard_it;
 
        /* Step 1: If header checksum is incorrect, drop packet and return. */
-       if (dccp_v6_csum_finish(skb, &skb->nh.ipv6h->saddr,
-                                    &skb->nh.ipv6h->daddr)) {
+       if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
+                                    &ipv6_hdr(skb)->daddr)) {
                DCCP_WARN("dropped packet with invalid checksum\n");
                goto discard_it;
        }
@@ -844,9 +846,9 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
 
        /* Step 2:
         *      Look up flow ID in table and get corresponding socket */
-       sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr,
+       sk = __inet6_lookup(&dccp_hashinfo, &ipv6_hdr(skb)->saddr,
                            dh->dccph_sport,
-                           &skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport),
+                           &ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport),
                            inet6_iif(skb));
        /*
         * Step 2:
index 851f46b910f2c7904432f1ec85d1a378b2349c9b..969fe31723a79f71280a9d9b65ba980218a06b7e 100644 (file)
@@ -535,7 +535,7 @@ static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
                if (skb->protocol == htons(ETH_P_IP)) {
                        IP_ECN_set_ce(ip_hdr(skb));
                } else if (skb->protocol == htons(ETH_P_IPV6)) {
-                       IP6_ECN_set_ce(skb->nh.ipv6h);
+                       IP6_ECN_set_ce(ipv6_hdr(skb));
                }
        }
 }
@@ -721,7 +721,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
                        addr_type = ipv6_addr_type(addr6);
 
                        if (addr_type == IPV6_ADDR_ANY) {
-                               addr6 = &skb->nh.ipv6h->daddr;
+                               addr6 = &ipv6_hdr(skb)->daddr;
                                addr_type = ipv6_addr_type(addr6);
                        }
 
index faa1b9a76e763fc9479ae94259ff9f2ad6a59e06..edba75610a4620d51c5d495172992a5998c87154 100644 (file)
@@ -26,7 +26,7 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
 static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
 {
        if (INET_ECN_is_ce(iph->tos))
-               IP6_ECN_set_ce(skb->nh.ipv6h);
+               IP6_ECN_set_ce(ipv6_hdr(skb));
 }
 
 /* Add encapsulation header.
index 1c914386982f653b011c8abdc05ad944ee2fda9c..b682d2368c2a5154e48eedb017ee8a3400590cb5 100644 (file)
@@ -325,6 +325,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
         */
 
        struct ipv6_auth_hdr *ah;
+       struct ipv6hdr *ip6h;
        struct ah_data *ahp;
        unsigned char *tmp_hdr = NULL;
        u16 hdr_len;
@@ -357,13 +358,14 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
        tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC);
        if (!tmp_hdr)
                goto out;
-       if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len, XFRM_POLICY_IN))
+       ip6h = ipv6_hdr(skb);
+       if (ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN))
                goto free_out;
-       skb->nh.ipv6h->priority    = 0;
-       skb->nh.ipv6h->flow_lbl[0] = 0;
-       skb->nh.ipv6h->flow_lbl[1] = 0;
-       skb->nh.ipv6h->flow_lbl[2] = 0;
-       skb->nh.ipv6h->hop_limit   = 0;
+       ip6h->priority    = 0;
+       ip6h->flow_lbl[0] = 0;
+       ip6h->flow_lbl[1] = 0;
+       ip6h->flow_lbl[2] = 0;
+       ip6h->hop_limit   = 0;
 
        {
                u8 auth_data[MAX_AH_AUTH_LEN];
index ac95d3bfdfb76fc0a8c27ea1d6bedd48e83579a2..f429290c2c3780ade4ebb03d88c1c551552fbf82 100644 (file)
@@ -254,7 +254,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
 
        skb_put(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
        ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
 
        serr = SKB_EXT_ERR(skb);
@@ -340,7 +340,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
                sin->sin6_flowinfo = 0;
                sin->sin6_scope_id = 0;
                if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
-                       ipv6_addr_copy(&sin->sin6_addr, &skb->nh.ipv6h->saddr);
+                       ipv6_addr_copy(&sin->sin6_addr, &ipv6_hdr(skb)->saddr);
                        if (np->rxopt.all)
                                datagram_recv_ctl(sk, msg, skb);
                        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)
                struct in6_pktinfo src_info;
 
                src_info.ipi6_ifindex = opt->iif;
-               ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr);
+               ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
                put_cmsg(msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);
        }
 
        if (np->rxopt.bits.rxhlim) {
-               int hlim = skb->nh.ipv6h->hop_limit;
+               int hlim = ipv6_hdr(skb)->hop_limit;
                put_cmsg(msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
        }
 
        if (np->rxopt.bits.rxtclass) {
-               int tclass = (ntohl(*(__be32 *)skb->nh.ipv6h) >> 20) & 0xff;
+               int tclass = (ntohl(*(__be32 *)ipv6_hdr(skb)) >> 20) & 0xff;
                put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
        }
 
@@ -428,7 +428,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
                 * IPV6_RECVDSTOPTS is more generic. --yoshfuji
                 */
                unsigned int off = sizeof(struct ipv6hdr);
-               u8 nexthdr = skb->nh.ipv6h->nexthdr;
+               u8 nexthdr = ipv6_hdr(skb)->nexthdr;
 
                while (off <= opt->lastopt) {
                        unsigned len;
@@ -466,11 +466,11 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
                struct in6_pktinfo src_info;
 
                src_info.ipi6_ifindex = opt->iif;
-               ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr);
+               ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
                put_cmsg(msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);
        }
        if (np->rxopt.bits.rxohlim) {
-               int hlim = skb->nh.ipv6h->hop_limit;
+               int hlim = ipv6_hdr(skb)->hop_limit;
                put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);
        }
        if (np->rxopt.bits.ohopopts && opt->hop) {
index 6e6b57ac80134062cefa64fa7e16c31e7b200fe4..7aff380e74ef9f9eea0be386b8f420b6783db4e6 100644 (file)
@@ -191,7 +191,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
        skb->ip_summed = CHECKSUM_NONE;
 
        esph = (struct ipv6_esp_hdr*)skb->data;
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        /* Get ivec. This can be wrong, check against another impls. */
        if (esp->conf.ivlen)
index 9ebf120ba6d3b83a0a471a38d93646feb621613b..dab069b0b3f6e1bdccd8434876ffd0c9dd2dfff3 100644 (file)
@@ -125,7 +125,7 @@ static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
                /* Actually, it is redundant check. icmp_send
                   will recheck in any case.
                 */
-               if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr))
+               if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr))
                        break;
        case 2: /* send ICMP PARM PROB regardless and drop packet */
                icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
@@ -202,7 +202,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
        struct sk_buff *skb = *skbp;
        struct ipv6_destopt_hao *hao;
        struct inet6_skb_parm *opt = IP6CB(skb);
-       struct ipv6hdr *ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
        struct in6_addr tmp_addr;
        int ret;
 
@@ -248,7 +248,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
                *skbp = skb = skb2;
                hao = (struct ipv6_destopt_hao *)(skb_network_header(skb2) +
                                                  optoff);
-               ipv6h = skb2->nh.ipv6h;
+               ipv6h = ipv6_hdr(skb2);
        }
 
        if (skb->ip_summed == CHECKSUM_COMPLETE)
@@ -414,7 +414,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
                return -1;
        }
 
-       if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
+       if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) ||
            skb->pkt_type != PACKET_HOST) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                 IPSTATS_MIB_INADDRERRORS);
@@ -522,7 +522,7 @@ looped_back:
 #ifdef CONFIG_IPV6_MIP6
        case IPV6_SRCRT_TYPE_2:
                if (xfrm6_input_addr(skb, (xfrm_address_t *)addr,
-                                    (xfrm_address_t *)&skb->nh.ipv6h->saddr,
+                                    (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
                                     IPPROTO_ROUTING) < 0) {
                        IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                         IPSTATS_MIB_INADDRERRORS);
@@ -549,8 +549,8 @@ looped_back:
        }
 
        ipv6_addr_copy(&daddr, addr);
-       ipv6_addr_copy(addr, &skb->nh.ipv6h->daddr);
-       ipv6_addr_copy(&skb->nh.ipv6h->daddr, &daddr);
+       ipv6_addr_copy(addr, &ipv6_hdr(skb)->daddr);
+       ipv6_addr_copy(&ipv6_hdr(skb)->daddr, &daddr);
 
        dst_release(xchg(&skb->dst, NULL));
        ip6_route_input(skb);
@@ -561,7 +561,7 @@ looped_back:
        }
 
        if (skb->dst->dev->flags&IFF_LOOPBACK) {
-               if (skb->nh.ipv6h->hop_limit <= 1) {
+               if (ipv6_hdr(skb)->hop_limit <= 1) {
                        IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                         IPSTATS_MIB_INHDRERRORS);
                        icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
@@ -569,7 +569,7 @@ looped_back:
                        kfree_skb(skb);
                        return -1;
                }
-               skb->nh.ipv6h->hop_limit--;
+               ipv6_hdr(skb)->hop_limit--;
                goto looped_back;
        }
 
@@ -698,7 +698,7 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
                return 0;
        }
-       if (skb->nh.ipv6h->payload_len) {
+       if (ipv6_hdr(skb)->payload_len) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
                return 0;
index e5293b34229f2627fb62d675552966406384475f..3a01effda6955ba3bb8b86134dc93c37427e9bcf 100644 (file)
@@ -129,9 +129,9 @@ void icmpv6_param_prob(struct sk_buff *skb, int code, int pos)
 
 static int is_ineligible(struct sk_buff *skb)
 {
-       int ptr = (u8*)(skb->nh.ipv6h+1) - skb->data;
+       int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
        int len = skb->len - ptr;
-       __u8 nexthdr = skb->nh.ipv6h->nexthdr;
+       __u8 nexthdr = ipv6_hdr(skb)->nexthdr;
 
        if (len < 0)
                return 1;
@@ -275,7 +275,7 @@ static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, st
 #ifdef CONFIG_IPV6_MIP6
 static void mip6_addr_swap(struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = skb->nh.ipv6h;
+       struct ipv6hdr *iph = ipv6_hdr(skb);
        struct inet6_skb_parm *opt = IP6CB(skb);
        struct ipv6_destopt_hao *hao;
        struct in6_addr tmp;
@@ -303,7 +303,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
                 struct net_device *dev)
 {
        struct inet6_dev *idev = NULL;
-       struct ipv6hdr *hdr = skb->nh.ipv6h;
+       struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct sock *sk;
        struct ipv6_pinfo *np;
        struct in6_addr *saddr = NULL;
@@ -485,7 +485,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
        int hlimit;
        int tclass;
 
-       saddr = &skb->nh.ipv6h->daddr;
+       saddr = &ipv6_hdr(skb)->daddr;
 
        if (!ipv6_unicast_destination(skb))
                saddr = NULL;
@@ -495,7 +495,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
 
        memset(&fl, 0, sizeof(fl));
        fl.proto = IPPROTO_ICMPV6;
-       ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
+       ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
        if (saddr)
                ipv6_addr_copy(&fl.fl6_src, saddr);
        fl.oif = skb->dev->ifindex;
@@ -583,8 +583,8 @@ static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info)
        if (!pskb_may_pull(skb, inner_offset+8))
                return;
 
-       saddr = &skb->nh.ipv6h->saddr;
-       daddr = &skb->nh.ipv6h->daddr;
+       saddr = &ipv6_hdr(skb)->saddr;
+       daddr = &ipv6_hdr(skb)->daddr;
 
        /* BUGGG_FUTURE: we should try to parse exthdrs in this packet.
           Without this we will not able f.e. to make source routed
@@ -628,8 +628,8 @@ static int icmpv6_rcv(struct sk_buff **pskb)
 
        ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS);
 
-       saddr = &skb->nh.ipv6h->saddr;
-       daddr = &skb->nh.ipv6h->daddr;
+       saddr = &ipv6_hdr(skb)->saddr;
+       daddr = &ipv6_hdr(skb)->daddr;
 
        /* Perform checksum. */
        switch (skb->ip_summed) {
index aecc74da0721b4a52afb451486a9c004128ba1a4..9c3c787a21c10699a0a38e6074fb2cbe0f1da005 100644 (file)
@@ -96,7 +96,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
                goto err;
 
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
 
        if (hdr->version != 6)
                goto err;
@@ -116,7 +116,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
                        IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
                        goto drop;
                }
-               hdr = skb->nh.ipv6h;
+               hdr = ipv6_hdr(skb);
        }
 
        if (hdr->nexthdr == NEXTHDR_HOP) {
@@ -183,7 +183,7 @@ resubmit:
 
                        skb_postpull_rcsum(skb, skb_network_header(skb),
                                           skb->h.raw - skb->nh.raw);
-                       hdr = skb->nh.ipv6h;
+                       hdr = ipv6_hdr(skb);
                        if (ipv6_addr_is_multicast(&hdr->daddr) &&
                            !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
                            &hdr->saddr) &&
@@ -234,7 +234,7 @@ int ip6_mc_input(struct sk_buff *skb)
 
        IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
 
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
        deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
            ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
 
index bd25825c0ccd48d4bad6cfdea1e1c0ed937d8d4c..1900c6226866771587194556de576ade1d11ab2d 100644 (file)
@@ -107,13 +107,13 @@ static int ip6_output2(struct sk_buff *skb)
        skb->protocol = htons(ETH_P_IPV6);
        skb->dev = dev;
 
-       if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr)) {
+       if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
                struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
                struct inet6_dev *idev = ip6_dst_idev(skb->dst);
 
                if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
-                   ipv6_chk_mcast_addr(dev, &skb->nh.ipv6h->daddr,
-                               &skb->nh.ipv6h->saddr)) {
+                   ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
+                                       &ipv6_hdr(skb)->saddr)) {
                        struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
 
                        /* Do not check for IFF_ALLMULTI; multicast routing
@@ -124,7 +124,7 @@ static int ip6_output2(struct sk_buff *skb)
                                        newskb->dev,
                                        ip6_dev_loopback_xmit);
 
-                       if (skb->nh.ipv6h->hop_limit == 0) {
+                       if (ipv6_hdr(skb)->hop_limit == 0) {
                                IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS);
                                kfree_skb(skb);
                                return 0;
@@ -193,7 +193,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
 
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
 
        /*
         *      Fill in the IPv6 header
@@ -263,8 +263,8 @@ int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
 
        totlen = len + sizeof(struct ipv6hdr);
 
-       hdr = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr));
-       skb->nh.ipv6h = hdr;
+       skb->nh.raw = skb_put(skb, sizeof(struct ipv6hdr));
+       hdr = ipv6_hdr(skb);
 
        *(__be32*)hdr = htonl(0x60000000);
 
@@ -309,7 +309,7 @@ static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
 
 static int ip6_forward_proxy_check(struct sk_buff *skb)
 {
-       struct ipv6hdr *hdr = skb->nh.ipv6h;
+       struct ipv6hdr *hdr = ipv6_hdr(skb);
        u8 nexthdr = hdr->nexthdr;
        int offset;
 
@@ -366,7 +366,7 @@ static inline int ip6_forward_finish(struct sk_buff *skb)
 int ip6_forward(struct sk_buff *skb)
 {
        struct dst_entry *dst = skb->dst;
-       struct ipv6hdr *hdr = skb->nh.ipv6h;
+       struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct inet6_skb_parm *opt = IP6CB(skb);
 
        if (ipv6_devconf.forwarding == 0)
@@ -475,7 +475,7 @@ int ip6_forward(struct sk_buff *skb)
                goto drop;
        }
 
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
 
        /* Mangling hops number delayed to point after skb COW */
 
@@ -527,10 +527,11 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
 int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
 {
        u16 offset = sizeof(struct ipv6hdr);
-       struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
+       struct ipv6_opt_hdr *exthdr =
+                               (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
        unsigned int packet_len = skb->tail - skb_network_header(skb);
        int found_rhdr = 0;
-       *nexthdr = &skb->nh.ipv6h->nexthdr;
+       *nexthdr = &ipv6_hdr(skb)->nexthdr;
 
        while (offset + 1 <= packet_len) {
 
@@ -643,7 +644,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
                first_len = skb_pagelen(skb);
                skb->data_len = first_len - skb_headlen(skb);
                skb->len = first_len;
-               skb->nh.ipv6h->payload_len = htons(first_len - sizeof(struct ipv6hdr));
+               ipv6_hdr(skb)->payload_len = htons(first_len -
+                                                  sizeof(struct ipv6hdr));
 
                dst_hold(&rt->u.dst);
 
@@ -665,7 +667,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
                                if (frag->next != NULL)
                                        fh->frag_off |= htons(IP6_MF);
                                fh->identification = frag_id;
-                               frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
+                               ipv6_hdr(frag)->payload_len =
+                                               htons(frag->len -
+                                                     sizeof(struct ipv6hdr));
                                ip6_copy_metadata(frag, skb);
                        }
 
@@ -779,7 +783,8 @@ slow_path:
                fh->frag_off = htons(offset);
                if (left > 0)
                        fh->frag_off |= htons(IP6_MF);
-               frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
+               ipv6_hdr(frag)->payload_len = htons(frag->len -
+                                                   sizeof(struct ipv6hdr));
 
                ptr += len;
                offset += len;
@@ -1355,7 +1360,7 @@ int ip6_push_pending_frames(struct sock *sk)
 
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
 
        *(__be32*)hdr = fl->fl6_flowlabel |
                     htonl(0x60000000 | ((int)np->cork.tclass << 20));
index bb65779be7a6072e70d8ab32497d4fb08cea58a3..05b59a77bc6922fe7df96a99ea92b6fb9ce573ff 100644 (file)
@@ -602,7 +602,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                skb_reset_network_header(skb2);
 
                /* Try to guess incoming interface */
-               rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
+               rt = rt6_lookup(&ipv6_hdr(skb2)->saddr, NULL, 0, 0);
 
                if (rt && rt->rt6i_dev)
                        skb2->dev = rt->rt6i_dev;
@@ -636,10 +636,10 @@ static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
                                        struct sk_buff *skb)
 {
        if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
-               ipv6_copy_dscp(ipv6h, skb->nh.ipv6h);
+               ipv6_copy_dscp(ipv6h, ipv6_hdr(skb));
 
        if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
-               IP6_ECN_set_ce(skb->nh.ipv6h);
+               IP6_ECN_set_ce(ipv6_hdr(skb));
 }
 
 static 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,
                                                    struct ipv6hdr *ipv6h,
                                                    struct sk_buff *skb))
 {
-       struct ipv6hdr *ipv6h;
        struct ip6_tnl *t;
-
-       ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
        read_lock(&ip6_tnl_lock);
 
@@ -836,7 +834,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
 {
        struct ip6_tnl *t = netdev_priv(dev);
        struct net_device_stats *stats = &t->stat;
-       struct ipv6hdr *ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
        struct ipv6_tel_txoption opt;
        struct dst_entry *dst;
        struct net_device *tdev;
@@ -909,7 +907,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
        }
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
-       ipv6h = skb->nh.ipv6h;
+       ipv6h = ipv6_hdr(skb);
        *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
        dsfield = INET_ECN_encapsulate(0, dsfield);
        ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
@@ -983,7 +981,7 @@ static inline int
 ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ip6_tnl *t = netdev_priv(dev);
-       struct ipv6hdr *ipv6h = skb->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
        int encap_limit = -1;
        __u16 offset;
        struct flowi fl;
index 3e71d1691b7dd862deeb276fb2607a09d53e4ca9..e2404a62968056afdacb013489ad31929f9b2c65 100644 (file)
@@ -79,7 +79,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
        skb->ip_summed = CHECKSUM_NONE;
 
        /* Remove ipcomp header and decompress original payload */
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
        ipch = (void *)skb->data;
        skb->h.raw = skb->nh.raw + sizeof(*ipch);
        __skb_pull(skb, sizeof(*ipch));
index 1d56b465bddb761bd080fe34818b272f5ec664f6..d16e0fd2cd89d02f291cebdbf4880c1fe0a6e0db 100644 (file)
@@ -101,7 +101,7 @@ static int ipv6_gso_send_check(struct sk_buff *skb)
        if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
                goto out;
 
-       ipv6h = skb->nh.ipv6h;
+       ipv6h = ipv6_hdr(skb);
        __skb_pull(skb, sizeof(*ipv6h));
        err = -EPROTONOSUPPORT;
 
@@ -137,7 +137,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
        if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
                goto out;
 
-       ipv6h = skb->nh.ipv6h;
+       ipv6h = ipv6_hdr(skb);
        __skb_pull(skb, sizeof(*ipv6h));
        segs = ERR_PTR(-EPROTONOSUPPORT);
 
@@ -153,7 +153,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
                goto out;
 
        for (skb = segs; skb; skb = skb->next) {
-               ipv6h = skb->nh.ipv6h;
+               ipv6h = ipv6_hdr(skb);
                ipv6h->payload_len = htons(skb->len - skb->mac_len -
                                           sizeof(*ipv6h));
        }
index 924e24907c3ef9a0fd54c3505141e11286c9509b..b2b37ba48b9c59c18693840efb4a11ad5516c234 100644 (file)
@@ -1167,11 +1167,11 @@ int igmp6_event_query(struct sk_buff *skb)
                return -EINVAL;
 
        /* compute payload length excluding extension headers */
-       len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
-       len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h;
+       len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr);
+       len -= skb->h.raw - skb->nh.raw;
 
        /* Drop queries with not link local source */
-       if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL))
+       if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL))
                return -EINVAL;
 
        idev = in6_dev_get(skb->dev);
@@ -1303,7 +1303,7 @@ int igmp6_event_report(struct sk_buff *skb)
        hdr = (struct icmp6hdr*) skb->h.raw;
 
        /* Drop reports with not link local source */
-       addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr);
+       addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
        if (addr_type != IPV6_ADDR_ANY &&
            !(addr_type&IPV6_ADDR_LINKLOCAL))
                return -EINVAL;
@@ -1441,7 +1441,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
                unsigned char ha[MAX_ADDR_LEN];
                int err;
 
-               ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1);
+               ndisc_mc_map(&ipv6_hdr(skb)->daddr, ha, dev, 1);
                err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
                if (err < 0) {
                        kfree_skb(skb);
@@ -1459,15 +1459,14 @@ static inline int mld_dev_queue_xmit(struct sk_buff *skb)
 
 static void mld_sendpack(struct sk_buff *skb)
 {
-       struct ipv6hdr *pip6 = skb->nh.ipv6h;
+       struct ipv6hdr *pip6 = ipv6_hdr(skb);
        struct mld2_report *pmr = (struct mld2_report *)skb->h.raw;
        int payload_len, mldlen;
        struct inet6_dev *idev = in6_dev_get(skb->dev);
        int err;
 
        IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
-       payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h -
-               sizeof(struct ipv6hdr);
+       payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6);
        mldlen = skb->tail - skb->h.raw;
        pip6->payload_len = htons(payload_len);
 
index bb4033553f3b8c7fd6d5b2639129d1e236d6c278..7b5f9d82e80145ddce339eb70d6bc9873d805eb4 100644 (file)
@@ -129,7 +129,7 @@ static struct mip6_report_rate_limiter mip6_report_rl = {
 
 static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = skb->nh.ipv6h;
+       struct ipv6hdr *iph = ipv6_hdr(skb);
        struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
 
        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
 
        skb_get_timestamp(skb, &stamp);
 
-       if (!mip6_report_rl_allow(&stamp, &skb->nh.ipv6h->daddr,
-                                 hao ? &hao->addr : &skb->nh.ipv6h->saddr,
+       if (!mip6_report_rl_allow(&stamp, &ipv6_hdr(skb)->daddr,
+                                 hao ? &hao->addr : &ipv6_hdr(skb)->saddr,
                                  opt->iif))
                goto out;
 
        memset(&sel, 0, sizeof(sel));
-       memcpy(&sel.daddr, (xfrm_address_t *)&skb->nh.ipv6h->daddr,
+       memcpy(&sel.daddr, (xfrm_address_t *)&ipv6_hdr(skb)->daddr,
               sizeof(sel.daddr));
        sel.prefixlen_d = 128;
-       memcpy(&sel.saddr, (xfrm_address_t *)&skb->nh.ipv6h->saddr,
+       memcpy(&sel.saddr, (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
               sizeof(sel.saddr));
        sel.prefixlen_s = 128;
        sel.family = AF_INET6;
@@ -256,12 +256,13 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb,
                               u8 **nexthdr)
 {
        u16 offset = sizeof(struct ipv6hdr);
-       struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
+       struct ipv6_opt_hdr *exthdr =
+                                  (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
        const unsigned char *nh = skb_network_header(skb);
        unsigned int packet_len = skb->tail - nh;
        int found_rhdr = 0;
 
-       *nexthdr = &skb->nh.ipv6h->nexthdr;
+       *nexthdr = &ipv6_hdr(skb)->nexthdr;
 
        while (offset + 1 <= packet_len) {
 
@@ -387,12 +388,13 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb,
                             u8 **nexthdr)
 {
        u16 offset = sizeof(struct ipv6hdr);
-       struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
+       struct ipv6_opt_hdr *exthdr =
+                                  (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
        const unsigned char *nh = skb_network_header(skb);
        unsigned int packet_len = skb->tail - nh;
        int found_rhdr = 0;
 
-       *nexthdr = &skb->nh.ipv6h->nexthdr;
+       *nexthdr = &ipv6_hdr(skb)->nexthdr;
 
        while (offset + 1 <= packet_len) {
 
index a3e3d9e2f44bd8924b80d2e91b576ee59ade4310..00feb4c4d98b580b11aa01356e302677b22eae91 100644 (file)
@@ -598,7 +598,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
                                       dev->addr_len, dev->type);
 
        /* checksum */
-       msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr,
+       msg->icmph.icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                                                 daddr, len,
                                                 IPPROTO_ICMPV6,
                                                 csum_partial((__u8 *) msg,
@@ -697,7 +697,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
                                       dev->addr_len, dev->type);
 
        /* checksum */
-       hdr->icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, daddr, len,
+       hdr->icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr, daddr, len,
                                           IPPROTO_ICMPV6,
                                           csum_partial((__u8 *) hdr, len, 0));
 
@@ -736,8 +736,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
        struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
        int probes = atomic_read(&neigh->probes);
 
-       if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev, 1))
-               saddr = &skb->nh.ipv6h->saddr;
+       if (skb && ipv6_chk_addr(&ipv6_hdr(skb)->saddr, dev, 1))
+               saddr = &ipv6_hdr(skb)->saddr;
 
        if ((probes -= neigh->parms->ucast_probes) < 0) {
                if (!(neigh->nud_state & NUD_VALID)) {
@@ -761,8 +761,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
 static void ndisc_recv_ns(struct sk_buff *skb)
 {
        struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
-       struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
-       struct in6_addr *daddr = &skb->nh.ipv6h->daddr;
+       struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
+       struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
        u8 *lladdr = NULL;
        u32 ndoptlen = skb->tail - msg->opt;
        struct ndisc_options ndopts;
@@ -939,8 +939,8 @@ out:
 static void ndisc_recv_na(struct sk_buff *skb)
 {
        struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
-       struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
-       struct in6_addr *daddr = &skb->nh.ipv6h->daddr;
+       struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
+       struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
        u8 *lladdr = NULL;
        u32 ndoptlen = skb->tail - msg->opt;
        struct ndisc_options ndopts;
@@ -1044,7 +1044,7 @@ static void ndisc_recv_rs(struct sk_buff *skb)
        unsigned long ndoptlen = skb->len - sizeof(*rs_msg);
        struct neighbour *neigh;
        struct inet6_dev *idev;
-       struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
+       struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
        struct ndisc_options ndopts;
        u8 *lladdr = NULL;
 
@@ -1110,7 +1110,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
        optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg);
 
-       if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) {
+       if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
                           "ICMPv6 RA: source address is not link-local.\n");
                return;
@@ -1176,7 +1176,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
                pref = ICMPV6_ROUTER_PREF_MEDIUM;
 #endif
 
-       rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
+       rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
 
        if (rt)
                neigh = rt->rt6i_nexthop;
@@ -1191,7 +1191,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
                ND_PRINTK3(KERN_DEBUG
                           "ICMPv6 RA: adding default router.\n");
 
-               rt = rt6_add_dflt_router(&skb->nh.ipv6h->saddr, skb->dev, pref);
+               rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
                if (rt == NULL) {
                        ND_PRINTK0(KERN_ERR
                                   "ICMPv6 RA: %s() failed to add default route.\n",
@@ -1263,7 +1263,7 @@ skip_defrtr:
         */
 
        if (!neigh)
-               neigh = __neigh_lookup(&nd_tbl, &skb->nh.ipv6h->saddr,
+               neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
                                       skb->dev, 1);
        if (neigh) {
                u8 *lladdr = NULL;
@@ -1292,7 +1292,7 @@ skip_defrtr:
                        if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
                                continue;
                        rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
-                                     &skb->nh.ipv6h->saddr);
+                                     &ipv6_hdr(skb)->saddr);
                }
        }
 #endif
@@ -1351,7 +1351,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
        int optlen;
        u8 *lladdr = NULL;
 
-       if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) {
+       if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
                           "ICMPv6 Redirect: source address is not link-local.\n");
                return;
@@ -1416,8 +1416,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 
        neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1);
        if (neigh) {
-               rt6_redirect(dest, &skb->nh.ipv6h->daddr,
-                            &skb->nh.ipv6h->saddr, neigh, lladdr,
+               rt6_redirect(dest, &ipv6_hdr(skb)->daddr,
+                            &ipv6_hdr(skb)->saddr, neigh, lladdr,
                             on_link);
                neigh_release(neigh);
        }
@@ -1453,14 +1453,14 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
                return;
        }
 
-       if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) &&
+       if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
            !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
                        "ICMPv6 Redirect: target address is not link-local.\n");
                return;
        }
 
-       ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr,
+       ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &ipv6_hdr(skb)->saddr,
                        dev->ifindex);
 
        dst = ip6_route_output(NULL, &fl);
@@ -1515,7 +1515,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        hlen = 0;
 
        skb_reserve(buff, LL_RESERVED_SPACE(dev));
-       ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr,
+       ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
                   IPPROTO_ICMPV6, len);
 
        icmph = (struct icmp6hdr *)skb_put(buff, len);
@@ -1531,7 +1531,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        addrp = (struct in6_addr *)(icmph + 1);
        ipv6_addr_copy(addrp, target);
        addrp++;
-       ipv6_addr_copy(addrp, &skb->nh.ipv6h->daddr);
+       ipv6_addr_copy(addrp, &ipv6_hdr(skb)->daddr);
 
        opt = (u8*) (addrp + 1);
 
@@ -1552,9 +1552,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        *(opt++) = (rd_len >> 3);
        opt += 6;
 
-       memcpy(opt, skb->nh.ipv6h, rd_len - 8);
+       memcpy(opt, ipv6_hdr(skb), rd_len - 8);
 
-       icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &skb->nh.ipv6h->saddr,
+       icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
                                             len, IPPROTO_ICMPV6,
                                             csum_partial((u8 *) icmph, len, 0));
 
@@ -1588,10 +1588,10 @@ int ndisc_rcv(struct sk_buff *skb)
 
        __skb_push(skb, skb->data-skb->h.raw);
 
-       if (skb->nh.ipv6h->hop_limit != 255) {
+       if (ipv6_hdr(skb)->hop_limit != 255) {
                ND_PRINTK2(KERN_WARNING
                           "ICMPv6 NDISC: invalid hop-limit: %d\n",
-                          skb->nh.ipv6h->hop_limit);
+                          ipv6_hdr(skb)->hop_limit);
                return 0;
        }
 
index 1c405dd30c67b5996483a513009e76e5706137fe..38b14961391520a2cbba05d75d8749800ca31ae0 100644 (file)
@@ -11,7 +11,7 @@
 
 int ip6_route_me_harder(struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = skb->nh.ipv6h;
+       struct ipv6hdr *iph = ipv6_hdr(skb);
        struct dst_entry *dst;
        struct flowi fl = {
                .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)
        struct ip6_rt_info *rt_info = nf_info_reroute(info);
 
        if (info->hook == NF_IP6_LOCAL_OUT) {
-               struct ipv6hdr *iph = skb->nh.ipv6h;
+               struct ipv6hdr *iph = ipv6_hdr(skb);
 
                rt_info->daddr = iph->daddr;
                rt_info->saddr = iph->saddr;
@@ -73,7 +73,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
        struct ip6_rt_info *rt_info = nf_info_reroute(info);
 
        if (info->hook == NF_IP6_LOCAL_OUT) {
-               struct ipv6hdr *iph = (*pskb)->nh.ipv6h;
+               struct ipv6hdr *iph = ipv6_hdr(*pskb);
                if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
                    !ipv6_addr_equal(&iph->saddr, &rt_info->saddr))
                        return ip6_route_me_harder(*pskb);
@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
 __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
                             unsigned int dataoff, u_int8_t protocol)
 {
-       struct ipv6hdr *ip6h = skb->nh.ipv6h;
+       struct ipv6hdr *ip6h = ipv6_hdr(skb);
        __sum16 csum = 0;
 
        switch (skb->ip_summed) {
index 7c512e13f9563b31f9f47579bb671d47e12ee5b2..caf9e375a0f112bb27d5923c522865be9b252069 100644 (file)
@@ -115,7 +115,7 @@ ip6_packet_match(const struct sk_buff *skb,
 {
        size_t i;
        unsigned long ret;
-       const struct ipv6hdr *ipv6 = skb->nh.ipv6h;
+       const struct ipv6hdr *ipv6 = ipv6_hdr(skb);
 
 #define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg))
 
@@ -301,7 +301,7 @@ ip6t_do_table(struct sk_buff **pskb,
                                goto no_match;
 
                        ADD_COUNTER(e->counters,
-                                   ntohs((*pskb)->nh.ipv6h->payload_len)
+                                   ntohs(ipv6_hdr(*pskb)->payload_len)
                                    + IPV6_HDR_LEN,
                                    1);
 
@@ -1448,8 +1448,8 @@ static void __exit ip6_tables_fini(void)
 int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
                  int target, unsigned short *fragoff)
 {
-       unsigned int start = (u8*)(skb->nh.ipv6h + 1) - skb->data;
-       u8 nexthdr = skb->nh.ipv6h->nexthdr;
+       unsigned int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
+       u8 nexthdr = ipv6_hdr(skb)->nexthdr;
        unsigned int len = skb->len - start;
 
        if (fragoff)
index ccbab66277e37d25918eea826c6a35059864a8f4..4115a576ba25df785d06bd9498df6e02c9f60cdb 100644 (file)
@@ -32,7 +32,7 @@ static unsigned int ip6t_hl_target(struct sk_buff **pskb,
        if (!skb_make_writable(pskb, (*pskb)->len))
                return NF_DROP;
 
-       ip6h = (*pskb)->nh.ipv6h;
+       ip6h = ipv6_hdr(*pskb);
 
        switch (info->mode) {
                case IP6T_HL_SET:
index fc9e51a77784a537ad06d2524c0917f9135cb918..54d176187f3f44a3c5e97f36f93605656c860394 100644 (file)
@@ -422,7 +422,7 @@ ip6t_log_packet(unsigned int pf,
                        printk(" ");
        }
 
-       dump_packet(loginfo, skb, (u8*)skb->nh.ipv6h - skb->data, 1);
+       dump_packet(loginfo, skb, skb_network_offset(skb), 1);
        printk("\n");
        spin_unlock_bh(&log_lock);
 }
index 4441bed430f87bd2c39503dd64e786e9b8f656ed..cb3d2415a0645c5eee3759902b99ed77d88405f1 100644 (file)
@@ -47,7 +47,7 @@ static void send_reset(struct sk_buff *oldskb)
        struct tcphdr otcph, *tcph;
        unsigned int otcplen, hh_len;
        int tcphoff, needs_ack;
-       struct ipv6hdr *oip6h = oldskb->nh.ipv6h, *ip6h;
+       struct ipv6hdr *oip6h = ipv6_hdr(oldskb), *ip6h;
        struct dst_entry *dst = NULL;
        u8 proto;
        struct flowi fl;
@@ -122,7 +122,7 @@ static void send_reset(struct sk_buff *oldskb)
 
        skb_put(nskb, sizeof(struct ipv6hdr));
        skb_reset_network_header(nskb);
-       ip6h = nskb->nh.ipv6h;
+       ip6h = ipv6_hdr(nskb);
        ip6h->version = 6;
        ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT);
        ip6h->nexthdr = IPPROTO_TCP;
@@ -156,8 +156,8 @@ static void send_reset(struct sk_buff *oldskb)
        tcph->check = 0;
 
        /* Adjust TCP checksum */
-       tcph->check = csum_ipv6_magic(&nskb->nh.ipv6h->saddr,
-                                     &nskb->nh.ipv6h->daddr,
+       tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
+                                     &ipv6_hdr(nskb)->daddr,
                                      sizeof(struct tcphdr), IPPROTO_TCP,
                                      csum_partial((char *)tcph,
                                                   sizeof(struct tcphdr), 0));
index c2676066a80fcca6e1e2c655018a94c3e1e89ac4..0f3dd932f0a627cdbb29000ec6b7a9e416159ee4 100644 (file)
@@ -42,7 +42,7 @@ match(const struct sk_buff *skb,
        memset(eui64, 0, sizeof(eui64));
 
        if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {
-               if (skb->nh.ipv6h->version == 0x6) {
+               if (ipv6_hdr(skb)->version == 0x6) {
                        memcpy(eui64, eth_hdr(skb)->h_source, 3);
                        memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
                        eui64[3] = 0xff;
@@ -50,7 +50,7 @@ match(const struct sk_buff *skb,
                        eui64[0] |= 0x02;
 
                        i = 0;
-                       while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == eui64[i])
+                       while ((ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i])
                               && (i < 8))
                                i++;
 
index 37c8a4d4ed78d9417ac5eb31e6b98d739dc76983..d606c0e6d6fd65aeecf690fdbb6a9fce31a04a21 100644 (file)
@@ -25,7 +25,7 @@ static int match(const struct sk_buff *skb,
                 int offset, unsigned int protoff, int *hotdrop)
 {
        const struct ip6t_hl_info *info = matchinfo;
-       const struct ipv6hdr *ip6h = skb->nh.ipv6h;
+       const struct ipv6hdr *ip6h = ipv6_hdr(skb);
 
        switch (info->mode) {
                case IP6T_HL_EQ:
index 700a11d25deb02c287641b030637ab038bc9a896..fd6a0869099b6034d3f8a031a320d36e829a4994 100644 (file)
@@ -45,7 +45,7 @@ ipv6header_match(const struct sk_buff *skb,
        /* Make sure this isn't an evil packet */
 
        /* type of the 1st exthdr */
-       nexthdr = skb->nh.ipv6h->nexthdr;
+       nexthdr = ipv6_hdr(skb)->nexthdr;
        /* pointer to the 1st exthdr */
        ptr = sizeof(struct ipv6hdr);
        /* available length */
index da2c1994539b3d73e471786898f8ada0d6a5cdc3..85b1c272946cbc284c30da1fcf6e259bf2c82287 100644 (file)
@@ -146,21 +146,21 @@ ip6t_local_hook(unsigned int hook,
 #endif
 
        /* save source/dest address, mark, hoplimit, flowlabel, priority,  */
-       memcpy(&saddr, &(*pskb)->nh.ipv6h->saddr, sizeof(saddr));
-       memcpy(&daddr, &(*pskb)->nh.ipv6h->daddr, sizeof(daddr));
+       memcpy(&saddr, &ipv6_hdr(*pskb)->saddr, sizeof(saddr));
+       memcpy(&daddr, &ipv6_hdr(*pskb)->daddr, sizeof(daddr));
        mark = (*pskb)->mark;
-       hop_limit = (*pskb)->nh.ipv6h->hop_limit;
+       hop_limit = ipv6_hdr(*pskb)->hop_limit;
 
        /* flowlabel and prio (includes version, which shouldn't change either */
-       flowlabel = *((u_int32_t *) (*pskb)->nh.ipv6h);
+       flowlabel = *((u_int32_t *)ipv6_hdr(*pskb));
 
        ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
 
        if (ret != NF_DROP && ret != NF_STOLEN
-               && (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr))
-                   || memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr))
+               && (memcmp(&ipv6_hdr(*pskb)->saddr, &saddr, sizeof(saddr))
+                   || memcmp(&ipv6_hdr(*pskb)->daddr, &daddr, sizeof(daddr))
                    || (*pskb)->mark != mark
-                   || (*pskb)->nh.ipv6h->hop_limit != hop_limit))
+                   || ipv6_hdr(*pskb)->hop_limit != hop_limit))
                return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP;
 
        return ret;
index d1102455668d43db1ba803253df51bc92b583235..fe7f46c4dbff319e2e32d1998f1509c78ff9f031 100644 (file)
@@ -138,16 +138,10 @@ static int
 ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,
             u_int8_t *protonum)
 {
-       unsigned int extoff;
-       unsigned char pnum;
-       int protoff;
-
-       extoff = (u8*)((*pskb)->nh.ipv6h + 1) - (*pskb)->data;
-       pnum = (*pskb)->nh.ipv6h->nexthdr;
-
-       protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
-                                        (*pskb)->len - extoff);
-
+       unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
+       unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
+       int protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
+                                            (*pskb)->len - extoff);
        /*
         * (protoff == (*pskb)->len) mean that the packet doesn't have no data
         * except of IPv6 & ext headers. but it's tracked anyway. - YK
@@ -179,9 +173,8 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
        struct nf_conn_help *help;
        enum ip_conntrack_info ctinfo;
        unsigned int ret, protoff;
-       unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
-                             - (*pskb)->data;
-       unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
+       unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
+       unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
 
 
        /* This is where we call the helper: as the packet goes out. */
index bc1d09584008409d17c2ec6fa9b1def89ee6fc49..d3fbb1f1caf58de61791046f74e486566fcd10a4 100644 (file)
@@ -400,8 +400,8 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
        }
 
        offset = ntohs(fhdr->frag_off) & ~0x7;
-       end = offset + (ntohs(skb->nh.ipv6h->payload_len) -
-                       ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
+       end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
+                       ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
 
        if ((unsigned int)end > IPV6_MAXPLEN) {
                DEBUGP("offset is too large.\n");
@@ -652,7 +652,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
        head->next = NULL;
        head->dev = dev;
        head->tstamp = fq->stamp;
-       head->nh.ipv6h->payload_len = htons(payload_len);
+       ipv6_hdr(head)->payload_len = htons(payload_len);
 
        /* Yes, and fold redundant checksum back. 8) */
        if (head->ip_summed == CHECKSUM_COMPLETE)
@@ -706,9 +706,9 @@ out_fail:
 static int
 find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
 {
-       u8 nexthdr = skb->nh.ipv6h->nexthdr;
-       u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data;
-       int start = (u8 *)(skb->nh.ipv6h+1) - skb->data;
+       u8 nexthdr = ipv6_hdr(skb)->nexthdr;
+       u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data;
+       int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
        int len = skb->len - start;
        u8 prevhdr = NEXTHDR_IPV6;
 
@@ -764,7 +764,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
        struct sk_buff *ret_skb = NULL;
 
        /* Jumbo payload inhibits frag. header */
-       if (skb->nh.ipv6h->payload_len == 0) {
+       if (ipv6_hdr(skb)->payload_len == 0) {
                DEBUGP("payload len = 0\n");
                return skb;
        }
@@ -786,7 +786,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
        }
 
        clone->h.raw = clone->data + fhoff;
-       hdr = clone->nh.ipv6h;
+       hdr = ipv6_hdr(clone);
        fhdr = (struct frag_hdr *)clone->h.raw;
 
        if (!(fhdr->frag_off & htons(0xFFF9))) {
index 9b2bcde73f1969eb521a0d89d45989022924d95b..0e2b56ce0a56520fdfd625f1e065028e6eca78ac 100644 (file)
@@ -152,7 +152,7 @@ int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
        int delivered = 0;
        __u8 hash;
 
-       saddr = &skb->nh.ipv6h->saddr;
+       saddr = &ipv6_hdr(skb)->saddr;
        daddr = saddr + 1;
 
        hash = nexthdr & (MAX_INET_PROTOS - 1);
@@ -363,15 +363,16 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
        if (skb->ip_summed == CHECKSUM_COMPLETE) {
                skb_postpull_rcsum(skb, skb_network_header(skb),
                                   skb->h.raw - skb->nh.raw);
-               if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                    &skb->nh.ipv6h->daddr,
+               if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                    &ipv6_hdr(skb)->daddr,
                                     skb->len, inet->num, skb->csum))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
        }
        if (skb->ip_summed != CHECKSUM_UNNECESSARY)
-               skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                            &skb->nh.ipv6h->daddr,
-                                            skb->len, inet->num, 0));
+               skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                        &ipv6_hdr(skb)->daddr,
+                                                        skb->len,
+                                                        inet->num, 0));
 
        if (inet->hdrincl) {
                if (skb_checksum_complete(skb)) {
@@ -438,7 +439,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
        if (sin6) {
                sin6->sin6_family = AF_INET6;
                sin6->sin6_port = 0;
-               ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
+               ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
                sin6->sin6_flowinfo = 0;
                sin6->sin6_scope_id = 0;
                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,
 
        skb_put(skb, length);
        skb_reset_network_header(skb);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        skb->ip_summed = CHECKSUM_NONE;
 
index f85e49acb91a04d6366dd443de752ade2730ffe6..156a37fe3ff3e6c25dcc63d0d435bd049f62a466 100644 (file)
@@ -430,8 +430,8 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
                goto err;
 
        offset = ntohs(fhdr->frag_off) & ~0x7;
-       end = offset + (ntohs(skb->nh.ipv6h->payload_len) -
-                       ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
+       end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
+                       ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
 
        if ((unsigned int)end > IPV6_MAXPLEN) {
                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,
        head->next = NULL;
        head->dev = dev;
        head->tstamp = fq->stamp;
-       head->nh.ipv6h->payload_len = htons(payload_len);
+       ipv6_hdr(head)->payload_len = htons(payload_len);
        IP6CB(head)->nhoff = nhoff;
 
        *skb_in = head;
@@ -708,9 +708,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
        struct net_device *dev = skb->dev;
        struct frag_hdr *fhdr;
        struct frag_queue *fq;
-       struct ipv6hdr *hdr;
-
-       hdr = skb->nh.ipv6h;
+       struct ipv6hdr *hdr = ipv6_hdr(skb);
 
        IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
 
@@ -726,7 +724,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
                return -1;
        }
 
-       hdr = skb->nh.ipv6h;
+       hdr = ipv6_hdr(skb);
        fhdr = (struct frag_hdr *)skb->h.raw;
 
        if (!(fhdr->frag_off & htons(0xFFF9))) {
index 0aa4762f53f767fd4aad19dcb2f8602a6572d52c..52cbe1cd404519a3868b951d62f6ada9f9b77afd 100644 (file)
@@ -726,7 +726,7 @@ out2:
 
 void ip6_route_input(struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = skb->nh.ipv6h;
+       struct ipv6hdr *iph = ipv6_hdr(skb);
        int flags = RT6_LOOKUP_F_HAS_SADDR;
        struct flowi fl = {
                .iif = skb->dev->ifindex,
@@ -1775,7 +1775,7 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
        int type;
        switch (ipstats_mib_noroutes) {
        case IPSTATS_MIB_INNOROUTES:
-               type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
+               type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
                if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
                        IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
                        break;
index e33ac3c3a9ca6cd7341152943cf06f049be70514..18ec86f177d929ed6f143374f71201da1f739f3f 100644 (file)
@@ -366,7 +366,7 @@ out:
 static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
 {
        if (INET_ECN_is_ce(iph->tos))
-               IP6_ECN_set_ce(skb->nh.ipv6h);
+               IP6_ECN_set_ce(ipv6_hdr(skb));
 }
 
 static int ipip6_rcv(struct sk_buff *skb)
@@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        struct ip_tunnel *tunnel = netdev_priv(dev);
        struct net_device_stats *stats = &tunnel->stat;
        struct iphdr  *tiph = &tunnel->parms.iph;
-       struct ipv6hdr *iph6 = skb->nh.ipv6h;
+       struct ipv6hdr *iph6 = ipv6_hdr(skb);
        u8     tos = tunnel->parms.iph.tos;
        struct rtable *rt;                      /* Route to the other host */
        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)
                addr_type = ipv6_addr_type(addr6);
 
                if (addr_type == IPV6_ADDR_ANY) {
-                       addr6 = &skb->nh.ipv6h->daddr;
+                       addr6 = &ipv6_hdr(skb)->daddr;
                        addr_type = ipv6_addr_type(addr6);
                }
 
@@ -550,7 +550,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
                        skb_set_owner_w(new_skb, skb->sk);
                dev_kfree_skb(skb);
                skb = new_skb;
-               iph6 = skb->nh.ipv6h;
+               iph6 = ipv6_hdr(skb);
        }
 
        skb->h.raw = skb->nh.raw;
index 80a52ab1e384f5740f5a482f689e48848f24a018..85b3e89110f92b82cebfbc0012d690e6f3ad4a06 100644 (file)
@@ -115,8 +115,8 @@ static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
 
 static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
 {
-       return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
-                                           skb->nh.ipv6h->saddr.s6_addr32,
+       return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
+                                           ipv6_hdr(skb)->saddr.s6_addr32,
                                            skb->h.th->dest,
                                            skb->h.th->source);
 }
@@ -837,7 +837,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
 {
        __u8 *hash_location = NULL;
        struct tcp_md5sig_key *hash_expected;
-       struct ipv6hdr *ip6h = skb->nh.ipv6h;
+       struct ipv6hdr *ip6h = ipv6_hdr(skb);
        struct tcphdr *th = skb->h.th;
        int length = (th->doff << 2) - sizeof (*th);
        int genhash;
@@ -966,7 +966,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
        if (!pskb_may_pull(skb, sizeof(*th)))
                return -EINVAL;
 
-       ipv6h = skb->nh.ipv6h;
+       ipv6h = ipv6_hdr(skb);
        th = skb->h.th;
 
        th->check = 0;
@@ -995,7 +995,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 
 #ifdef CONFIG_TCP_MD5SIG
        if (sk)
-               key = tcp_v6_md5_do_lookup(sk, &skb->nh.ipv6h->daddr);
+               key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
        else
                key = NULL;
 
@@ -1039,20 +1039,18 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
                               (TCPOPT_NOP << 16) |
                               (TCPOPT_MD5SIG << 8) |
                               TCPOLEN_MD5SIG);
-               tcp_v6_do_calc_md5_hash((__u8*)&opt[1],
-                                       key,
-                                       &skb->nh.ipv6h->daddr,
-                                       &skb->nh.ipv6h->saddr,
-                                       t1, IPPROTO_TCP,
-                                       tot_len);
+               tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key,
+                                       &ipv6_hdr(skb)->daddr,
+                                       &ipv6_hdr(skb)->saddr,
+                                       t1, IPPROTO_TCP, tot_len);
        }
 #endif
 
        buff->csum = csum_partial((char *)t1, sizeof(*t1), 0);
 
        memset(&fl, 0, sizeof(fl));
-       ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
-       ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr);
+       ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
+       ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
 
        t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
                                    sizeof(*t1), IPPROTO_TCP,
@@ -1093,7 +1091,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
 
 #ifdef CONFIG_TCP_MD5SIG
        if (!tw && skb->sk) {
-               key = tcp_v6_md5_do_lookup(skb->sk, &skb->nh.ipv6h->daddr);
+               key = tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr);
        } else if (tw && tw->tw_md5_keylen) {
                tw_key.key = tw->tw_md5_key;
                tw_key.keylen = tw->tw_md5_keylen;
@@ -1142,20 +1140,18 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
        if (key) {
                *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
                                (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
-               tcp_v6_do_calc_md5_hash((__u8 *)topt,
-                                       key,
-                                       &skb->nh.ipv6h->daddr,
-                                       &skb->nh.ipv6h->saddr,
-                                       t1, IPPROTO_TCP,
-                                       tot_len);
+               tcp_v6_do_calc_md5_hash((__u8 *)topt, key,
+                                       &ipv6_hdr(skb)->daddr,
+                                       &ipv6_hdr(skb)->saddr,
+                                       t1, IPPROTO_TCP, tot_len);
        }
 #endif
 
        buff->csum = csum_partial((char *)t1, tot_len, 0);
 
        memset(&fl, 0, sizeof(fl));
-       ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
-       ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr);
+       ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
+       ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
 
        t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
                                    tot_len, IPPROTO_TCP,
@@ -1204,13 +1200,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
 
        /* Find possible connection requests. */
        req = inet6_csk_search_req(sk, &prev, th->source,
-                                  &skb->nh.ipv6h->saddr,
-                                  &skb->nh.ipv6h->daddr, inet6_iif(skb));
+                                  &ipv6_hdr(skb)->saddr,
+                                  &ipv6_hdr(skb)->daddr, inet6_iif(skb));
        if (req)
                return tcp_check_req(sk, skb, req, prev);
 
-       nsk = __inet6_lookup_established(&tcp_hashinfo, &skb->nh.ipv6h->saddr,
-                                        th->source, &skb->nh.ipv6h->daddr,
+       nsk = __inet6_lookup_established(&tcp_hashinfo, &ipv6_hdr(skb)->saddr,
+                                        th->source, &ipv6_hdr(skb)->daddr,
                                         ntohs(th->dest), inet6_iif(skb));
 
        if (nsk) {
@@ -1277,8 +1273,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
        tcp_openreq_init(req, &tmp_opt, skb);
 
        treq = inet6_rsk(req);
-       ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr);
-       ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr);
+       ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr);
+       ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr);
        TCP_ECN_create_request(req, skb->h.th);
        treq->pktopts = NULL;
        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,
                newnp->pktoptions  = NULL;
                newnp->opt         = NULL;
                newnp->mcast_oif   = inet6_iif(skb);
-               newnp->mcast_hops  = skb->nh.ipv6h->hop_limit;
+               newnp->mcast_hops  = ipv6_hdr(skb)->hop_limit;
 
                /*
                 * 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,
        }
        newnp->opt        = NULL;
        newnp->mcast_oif  = inet6_iif(skb);
-       newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
+       newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
 
        /* Clone native IPv6 options from listening socket (if any)
 
@@ -1532,15 +1528,16 @@ out:
 static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
 {
        if (skb->ip_summed == CHECKSUM_COMPLETE) {
-               if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
-                                 &skb->nh.ipv6h->daddr,skb->csum)) {
+               if (!tcp_v6_check(skb->h.th, skb->len, &ipv6_hdr(skb)->saddr,
+                                 &ipv6_hdr(skb)->daddr, skb->csum)) {
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                        return 0;
                }
        }
 
-       skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
-                                 &skb->nh.ipv6h->daddr, 0));
+       skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th, skb->len,
+                                             &ipv6_hdr(skb)->saddr,
+                                             &ipv6_hdr(skb)->daddr, 0));
 
        if (skb->len <= 76) {
                return __skb_checksum_complete(skb);
@@ -1668,7 +1665,7 @@ ipv6_pktoptions:
                if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo)
                        np->mcast_oif = inet6_iif(opt_skb);
                if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
-                       np->mcast_hops = opt_skb->nh.ipv6h->hop_limit;
+                       np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
                if (ipv6_opt_accepted(sk, opt_skb)) {
                        skb_set_owner_r(opt_skb, sk);
                        opt_skb = xchg(&np->pktoptions, opt_skb);
@@ -1718,11 +1715,11 @@ static int tcp_v6_rcv(struct sk_buff **pskb)
                                    skb->len - th->doff*4);
        TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
        TCP_SKB_CB(skb)->when = 0;
-       TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h);
+       TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb));
        TCP_SKB_CB(skb)->sacked = 0;
 
-       sk = __inet6_lookup(&tcp_hashinfo, &skb->nh.ipv6h->saddr, th->source,
-                           &skb->nh.ipv6h->daddr, ntohs(th->dest),
+       sk = __inet6_lookup(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, th->source,
+                           &ipv6_hdr(skb)->daddr, ntohs(th->dest),
                            inet6_iif(skb));
 
        if (!sk)
@@ -1802,7 +1799,7 @@ do_time_wait:
                struct sock *sk2;
 
                sk2 = inet6_lookup_listener(&tcp_hashinfo,
-                                           &skb->nh.ipv6h->daddr,
+                                           &ipv6_hdr(skb)->daddr,
                                            ntohs(th->dest), inet6_iif(skb));
                if (sk2 != NULL) {
                        struct inet_timewait_sock *tw = inet_twsk(sk);
index e991e606ab1f18549934294349fdfb4937baa25f..55affe39b2ebbb985fdda2d155e1e8c7524bf8fb 100644 (file)
@@ -180,7 +180,8 @@ try_again:
                        ipv6_addr_set(&sin6->sin6_addr, 0, 0,
                                      htonl(0xffff), ip_hdr(skb)->saddr);
                else {
-                       ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
+                       ipv6_addr_copy(&sin6->sin6_addr,
+                                      &ipv6_hdr(skb)->saddr);
                        if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
                                sin6->sin6_scope_id = IP6CB(skb)->iif;
                }
@@ -392,13 +393,13 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
                return 1;
        }
        if (skb->ip_summed == CHECKSUM_COMPLETE &&
-           !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
+           !csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
                             skb->len, proto, skb->csum))
                skb->ip_summed = CHECKSUM_UNNECESSARY;
 
        if (skb->ip_summed != CHECKSUM_UNNECESSARY)
-               skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                                        &skb->nh.ipv6h->daddr,
+               skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                        &ipv6_hdr(skb)->daddr,
                                                         skb->len, proto, 0));
 
        return 0;
@@ -417,8 +418,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto short_packet;
 
-       saddr = &skb->nh.ipv6h->saddr;
-       daddr = &skb->nh.ipv6h->daddr;
+       saddr = &ipv6_hdr(skb)->saddr;
+       daddr = &ipv6_hdr(skb)->daddr;
        uh = skb->h.uh;
 
        ulen = ntohs(uh->len);
@@ -438,8 +439,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
                if (ulen < skb->len) {
                        if (pskb_trim_rcsum(skb, ulen))
                                goto short_packet;
-                       saddr = &skb->nh.ipv6h->saddr;
-                       daddr = &skb->nh.ipv6h->daddr;
+                       saddr = &ipv6_hdr(skb)->saddr;
+                       daddr = &ipv6_hdr(skb)->daddr;
                        uh = skb->h.uh;
                }
        }
index 5c929f8861292888be561300bb34ee654a5258ab..f30ef16072f6f3dc4f5eb17100e509ac050d83b6 100644 (file)
@@ -35,7 +35,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
                goto drop;
 
        do {
-               struct ipv6hdr *iph = skb->nh.ipv6h;
+               struct ipv6hdr *iph = ipv6_hdr(skb);
 
                if (xfrm_nr == XFRM_MAX_DEPTH)
                        goto drop;
@@ -112,7 +112,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
                return -1;
        } else {
 #ifdef CONFIG_NETFILTER
-               skb->nh.ipv6h->payload_len = htons(skb->len);
+               ipv6_hdr(skb)->payload_len = htons(skb->len);
                __skb_push(skb, skb->data - skb_network_header(skb));
 
                NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
index 247e2d5d2acf2b8f981fc775c7a5374512fe4e4a..b5a48c255f074a54b90cfe27878c9366cc56bcb1 100644 (file)
@@ -38,7 +38,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
        int hdr_len;
 
        skb_push(skb, x->props.header_len);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
        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)
        memmove(skb->data, iph, hdr_len);
 
        skb_reset_network_header(skb);
-       top_iph = skb->nh.ipv6h;
+       top_iph = ipv6_hdr(skb);
        skb->nh.raw = &top_iph->nexthdr;
        skb->h.ipv6h = top_iph + 1;
 
@@ -74,7 +74,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
        skb_set_mac_header(skb, -skb->mac_len);
        memmove(skb_mac_header(skb), old_mac, skb->mac_len);
 
-       ip6h = skb->nh.ipv6h;
+       ip6h = ipv6_hdr(skb);
        ip6h->payload_len = htons(skb->len - size);
        ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
        ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);
index 6031c16d46ca840ad214e822cb2e022efecfb2ee..d01958d921ac1012be1393e7b8242601b47e6535 100644 (file)
@@ -50,7 +50,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
        int hdr_len;
 
        skb_push(skb, x->props.header_len);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
        skb->nh.raw = prevhdr - x->props.header_len;
index ace0bbf4f25d6e63f67bdcb521e650ac99b75f02..358b60d9d91259356c36565b6996a54e73229007 100644 (file)
@@ -32,7 +32,7 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
        int hdr_len;
 
        skb_push(skb, x->props.header_len);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
        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)
                memmove(skb->h.raw, skb_network_header(skb), ihl);
                skb->nh.raw = skb->h.raw;
        }
-       skb->nh.ipv6h->payload_len = htons(skb->len + ihl -
+       ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
                                           sizeof(struct ipv6hdr));
        skb->h.raw = skb->data;
        return 0;
index 498f17b5c42f87684ce540162e6d1180150ab0aa..28f36b363d1f00ca6df0c1f77dd1fc59fb19023e 100644 (file)
@@ -18,7 +18,7 @@
 
 static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
 {
-       struct ipv6hdr *outer_iph = skb->nh.ipv6h;
+       struct ipv6hdr *outer_iph = ipv6_hdr(skb);
        struct ipv6hdr *inner_iph = skb->h.ipv6h;
 
        if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
@@ -27,7 +27,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
 
 static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb)
 {
-       if (INET_ECN_is_ce(ipv6_get_dsfield(skb->nh.ipv6h)))
+       if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6_hdr(skb))))
                        IP_ECN_set_ce(skb->h.ipiph);
 }
 
@@ -51,10 +51,10 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
        int dsfield;
 
        skb_push(skb, x->props.header_len);
-       iph = skb->nh.ipv6h;
+       iph = ipv6_hdr(skb);
 
        skb_reset_network_header(skb);
-       top_iph = skb->nh.ipv6h;
+       top_iph = ipv6_hdr(skb);
        skb->nh.raw = &top_iph->nexthdr;
        skb->h.ipv6h = top_iph + 1;
 
@@ -102,7 +102,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
        nh = skb_network_header(skb);
        if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) {
                if (x->props.flags & XFRM_STATE_DECAP_DSCP)
-                       ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h);
+                       ipv6_copy_dscp(ipv6_hdr(skb), skb->h.ipv6h);
                if (!(x->props.flags & XFRM_STATE_NOECN))
                        ipip6_ecn_decapsulate(skb);
        } else {
index cb5a723d4cb459358b5ce898592d7546ae591e75..b93bfb87f494956b5744bbd43eaeb233101087c0 100644 (file)
@@ -271,7 +271,7 @@ static inline void
 _decode_session6(struct sk_buff *skb, struct flowi *fl)
 {
        u16 offset = skb->h.raw - skb->nh.raw;
-       struct ipv6hdr *hdr = skb->nh.ipv6h;
+       struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct ipv6_opt_hdr *exthdr;
        const unsigned char *nh = skb_network_header(skb);
        u8 nexthdr = nh[IP6CB(skb)->nhoff];
index 93c42232aa396f7c1ddafe5310674b2b7c72c542..538499a8997506a2336ab10d0c7d457bcea5ae6c 100644 (file)
@@ -257,7 +257,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 
 static int xfrm6_tunnel_rcv(struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = skb->nh.ipv6h;
+       struct ipv6hdr *iph = ipv6_hdr(skb);
        __be32 spi;
 
        spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
index de647bd54893ab4372fbbd147423c228a702ef79..a97704a3f95ce13359609ba68252189fac638b24 100644 (file)
@@ -56,13 +56,13 @@ static unsigned int target6(struct sk_buff **pskb,
                            const void *targinfo)
 {
        const struct xt_DSCP_info *dinfo = targinfo;
-       u_int8_t dscp = ipv6_get_dsfield((*pskb)->nh.ipv6h) >> XT_DSCP_SHIFT;
+       u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(*pskb)) >> XT_DSCP_SHIFT;
 
        if (dscp != dinfo->dscp) {
                if (!skb_make_writable(pskb, sizeof(struct ipv6hdr)))
                        return NF_DROP;
 
-               ipv6_change_dsfield((*pskb)->nh.ipv6h, (__u8)(~XT_DSCP_MASK),
+               ipv6_change_dsfield(ipv6_hdr(*pskb), (__u8)(~XT_DSCP_MASK),
                                    dinfo->dscp << XT_DSCP_SHIFT);
        }
        return XT_CONTINUE;
index 9e948ce276009641abf632bcd7991c006318d312..15fe8f649510398f6df0e7c2e665fd28b0b0fd47 100644 (file)
@@ -171,7 +171,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
                  const struct xt_target *target,
                  const void *targinfo)
 {
-       struct ipv6hdr *ipv6h = (*pskb)->nh.ipv6h;
+       struct ipv6hdr *ipv6h = ipv6_hdr(*pskb);
        u8 nexthdr;
        int tcphoff;
        int ret;
@@ -187,7 +187,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
        if (ret < 0)
                return NF_DROP;
        if (ret > 0) {
-               ipv6h = (*pskb)->nh.ipv6h;
+               ipv6h = ipv6_hdr(*pskb);
                ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret);
        }
        return XT_CONTINUE;
index 9ec294cd2436e5593a93e9df7b1178fe04fe72d1..000e9c2f8d1fb44a2c3b5448c719dac165730ade 100644 (file)
@@ -49,7 +49,7 @@ static int match6(const struct sk_buff *skb,
                  int *hotdrop)
 {
        const struct xt_dscp_info *info = matchinfo;
-       u_int8_t dscp = ipv6_get_dsfield(skb->nh.ipv6h) >> XT_DSCP_SHIFT;
+       u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
 
        return (dscp == info->dscp) ^ !!info->invert;
 }
index 47af19ab03cf5c83093ed6208a84eabf0097f74d..eb932913693bcc754f8eaf57e7a5f546d6802467 100644 (file)
@@ -392,10 +392,10 @@ hashlimit_init_dst(struct xt_hashlimit_htable *hinfo, struct dsthash_dst *dst,
 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
        case AF_INET6:
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
-                       memcpy(&dst->addr.ip6.dst, &skb->nh.ipv6h->daddr,
+                       memcpy(&dst->addr.ip6.dst, &ipv6_hdr(skb)->daddr,
                               sizeof(dst->addr.ip6.dst));
                if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
-                       memcpy(&dst->addr.ip6.src, &skb->nh.ipv6h->saddr,
+                       memcpy(&dst->addr.ip6.src, &ipv6_hdr(skb)->saddr,
                               sizeof(dst->addr.ip6.src));
 
                if (!(hinfo->cfg.mode &
index 65fdb2166996984ff5a0d26c4afb8a4740290977..77288c5ada78795cf7346dbd46993904d8a5696e 100644 (file)
@@ -47,7 +47,8 @@ match6(const struct sk_buff *skb,
        int *hotdrop)
 {
        const struct xt_length_info *info = matchinfo;
-       u_int16_t pktlen = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
+       const u_int16_t pktlen = (ntohs(ipv6_hdr(skb)->payload_len) +
+                                 sizeof(struct ipv6hdr));
 
        return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
 }
index cb8cf5bfa053d75255c0fec4495d768332e6a13f..6f373b020eb4cc893704ecc01f8f65f3f8b3a24c 100644 (file)
@@ -143,7 +143,7 @@ static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
        u8 tunnelid = 0;
        u8 *xprt;
 #if RSVP_DST_LEN == 4
-       struct ipv6hdr *nhptr = skb->nh.ipv6h;
+       struct ipv6hdr *nhptr = ipv6_hdr(skb);
 #else
        struct iphdr *nhptr = ip_hdr(skb);
 #endif
index 45b5734dd72a7da578db5e2cdf61935bb9b0e1c7..2c857af79a1e4cb8f6809a0f10743e3a99b1e563 100644 (file)
@@ -220,7 +220,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
                                        & ~INET_ECN_MASK;
                                break;
                        case __constant_htons(ETH_P_IPV6):
-                               skb->tc_index = ipv6_get_dsfield(skb->nh.ipv6h)
+                               skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
                                        & ~INET_ECN_MASK;
                                break;
                        default:
@@ -296,7 +296,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
                                            p->value[index]);
                        break;
                case __constant_htons(ETH_P_IPV6):
-                       ipv6_change_dsfield(skb->nh.ipv6h, p->mask[index],
+                       ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index],
                                            p->value[index]);
                        break;
                default:
index 02081bc9e0d14b85b1f1ba2627685730bfc70e50..e3695407afc6247380f12b72e92cad1a543f632b 100644 (file)
@@ -152,7 +152,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
        }
        case __constant_htons(ETH_P_IPV6):
        {
-               struct ipv6hdr *iph = skb->nh.ipv6h;
+               struct ipv6hdr *iph = ipv6_hdr(skb);
                h = iph->daddr.s6_addr32[3];
                h2 = iph->saddr.s6_addr32[3]^iph->nexthdr;
                if (iph->nexthdr == IPPROTO_TCP ||
index 742f9ff42fbfddf32d3d3bbd6ba5a12bee2c94db..001be2de0b3cdd4a08ace00bc6f2a1082885db47 100644 (file)
@@ -393,10 +393,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
        sh = (struct sctphdr *) skb->h.raw;
        if (is_saddr) {
                *port  = sh->source;
-               from = &skb->nh.ipv6h->saddr;
+               from = &ipv6_hdr(skb)->saddr;
        } else {
                *port = sh->dest;
-               from = &skb->nh.ipv6h->daddr;
+               from = &ipv6_hdr(skb)->daddr;
        }
        ipv6_addr_copy(&addr->v6.sin6_addr, from);
 }
@@ -698,7 +698,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb)
 /* Was this packet marked by Explicit Congestion Notification? */
 static int sctp_v6_is_ce(const struct sk_buff *skb)
 {
-       return *((__u32 *)(skb->nh.ipv6h)) & htonl(1<<20);
+       return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20);
 }
 
 /* Dump the v6 addr to the seq file. */
@@ -777,7 +777,7 @@ static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname,
                }
 
                /* Otherwise, just copy the v6 address. */
-               ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
+               ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
                if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
                        struct sctp_ulpevent *ev = sctp_skb2event(skb);
                        sin6->sin6_scope_id = ev->iif;