rk: revert 20f3d0b+v3.0.66 to v3.0
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / raw.c
index 3d8bb189babbad2deaad518d483e80c8a50eb1e6..c9893d43242e52c83580f4676f20793fd5bdf48b 100644 (file)
@@ -130,20 +130,18 @@ found:
  *     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;
+       int type;
 
-       hdr = skb_header_pointer(skb, skb_transport_offset(skb),
-                                sizeof(_hdr), &_hdr);
-       if (!hdr)
+       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 */