[ICMP6]: Introduce icmp6_hdr()
[safe/jmp/linux-2.6] / net / ipv6 / icmp.c
index e5293b3..d3edc3c 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;
@@ -222,7 +222,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
        if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
                goto out;
 
-       icmp6h = (struct icmp6hdr*) skb->h.raw;
+       icmp6h = icmp6_hdr(skb);
        memcpy(icmp6h, thdr, sizeof(struct icmp6hdr));
        icmp6h->icmp6_cksum = 0;
 
@@ -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;
@@ -476,7 +476,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
        struct inet6_dev *idev;
        struct ipv6_pinfo *np;
        struct in6_addr *saddr = NULL;
-       struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw;
+       struct icmp6hdr *icmph = icmp6_hdr(skb);
        struct icmp6hdr tmp_hdr;
        struct flowi fl;
        struct icmpv6_msg msg;
@@ -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) {
@@ -651,7 +651,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
        if (!pskb_pull(skb, sizeof(struct icmp6hdr)))
                goto discard_it;
 
-       hdr = (struct icmp6hdr *) skb->h.raw;
+       hdr = icmp6_hdr(skb);
 
        type = hdr->icmp6_type;
 
@@ -677,7 +677,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
                 */
                if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
                        goto discard_it;
-               hdr = (struct icmp6hdr *) skb->h.raw;
+               hdr = icmp6_hdr(skb);
                orig_hdr = (struct ipv6hdr *) (hdr + 1);
                rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
                                   ntohl(hdr->icmp6_mtu));