xref: /OK3568_Linux_fs/kernel/include/linux/icmp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * INET		An implementation of the TCP/IP protocol suite for the LINUX
4*4882a593Smuzhiyun  *		operating system.  INET is implemented using the  BSD Socket
5*4882a593Smuzhiyun  *		interface as the means of communication with the user level.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  *		Definitions for the ICMP protocol.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * Version:	@(#)icmp.h	1.0.3	04/28/93
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * Author:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12*4882a593Smuzhiyun  */
13*4882a593Smuzhiyun #ifndef _LINUX_ICMP_H
14*4882a593Smuzhiyun #define	_LINUX_ICMP_H
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #include <linux/skbuff.h>
17*4882a593Smuzhiyun #include <uapi/linux/icmp.h>
18*4882a593Smuzhiyun #include <uapi/linux/errqueue.h>
19*4882a593Smuzhiyun 
icmp_hdr(const struct sk_buff * skb)20*4882a593Smuzhiyun static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
21*4882a593Smuzhiyun {
22*4882a593Smuzhiyun 	return (struct icmphdr *)skb_transport_header(skb);
23*4882a593Smuzhiyun }
24*4882a593Smuzhiyun 
icmp_is_err(int type)25*4882a593Smuzhiyun static inline bool icmp_is_err(int type)
26*4882a593Smuzhiyun {
27*4882a593Smuzhiyun 	switch (type) {
28*4882a593Smuzhiyun 	case ICMP_DEST_UNREACH:
29*4882a593Smuzhiyun 	case ICMP_SOURCE_QUENCH:
30*4882a593Smuzhiyun 	case ICMP_REDIRECT:
31*4882a593Smuzhiyun 	case ICMP_TIME_EXCEEDED:
32*4882a593Smuzhiyun 	case ICMP_PARAMETERPROB:
33*4882a593Smuzhiyun 		return true;
34*4882a593Smuzhiyun 	}
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun 	return false;
37*4882a593Smuzhiyun }
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun void ip_icmp_error_rfc4884(const struct sk_buff *skb,
40*4882a593Smuzhiyun 			   struct sock_ee_data_rfc4884 *out,
41*4882a593Smuzhiyun 			   int thlen, int off);
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #endif	/* _LINUX_ICMP_H */
44