]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/exthdrs.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / net / ipv6 / exthdrs.c
index f34cc2bd489abbaf19190dc2e666d374b1a8bd96..14be0b9b77a5f998614351e1c5dbc92a31f94df0 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;
@@ -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_transport_header(skb)[1] + 1) << 3;
+               skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
                opt = IP6CB(skb);
 #ifdef CONFIG_IPV6_MIP6
                opt->nhoff = dstbuf;
@@ -400,6 +400,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
        switch (hdr->type) {
 #ifdef CONFIG_IPV6_MIP6
+       case IPV6_SRCRT_TYPE_2:
                break;
 #endif
        case IPV6_SRCRT_TYPE_0:
@@ -444,7 +445,7 @@ looped_back:
                }
 
                opt->lastopt = opt->srcrt = skb_network_header_len(skb);
-               skb->h.raw += (hdr->hdrlen + 1) << 3;
+               skb->transport_header += (hdr->hdrlen + 1) << 3;
                opt->dst0 = opt->dst1;
                opt->dst1 = 0;
                opt->nhoff = (&hdr->nexthdr) - skb_network_header(skb);
@@ -659,6 +660,14 @@ EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
   Hop-by-hop options.
  **********************************/
 
+/*
+ * Note: we cannot rely on skb->dst before we assign it in ip6_route_input().
+ */
+static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
+{
+       return skb->dst ? ip6_dst_idev(skb->dst) : __in6_dev_get(skb->dev);
+}
+
 /* Router Alert as of RFC 2711 */
 
 static int ipv6_hop_ra(struct sk_buff **skbp, int optoff)
@@ -687,25 +696,25 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
        if (nh[optoff + 1] != 4 || (optoff & 3) != 2) {
                LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
                               nh[optoff+1]);
-               IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
+               IP6_INC_STATS_BH(ipv6_skb_idev(skb),
                                 IPSTATS_MIB_INHDRERRORS);
                goto drop;
        }
 
        pkt_len = ntohl(*(__be32 *)(nh + optoff + 2));
        if (pkt_len <= IPV6_MAXPLEN) {
-               IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
+               IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
                return 0;
        }
        if (ipv6_hdr(skb)->payload_len) {
-               IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
+               IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
                return 0;
        }
 
        if (pkt_len > skb->len - sizeof(struct ipv6hdr)) {
-               IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INTRUNCATEDPKTS);
+               IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INTRUNCATEDPKTS);
                goto drop;
        }
 
@@ -752,7 +761,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_transport_header(skb)[1] + 1) << 3;
+               skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
                opt = IP6CB(skb);
                opt->nhoff = sizeof(struct ipv6hdr);
                return 1;