0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _UAPI_LINUX_ICMP_H
0019 #define _UAPI_LINUX_ICMP_H
0020
0021 #include <linux/types.h>
0022 #include <asm/byteorder.h>
0023 #include <linux/if.h>
0024 #include <linux/in6.h>
0025
0026 #define ICMP_ECHOREPLY 0
0027 #define ICMP_DEST_UNREACH 3
0028 #define ICMP_SOURCE_QUENCH 4
0029 #define ICMP_REDIRECT 5
0030 #define ICMP_ECHO 8
0031 #define ICMP_TIME_EXCEEDED 11
0032 #define ICMP_PARAMETERPROB 12
0033 #define ICMP_TIMESTAMP 13
0034 #define ICMP_TIMESTAMPREPLY 14
0035 #define ICMP_INFO_REQUEST 15
0036 #define ICMP_INFO_REPLY 16
0037 #define ICMP_ADDRESS 17
0038 #define ICMP_ADDRESSREPLY 18
0039 #define NR_ICMP_TYPES 18
0040
0041
0042
0043 #define ICMP_NET_UNREACH 0
0044 #define ICMP_HOST_UNREACH 1
0045 #define ICMP_PROT_UNREACH 2
0046 #define ICMP_PORT_UNREACH 3
0047 #define ICMP_FRAG_NEEDED 4
0048 #define ICMP_SR_FAILED 5
0049 #define ICMP_NET_UNKNOWN 6
0050 #define ICMP_HOST_UNKNOWN 7
0051 #define ICMP_HOST_ISOLATED 8
0052 #define ICMP_NET_ANO 9
0053 #define ICMP_HOST_ANO 10
0054 #define ICMP_NET_UNR_TOS 11
0055 #define ICMP_HOST_UNR_TOS 12
0056 #define ICMP_PKT_FILTERED 13
0057 #define ICMP_PREC_VIOLATION 14
0058 #define ICMP_PREC_CUTOFF 15
0059 #define NR_ICMP_UNREACH 15
0060
0061
0062 #define ICMP_REDIR_NET 0
0063 #define ICMP_REDIR_HOST 1
0064 #define ICMP_REDIR_NETTOS 2
0065 #define ICMP_REDIR_HOSTTOS 3
0066
0067
0068 #define ICMP_EXC_TTL 0
0069 #define ICMP_EXC_FRAGTIME 1
0070
0071
0072 #define ICMP_EXT_ECHO 42
0073 #define ICMP_EXT_ECHOREPLY 43
0074 #define ICMP_EXT_CODE_MAL_QUERY 1
0075 #define ICMP_EXT_CODE_NO_IF 2
0076 #define ICMP_EXT_CODE_NO_TABLE_ENT 3
0077 #define ICMP_EXT_CODE_MULT_IFS 4
0078
0079
0080 #define ICMP_EXT_ECHOREPLY_ACTIVE (1 << 2)
0081 #define ICMP_EXT_ECHOREPLY_IPV4 (1 << 1)
0082 #define ICMP_EXT_ECHOREPLY_IPV6 1
0083 #define ICMP_EXT_ECHO_CTYPE_NAME 1
0084 #define ICMP_EXT_ECHO_CTYPE_INDEX 2
0085 #define ICMP_EXT_ECHO_CTYPE_ADDR 3
0086 #define ICMP_AFI_IP 1
0087 #define ICMP_AFI_IP6 2
0088
0089 struct icmphdr {
0090 __u8 type;
0091 __u8 code;
0092 __sum16 checksum;
0093 union {
0094 struct {
0095 __be16 id;
0096 __be16 sequence;
0097 } echo;
0098 __be32 gateway;
0099 struct {
0100 __be16 __unused;
0101 __be16 mtu;
0102 } frag;
0103 __u8 reserved[4];
0104 } un;
0105 };
0106
0107
0108
0109
0110
0111
0112 #define ICMP_FILTER 1
0113
0114 struct icmp_filter {
0115 __u32 data;
0116 };
0117
0118
0119 struct icmp_ext_hdr {
0120 #if defined(__LITTLE_ENDIAN_BITFIELD)
0121 __u8 reserved1:4,
0122 version:4;
0123 #elif defined(__BIG_ENDIAN_BITFIELD)
0124 __u8 version:4,
0125 reserved1:4;
0126 #else
0127 #error "Please fix <asm/byteorder.h>"
0128 #endif
0129 __u8 reserved2;
0130 __sum16 checksum;
0131 };
0132
0133
0134 struct icmp_extobj_hdr {
0135 __be16 length;
0136 __u8 class_num;
0137 __u8 class_type;
0138 };
0139
0140
0141 struct icmp_ext_echo_ctype3_hdr {
0142 __be16 afi;
0143 __u8 addrlen;
0144 __u8 reserved;
0145 };
0146
0147
0148 struct icmp_ext_echo_iio {
0149 struct icmp_extobj_hdr extobj_hdr;
0150 union {
0151 char name[IFNAMSIZ];
0152 __be32 ifindex;
0153 struct {
0154 struct icmp_ext_echo_ctype3_hdr ctype3_hdr;
0155 union {
0156 __be32 ipv4_addr;
0157 struct in6_addr ipv6_addr;
0158 } ip_addr;
0159 } addr;
0160 } ident;
0161 };
0162 #endif