diff options
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index ac49f84fe2c3..5f983644373a 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -170,8 +170,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
170 | case IPPROTO_DCCP: | 170 | case IPPROTO_DCCP: |
171 | if (!onlyproto && (nh + offset + 4 < skb->data || | 171 | if (!onlyproto && (nh + offset + 4 < skb->data || |
172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { | 172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { |
173 | __be16 *ports = (__be16 *)exthdr; | 173 | __be16 *ports; |
174 | 174 | ||
175 | nh = skb_network_header(skb); | ||
176 | ports = (__be16 *)(nh + offset); | ||
175 | fl6->fl6_sport = ports[!!reverse]; | 177 | fl6->fl6_sport = ports[!!reverse]; |
176 | fl6->fl6_dport = ports[!reverse]; | 178 | fl6->fl6_dport = ports[!reverse]; |
177 | } | 179 | } |
@@ -180,8 +182,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
180 | 182 | ||
181 | case IPPROTO_ICMPV6: | 183 | case IPPROTO_ICMPV6: |
182 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { | 184 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
183 | u8 *icmp = (u8 *)exthdr; | 185 | u8 *icmp; |
184 | 186 | ||
187 | nh = skb_network_header(skb); | ||
188 | icmp = (u8 *)(nh + offset); | ||
185 | fl6->fl6_icmp_type = icmp[0]; | 189 | fl6->fl6_icmp_type = icmp[0]; |
186 | fl6->fl6_icmp_code = icmp[1]; | 190 | fl6->fl6_icmp_code = icmp[1]; |
187 | } | 191 | } |
@@ -192,8 +196,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
192 | case IPPROTO_MH: | 196 | case IPPROTO_MH: |
193 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { | 197 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
194 | struct ip6_mh *mh; | 198 | struct ip6_mh *mh; |
195 | mh = (struct ip6_mh *)exthdr; | ||
196 | 199 | ||
200 | nh = skb_network_header(skb); | ||
201 | mh = (struct ip6_mh *)(nh + offset); | ||
197 | fl6->fl6_mh_type = mh->ip6mh_type; | 202 | fl6->fl6_mh_type = mh->ip6mh_type; |
198 | } | 203 | } |
199 | fl6->flowi6_proto = nexthdr; | 204 | fl6->flowi6_proto = nexthdr; |