diff options
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ff0f071969ea..d23c6571ba1c 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -131,18 +131,20 @@ found: | |||
131 | * 0 - deliver | 131 | * 0 - deliver |
132 | * 1 - block | 132 | * 1 - block |
133 | */ | 133 | */ |
134 | static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) | 134 | static int icmp_filter(const struct sock *sk, const struct sk_buff *skb) |
135 | { | 135 | { |
136 | int type; | 136 | struct icmphdr _hdr; |
137 | const struct icmphdr *hdr; | ||
137 | 138 | ||
138 | if (!pskb_may_pull(skb, sizeof(struct icmphdr))) | 139 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
140 | sizeof(_hdr), &_hdr); | ||
141 | if (!hdr) | ||
139 | return 1; | 142 | return 1; |
140 | 143 | ||
141 | type = icmp_hdr(skb)->type; | 144 | if (hdr->type < 32) { |
142 | if (type < 32) { | ||
143 | __u32 data = raw_sk(sk)->filter.data; | 145 | __u32 data = raw_sk(sk)->filter.data; |
144 | 146 | ||
145 | return ((1 << type) & data) != 0; | 147 | return ((1U << hdr->type) & data) != 0; |
146 | } | 148 | } |
147 | 149 | ||
148 | /* Do not block unknown ICMP types */ | 150 | /* Do not block unknown ICMP types */ |