aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv6/mip6.c26
-rw-r--r--net/ipv6/raw.c13
2 files changed, 11 insertions, 28 deletions
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index be7dd7db65d7..681bb077eacc 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -89,7 +89,6 @@ static int mip6_mh_len(int type)
89int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) 89int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
90{ 90{
91 struct ip6_mh *mh; 91 struct ip6_mh *mh;
92 int mhlen;
93 92
94 if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) || 93 if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) ||
95 !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3))) 94 !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) << 3)))
@@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
103 mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw); 102 mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw);
104 return -1; 103 return -1;
105 } 104 }
106 mhlen = (mh->ip6mh_hdrlen + 1) << 3;
107
108 if (skb->ip_summed == CHECKSUM_COMPLETE) {
109 skb->ip_summed = CHECKSUM_UNNECESSARY;
110 if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
111 &skb->nh.ipv6h->daddr,
112 mhlen, IPPROTO_MH,
113 skb->csum)) {
114 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum failed\n");
115 skb->ip_summed = CHECKSUM_NONE;
116 }
117 }
118 if (skb->ip_summed == CHECKSUM_NONE) {
119 if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
120 &skb->nh.ipv6h->daddr,
121 mhlen, IPPROTO_MH,
122 skb_checksum(skb, 0, mhlen, 0))) {
123 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed "
124 "[" NIP6_FMT " > " NIP6_FMT "]\n",
125 NIP6(skb->nh.ipv6h->saddr),
126 NIP6(skb->nh.ipv6h->daddr));
127 return -1;
128 }
129 skb->ip_summed = CHECKSUM_UNNECESSARY;
130 }
131 105
132 if (mh->ip6mh_proto != IPPROTO_NONE) { 106 if (mh->ip6mh_proto != IPPROTO_NONE) {
133 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", 107 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n",
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index f2e883c9368a..c2d8059e754e 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk, long timeout)
1094 1094
1095static int rawv6_init_sk(struct sock *sk) 1095static int rawv6_init_sk(struct sock *sk)
1096{ 1096{
1097 if (inet_sk(sk)->num == IPPROTO_ICMPV6) { 1097 struct raw6_sock *rp = raw6_sk(sk);
1098 struct raw6_sock *rp = raw6_sk(sk); 1098
1099 switch (inet_sk(sk)->num) {
1100 case IPPROTO_ICMPV6:
1099 rp->checksum = 1; 1101 rp->checksum = 1;
1100 rp->offset = 2; 1102 rp->offset = 2;
1103 break;
1104 case IPPROTO_MH:
1105 rp->checksum = 1;
1106 rp->offset = 4;
1107 break;
1108 default:
1109 break;
1101 } 1110 }
1102 return(0); 1111 return(0);
1103} 1112}