]> err.no Git - linux-2.6/blobdiff - net/ipv6/exthdrs.c
spkm3: fix spkm3's use of hmac
[linux-2.6] / net / ipv6 / exthdrs.c
index dab069b0b3f6e1bdccd8434876ffd0c9dd2dfff3..6d8e4ac7bdad84a7631bb9c3eabca4bb66c5b7c2 100644 (file)
@@ -51,7 +51,7 @@
 int ipv6_find_tlv(struct sk_buff *skb, int offset, int type)
 {
        const unsigned char *nh = skb_network_header(skb);
-       int packet_len = skb->tail - nh;
+       int packet_len = skb->tail - skb->network_header;
        struct ipv6_opt_hdr *hdr;
        int len;
 
@@ -130,7 +130,7 @@ static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
        case 2: /* send ICMP PARM PROB regardless and drop packet */
                icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
                return 0;
-       };
+       }
 
        kfree_skb(skb);
        return 0;
@@ -143,10 +143,10 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
        struct sk_buff *skb = *skbp;
        struct tlvtype_proc *curr;
        const unsigned char *nh = skb_network_header(skb);
-       int off = skb->h.raw - skb->nh.raw;
-       int len = ((skb->h.raw[1]+1)<<3);
+       int off = skb_network_header_len(skb);
+       int len = (skb_transport_header(skb)[1] + 1) << 3;
 
-       if ((skb->h.raw + len) - skb->data > skb_headlen(skb))
+       if (skb_transport_offset(skb) + len > skb_headlen(skb))
                goto bad;
 
        off += 2;
@@ -288,16 +288,16 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp)
 #endif
        struct dst_entry *dst;
 
-       if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
-           !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
+       if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
+           !pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                ((skb_transport_header(skb)[1] + 1) << 3)))) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                 IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
                return -1;
        }
 
-       opt->lastopt = skb->h.raw - skb->nh.raw;
-       opt->dst1 = skb->h.raw - skb->nh.raw;
+       opt->lastopt = opt->dst1 = skb_network_header_len(skb);
 #ifdef CONFIG_IPV6_MIP6
        dstbuf = opt->dst1;
 #endif
@@ -306,7 +306,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp)
        if (ip6_parse_tlv(tlvprocdestopt_lst, skbp)) {
                dst_release(dst);
                skb = *skbp;
-               skb->h.raw += ((skb->h.raw[1]+1)<<3);
+               skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
                opt = IP6CB(skb);
 #ifdef CONFIG_IPV6_MIP6
                opt->nhoff = dstbuf;
@@ -387,18 +387,20 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
        in6_dev_put(idev);
 
-       if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
-           !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
+       if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
+           !pskb_may_pull(skb, (skb_transport_offset(skb) +
+                                ((skb_transport_header(skb)[1] + 1) << 3)))) {
                IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
                                 IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
                return -1;
        }
 
-       hdr = (struct ipv6_rt_hdr *) skb->h.raw;
+       hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb);
 
        switch (hdr->type) {
 #ifdef CONFIG_IPV6_MIP6
+       case IPV6_SRCRT_TYPE_2:
                break;
 #endif
        case IPV6_SRCRT_TYPE_0:
@@ -442,9 +444,8 @@ looped_back:
                        break;
                }
 
-               opt->lastopt = skb->h.raw - skb->nh.raw;
-               opt->srcrt = skb->h.raw - skb->nh.raw;
-               skb->h.raw += (hdr->hdrlen + 1) << 3;
+               opt->lastopt = opt->srcrt = skb_network_header_len(skb);
+               skb->transport_header += (hdr->hdrlen + 1) << 3;
                opt->dst0 = opt->dst1;
                opt->dst1 = 0;
                opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb);
@@ -506,7 +507,7 @@ looped_back:
                kfree_skb(skb);
                *skbp = skb = skb2;
                opt = IP6CB(skb2);
-               hdr = (struct ipv6_rt_hdr *) skb2->h.raw;
+               hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb2);
        }
 
        if (skb->ip_summed == CHECKSUM_COMPLETE)
@@ -738,12 +739,13 @@ int ipv6_parse_hopopts(struct sk_buff **skbp)
 
        /*
         * skb_network_header(skb) is equal to skb->data, and
-        * skb->h.raw - skb->nh.raw is always equal to
+        * skb_network_header_len(skb) is always equal to
         * sizeof(struct ipv6hdr) by definition of
         * hop-by-hop options.
         */
        if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + 8) ||
-           !pskb_may_pull(skb, sizeof(struct ipv6hdr) + ((skb->h.raw[1] + 1) << 3))) {
+           !pskb_may_pull(skb, (sizeof(struct ipv6hdr) +
+                                ((skb_transport_header(skb)[1] + 1) << 3)))) {
                kfree_skb(skb);
                return -1;
        }
@@ -751,7 +753,7 @@ int ipv6_parse_hopopts(struct sk_buff **skbp)
        opt->hop = sizeof(struct ipv6hdr);
        if (ip6_parse_tlv(tlvprochopopt_lst, skbp)) {
                skb = *skbp;
-               skb->h.raw += (skb->h.raw[1]+1)<<3;
+               skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
                opt = IP6CB(skb);
                opt->nhoff = sizeof(struct ipv6hdr);
                return 1;