Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328098
b: refs/heads/master
c: 8489c1d
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 25, 2012
1 parent f60b286 commit 9b9cb2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82c93fcc2e1737fede2752520f1bf8f4de6304d8
refs/heads/master: 8489c1d9a80e6263fb71de5bc7f39773712cfa7e
19 changes: 7 additions & 12 deletions trunk/net/ipv4/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,18 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
* 0 - deliver
* 1 - block
*/
static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb)
{
struct icmphdr _hdr;
const struct icmphdr *hdr;

pr_err("icmp_filter skb_transport_offset %d data-head %ld len %d/%d\n",
skb_transport_offset(skb), skb->data - skb->head, skb->len, skb->data_len);
hdr = skb_header_pointer(skb, skb_transport_offset(skb),
sizeof(_hdr), &_hdr);
pr_err("head %p data %p hdr %p type %d\n", skb->head, skb->data, hdr, hdr ? hdr->type : -1);
if (!hdr)
int type;

if (!pskb_may_pull(skb, sizeof(struct icmphdr)))
return 1;

if (hdr->type < 32) {
type = icmp_hdr(skb)->type;
if (type < 32) {
__u32 data = raw_sk(sk)->filter.data;

return ((1U << hdr->type) & data) != 0;
return ((1 << type) & data) != 0;
}

/* Do not block unknown ICMP types */
Expand Down

0 comments on commit 9b9cb2f

Please sign in to comment.