blob: 77cb3288d589e15d6399e9e22cf8f8b8012677e1 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_ICMP_H
20#define _UAPI_LINUX_ICMP_H
21#include <linux/types.h>
Christopher Ferris25c18d42020-10-14 17:42:58 -070022#include <asm/byteorder.h>
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +000023#include <linux/if.h>
24#include <linux/in6.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070025#define ICMP_ECHOREPLY 0
Ben Cheng655a7c02013-10-16 16:09:24 -070026#define ICMP_DEST_UNREACH 3
27#define ICMP_SOURCE_QUENCH 4
28#define ICMP_REDIRECT 5
29#define ICMP_ECHO 8
Ben Cheng655a7c02013-10-16 16:09:24 -070030#define ICMP_TIME_EXCEEDED 11
31#define ICMP_PARAMETERPROB 12
32#define ICMP_TIMESTAMP 13
33#define ICMP_TIMESTAMPREPLY 14
Ben Cheng655a7c02013-10-16 16:09:24 -070034#define ICMP_INFO_REQUEST 15
35#define ICMP_INFO_REPLY 16
36#define ICMP_ADDRESS 17
37#define ICMP_ADDRESSREPLY 18
Ben Cheng655a7c02013-10-16 16:09:24 -070038#define NR_ICMP_TYPES 18
39#define ICMP_NET_UNREACH 0
40#define ICMP_HOST_UNREACH 1
41#define ICMP_PROT_UNREACH 2
Ben Cheng655a7c02013-10-16 16:09:24 -070042#define ICMP_PORT_UNREACH 3
43#define ICMP_FRAG_NEEDED 4
44#define ICMP_SR_FAILED 5
45#define ICMP_NET_UNKNOWN 6
Ben Cheng655a7c02013-10-16 16:09:24 -070046#define ICMP_HOST_UNKNOWN 7
47#define ICMP_HOST_ISOLATED 8
48#define ICMP_NET_ANO 9
49#define ICMP_HOST_ANO 10
Ben Cheng655a7c02013-10-16 16:09:24 -070050#define ICMP_NET_UNR_TOS 11
51#define ICMP_HOST_UNR_TOS 12
52#define ICMP_PKT_FILTERED 13
53#define ICMP_PREC_VIOLATION 14
Ben Cheng655a7c02013-10-16 16:09:24 -070054#define ICMP_PREC_CUTOFF 15
55#define NR_ICMP_UNREACH 15
56#define ICMP_REDIR_NET 0
57#define ICMP_REDIR_HOST 1
Ben Cheng655a7c02013-10-16 16:09:24 -070058#define ICMP_REDIR_NETTOS 2
59#define ICMP_REDIR_HOSTTOS 3
60#define ICMP_EXC_TTL 0
61#define ICMP_EXC_FRAGTIME 1
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +000062#define ICMP_EXT_ECHO 42
63#define ICMP_EXT_ECHOREPLY 43
64#define ICMP_EXT_CODE_MAL_QUERY 1
65#define ICMP_EXT_CODE_NO_IF 2
66#define ICMP_EXT_CODE_NO_TABLE_ENT 3
67#define ICMP_EXT_CODE_MULT_IFS 4
68#define ICMP_EXT_ECHOREPLY_ACTIVE (1 << 2)
69#define ICMP_EXT_ECHOREPLY_IPV4 (1 << 1)
70#define ICMP_EXT_ECHOREPLY_IPV6 1
71#define ICMP_EXT_ECHO_CTYPE_NAME 1
72#define ICMP_EXT_ECHO_CTYPE_INDEX 2
73#define ICMP_EXT_ECHO_CTYPE_ADDR 3
74#define ICMP_AFI_IP 1
75#define ICMP_AFI_IP6 2
Ben Cheng655a7c02013-10-16 16:09:24 -070076struct icmphdr {
Tao Baod7db5942015-01-28 10:07:51 -080077 __u8 type;
78 __u8 code;
79 __sum16 checksum;
Tao Baod7db5942015-01-28 10:07:51 -080080 union {
81 struct {
82 __be16 id;
83 __be16 sequence;
Tao Baod7db5942015-01-28 10:07:51 -080084 } echo;
85 __be32 gateway;
86 struct {
Christopher Ferris80ae69d2022-08-02 16:32:21 -070087#ifdef __BIONIC__
Tao Baod7db5942015-01-28 10:07:51 -080088 __be16 __linux_unused;
Christopher Ferris80ae69d2022-08-02 16:32:21 -070089#else
90 __be16 __linux_unused;
91#endif
Tao Baod7db5942015-01-28 10:07:51 -080092 __be16 mtu;
93 } frag;
Christopher Ferris49f525c2016-12-12 14:55:36 -080094 __u8 reserved[4];
Tao Baod7db5942015-01-28 10:07:51 -080095 } un;
Christopher Ferris49f525c2016-12-12 14:55:36 -080096};
Ben Cheng655a7c02013-10-16 16:09:24 -070097#define ICMP_FILTER 1
98struct icmp_filter {
Tao Baod7db5942015-01-28 10:07:51 -080099 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800100};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700101struct icmp_ext_hdr {
102#ifdef __LITTLE_ENDIAN_BITFIELD
103 __u8 reserved1 : 4, version : 4;
104#elif defined(__BIG_ENDIAN_BITFIELD)
105 __u8 version : 4, reserved1 : 4;
106#else
107#error "Please fix <asm/byteorder.h>"
108#endif
109 __u8 reserved2;
110 __sum16 checksum;
111};
112struct icmp_extobj_hdr {
113 __be16 length;
114 __u8 class_num;
115 __u8 class_type;
116};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000117struct icmp_ext_echo_ctype3_hdr {
118 __be16 afi;
119 __u8 addrlen;
120 __u8 reserved;
121};
122struct icmp_ext_echo_iio {
123 struct icmp_extobj_hdr extobj_hdr;
124 union {
125 char name[IFNAMSIZ];
126 __be32 ifindex;
127 struct {
128 struct icmp_ext_echo_ctype3_hdr ctype3_hdr;
129 union {
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000130 __be32 ipv4_addr;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000131 struct in6_addr ipv6_addr;
132 } ip_addr;
133 } addr;
134 } ident;
135};
Ben Cheng655a7c02013-10-16 16:09:24 -0700136#endif