• Menglong Dong's avatar
    net: icmp: add skb drop reasons to icmp protocol · b384c95a
    Menglong Dong authored
    Replace kfree_skb() used in icmp_rcv() and icmpv6_rcv() with
    kfree_skb_reason().
    
    In order to get the reasons of the skb drops after icmp message handle,
    we change the return type of 'handler()' in 'struct icmp_control' from
    'bool' to 'enum skb_drop_reason'. This may change its original
    intention, as 'false' means failure, but 'SKB_NOT_DROPPED_YET' means
    success now. Therefore, all 'handler' and the call of them need to be
    handled. Following 'handler' functions are involved:
    
    icmp_unreach()
    icmp_redirect()
    icmp_echo()
    icmp_timestamp()
    icmp_discard()
    
    And following new drop reasons are added:
    
    SKB_DROP_REASON_ICMP_CSUM
    SKB_DROP_REASON_INVALID_PROTO
    
    The reason 'INVALID_PROTO' is introduced for the case that the packet
    doesn't follow rfc 1122 and is dropped. This is not a common case, and
    I believe we can locate the problem from the data in the packet. For now,
    this 'INVALID_PROTO' is used for the icmp broadcasts with wrong types.
    
    Maybe there should be a document file for these reasons. For example,
    list all the case that causes the 'UNHANDLED_PROTO' and 'INVALID_PROTO'
    drop reason. Therefore, users can locate their problems according to the
    document.
    Reviewed-by: default avatarHao Peng <flyingpeng@tencent.com>
    Reviewed-by: default avatarJiang Biao <benbjiang@tencent.com>
    Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
    Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b384c95a
ping.c 28.2 KB