Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * INET     An implementation of the TCP/IP protocol suite for the LINUX
0004  *      operating system.  INET is implemented using the  BSD Socket
0005  *      interface as the means of communication with the user level.
0006  *
0007  *      Definitions for the ICMP protocol.
0008  *
0009  * Version: @(#)icmp.h  1.0.3   04/28/93
0010  *
0011  * Author:  Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
0012  */
0013 #ifndef _LINUX_ICMP_H
0014 #define _LINUX_ICMP_H
0015 
0016 #include <linux/skbuff.h>
0017 #include <uapi/linux/icmp.h>
0018 #include <uapi/linux/errqueue.h>
0019 
0020 static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
0021 {
0022     return (struct icmphdr *)skb_transport_header(skb);
0023 }
0024 
0025 static inline bool icmp_is_err(int type)
0026 {
0027     switch (type) {
0028     case ICMP_DEST_UNREACH:
0029     case ICMP_SOURCE_QUENCH:
0030     case ICMP_REDIRECT:
0031     case ICMP_TIME_EXCEEDED:
0032     case ICMP_PARAMETERPROB:
0033         return true;
0034     }
0035 
0036     return false;
0037 }
0038 
0039 void ip_icmp_error_rfc4884(const struct sk_buff *skb,
0040                struct sock_ee_data_rfc4884 *out,
0041                int thlen, int off);
0042 
0043 #endif  /* _LINUX_ICMP_H */