1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 /* 3 * INET An implementation of the TCP/IP protocol suite for the LINUX 4 * operating system. INET is implemented using the BSD Socket 5 * interface as the means of communication with the user level. 6 * 7 * Definitions for the ICMP protocol. 8 * 9 * Version: @(#)icmp.h 1.0.3 04/28/93 10 * 11 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12 * 13 * This program is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU General Public License 15 * as published by the Free Software Foundation; either version 16 * 2 of the License, or (at your option) any later version. 17 */ 18 #ifndef _UAPI_LINUX_ICMP_H 19 #define _UAPI_LINUX_ICMP_H 20 21 #include <linux/types.h> 22 #include <asm/byteorder.h> 23 24 #define ICMP_ECHOREPLY 0 /* Echo Reply */ 25 #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ 26 #define ICMP_SOURCE_QUENCH 4 /* Source Quench */ 27 #define ICMP_REDIRECT 5 /* Redirect (change route) */ 28 #define ICMP_ECHO 8 /* Echo Request */ 29 #define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ 30 #define ICMP_PARAMETERPROB 12 /* Parameter Problem */ 31 #define ICMP_TIMESTAMP 13 /* Timestamp Request */ 32 #define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ 33 #define ICMP_INFO_REQUEST 15 /* Information Request */ 34 #define ICMP_INFO_REPLY 16 /* Information Reply */ 35 #define ICMP_ADDRESS 17 /* Address Mask Request */ 36 #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ 37 #define NR_ICMP_TYPES 18 38 39 40 /* Codes for UNREACH. */ 41 #define ICMP_NET_UNREACH 0 /* Network Unreachable */ 42 #define ICMP_HOST_UNREACH 1 /* Host Unreachable */ 43 #define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ 44 #define ICMP_PORT_UNREACH 3 /* Port Unreachable */ 45 #define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ 46 #define ICMP_SR_FAILED 5 /* Source Route failed */ 47 #define ICMP_NET_UNKNOWN 6 48 #define ICMP_HOST_UNKNOWN 7 49 #define ICMP_HOST_ISOLATED 8 50 #define ICMP_NET_ANO 9 51 #define ICMP_HOST_ANO 10 52 #define ICMP_NET_UNR_TOS 11 53 #define ICMP_HOST_UNR_TOS 12 54 #define ICMP_PKT_FILTERED 13 /* Packet filtered */ 55 #define ICMP_PREC_VIOLATION 14 /* Precedence violation */ 56 #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ 57 #define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ 58 59 /* Codes for REDIRECT. */ 60 #define ICMP_REDIR_NET 0 /* Redirect Net */ 61 #define ICMP_REDIR_HOST 1 /* Redirect Host */ 62 #define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ 63 #define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ 64 65 /* Codes for TIME_EXCEEDED. */ 66 #define ICMP_EXC_TTL 0 /* TTL count exceeded */ 67 #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ 68 69 70 struct icmphdr { 71 __u8 type; 72 __u8 code; 73 __sum16 checksum; 74 union { 75 struct { 76 __be16 id; 77 __be16 sequence; 78 } echo; 79 __be32 gateway; 80 struct { 81 __be16 __unused; 82 __be16 mtu; 83 } frag; 84 __u8 reserved[4]; 85 } un; 86 }; 87 88 89 /* 90 * constants for (set|get)sockopt 91 */ 92 93 #define ICMP_FILTER 1 94 95 struct icmp_filter { 96 __u32 data; 97 }; 98 99 /* RFC 4884 extension struct: one per message */ 100 struct icmp_ext_hdr { 101 #if defined(__LITTLE_ENDIAN_BITFIELD) 102 __u8 reserved1:4, 103 version:4; 104 #elif defined(__BIG_ENDIAN_BITFIELD) 105 __u8 version:4, 106 reserved1:4; 107 #else 108 #error "Please fix <asm/byteorder.h>" 109 #endif 110 __u8 reserved2; 111 __sum16 checksum; 112 }; 113 114 /* RFC 4884 extension object header: one for each object */ 115 struct icmp_extobj_hdr { 116 __be16 length; 117 __u8 class_num; 118 __u8 class_type; 119 }; 120 121 #endif /* _UAPI_LINUX_ICMP_H */ 122