Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[powerpc.git] / net / ipv6 / mip6.c
index 31445d0..0afcabd 100644 (file)
@@ -22,7 +22,6 @@
  *     Masahide NAKAMURA @USAGI
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/time.h>
@@ -90,7 +89,6 @@ static int mip6_mh_len(int type)
 int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
 {
        struct ip6_mh *mh;
-       int mhlen;
 
        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)))
@@ -104,30 +102,6 @@ int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
                mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw);
                return -1;
        }
-       mhlen = (mh->ip6mh_hdrlen + 1) << 3;
-
-       if (skb->ip_summed == CHECKSUM_COMPLETE) {
-               skb->ip_summed = CHECKSUM_UNNECESSARY;
-               if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                   &skb->nh.ipv6h->daddr,
-                                   mhlen, IPPROTO_MH,
-                                   skb->csum)) {
-                       LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum failed\n");
-                       skb->ip_summed = CHECKSUM_NONE;
-               }
-       }
-       if (skb->ip_summed == CHECKSUM_NONE) {
-               if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                   &skb->nh.ipv6h->daddr,
-                                   mhlen, IPPROTO_MH,
-                                   skb_checksum(skb, 0, mhlen, 0))) {
-                       LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x > %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]\n",
-                                      NIP6(skb->nh.ipv6h->saddr),
-                                      NIP6(skb->nh.ipv6h->daddr));
-                       return -1;
-               }
-               skb->ip_summed = CHECKSUM_UNNECESSARY;
-       }
 
        if (mh->ip6mh_proto != IPPROTO_NONE) {
                LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n",
@@ -234,6 +208,10 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
        struct timeval stamp;
        int err = 0;
 
+       if (unlikely(fl->proto == IPPROTO_MH &&
+                    fl->fl_mh_type <= IP6_MH_TYPE_MAX))
+               goto out;
+
        if (likely(opt->dsthao)) {
                offset = ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO);
                if (likely(offset >= 0))
@@ -258,10 +236,10 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
        sel.proto = fl->proto;
        sel.dport = xfrm_flowi_dport(fl);
        if (sel.dport)
-               sel.dport_mask = ~((__u16)0);
+               sel.dport_mask = htons(~0);
        sel.sport = xfrm_flowi_sport(fl);
        if (sel.sport)
-               sel.sport_mask = ~((__u16)0);
+               sel.sport_mask = htons(~0);
        sel.ifindex = fl->oif;
 
        err = km_report(IPPROTO_DSTOPTS, &sel,
@@ -355,7 +333,7 @@ static struct xfrm_type mip6_destopt_type =
        .destructor     = mip6_destopt_destroy,
        .input          = mip6_destopt_input,
        .output         = mip6_destopt_output,
-       .reject         = mip6_destopt_reject,
+       .reject         = mip6_destopt_reject,
        .hdr_offset     = mip6_destopt_offset,
        .local_addr     = mip6_xfrm_addr,
 };