aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r--net/ipv6/raw.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index cdaed47ba932..a4ed2416399e 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -63,6 +63,8 @@
63#include <linux/seq_file.h> 63#include <linux/seq_file.h>
64#include <linux/export.h> 64#include <linux/export.h>
65 65
66#define ICMPV6_HDRLEN 4 /* ICMPv6 header, RFC 4443 Section 2.1 */
67
66static struct raw_hashinfo raw_v6_hashinfo = { 68static struct raw_hashinfo raw_v6_hashinfo = {
67 .lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock), 69 .lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock),
68}; 70};
@@ -108,11 +110,14 @@ found:
108 */ 110 */
109static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb) 111static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb)
110{ 112{
111 struct icmp6hdr *_hdr; 113 struct icmp6hdr _hdr;
112 const struct icmp6hdr *hdr; 114 const struct icmp6hdr *hdr;
113 115
116 /* We require only the four bytes of the ICMPv6 header, not any
117 * additional bytes of message body in "struct icmp6hdr".
118 */
114 hdr = skb_header_pointer(skb, skb_transport_offset(skb), 119 hdr = skb_header_pointer(skb, skb_transport_offset(skb),
115 sizeof(_hdr), &_hdr); 120 ICMPV6_HDRLEN, &_hdr);
116 if (hdr) { 121 if (hdr) {
117 const __u32 *data = &raw6_sk(sk)->filter.data[0]; 122 const __u32 *data = &raw6_sk(sk)->filter.data[0];
118 unsigned int type = hdr->icmp6_type; 123 unsigned int type = hdr->icmp6_type;
@@ -330,8 +335,10 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
330 ip6_sk_update_pmtu(skb, sk, info); 335 ip6_sk_update_pmtu(skb, sk, info);
331 harderr = (np->pmtudisc == IPV6_PMTUDISC_DO); 336 harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
332 } 337 }
333 if (type == NDISC_REDIRECT) 338 if (type == NDISC_REDIRECT) {
334 ip6_sk_redirect(skb, sk); 339 ip6_sk_redirect(skb, sk);
340 return;
341 }
335 if (np->recverr) { 342 if (np->recverr) {
336 u8 *payload = skb->data; 343 u8 *payload = skb->data;
337 if (!inet->hdrincl) 344 if (!inet->hdrincl)