Add definitions for PROBE ICMP types and codes. Add AFI definitions for IP and IPV6 as specified by IANA Add a struct to represent the additional header when probing by IP address (ctype == 3) for use in parsing incoming PROBE messages Add a struct to represent the entire Interface Identification Object (IIO) section of an incoming PROBE packet
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -20,6 +20,9 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <asm/byteorder.h> | 22 | #include <asm/byteorder.h> |
| 23 | #include <linux/in.h> | ||
| 24 | #include <linux/if.h> | ||
| 25 | #include <linux/in6.h> | ||
| 23 | 26 | ||
| 24 | #define ICMP_ECHOREPLY 0 /* Echo Reply */ | 27 | #define ICMP_ECHOREPLY 0 /* Echo Reply */ |
| 25 | #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ | 28 | #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ |
| @@ -66,6 +69,23 @@ · 40 unmodified lines | |||
| 66 | #define ICMP_EXC_TTL 0 /* TTL count exceeded */ | 69 | #define ICMP_EXC_TTL 0 /* TTL count exceeded */ |
| 67 | #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ | 70 | #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ |
| 68 | 71 | ||
| 72 | /* Codes for EXT_ECHO (PROBE) */ | ||
| 73 | #define ICMP_EXT_ECHO 42 | ||
| 74 | #define ICMP_EXT_ECHOREPLY 43 | ||
| 75 | #define ICMP_EXT_MAL_QUERY 1 /* Malformed Query */ | ||
| 76 | #define ICMP_EXT_NO_IF 2 /* No such Interface */ | ||
| 77 | #define ICMP_EXT_NO_TABLE_ENT 3 /* No such Table Entry */ | ||
| 78 | #define ICMP_EXT_MULT_IFS 4 /* Multiple Interfaces Satisfy Query */ | ||
| 79 | |||
| 80 | /* Constants for EXT_ECHO (PROBE) */ | ||
| 81 | #define EXT_ECHOREPLY_ACTIVE (1 << 2)/* active bit in reply message */ | ||
| 82 | #define EXT_ECHOREPLY_IPV4 (1 << 1)/* ipv4 bit in reply message */ | ||
| 83 | #define EXT_ECHOREPLY_IPV6 1 /* ipv6 bit in reply message */ | ||
| 84 | #define EXT_ECHO_CTYPE_NAME 1 | ||
| 85 | #define EXT_ECHO_CTYPE_INDEX 2 | ||
| 86 | #define EXT_ECHO_CTYPE_ADDR 3 | ||
| 87 | #define ICMP_AFI_IP 1 /* Address Family Identifier for ipv4 */ | ||
| 88 | #define ICMP_AFI_IP6 2 /* Address Family Identifier for ipv6 */ | ||
| 69 | 89 | ||
| 70 | struct icmphdr { | 90 | struct icmphdr { |
| 71 | __u8 type; | 91 | __u8 type; |
| @@ -118,4 +138,26 @@ struct icmp_extobj_hdr { · 46 unmodified lines | |||
| 118 | __u8 class_type; | 138 | __u8 class_type; |
| 119 | }; | 139 | }; |
| 120 | 140 | ||
| 141 | /* RFC 8335: 2.1 Header for c-type 3 payload */ | ||
| 142 | struct icmp_ext_echo_ctype3_hdr { | ||
| 143 | __be16 afi; | ||
| 144 | __u8 addrlen; | ||
| 145 | __u8 reserved; | ||
| 146 | }; | ||
| 147 | |||
| 148 | /* RFC 8335: 2.1 Interface Identification Object */ | ||
| 149 | struct icmp_ext_echo_iio { | ||
| 150 | struct icmp_extobj_hdr extobj_hdr; | ||
| 151 | union { | ||
| 152 | char name[IFNAMSIZ]; | ||
| 153 | __be32 ifindex; | ||
| 154 | struct { | ||
| 155 | struct icmp_ext_echo_ctype3_hdr ctype3_hdr; | ||
| 156 | union { | ||
| 157 | struct in_addr ipv4_addr; | ||
| 158 | struct in6_addr ipv6_addr; | ||
| 159 | } ip_addr; | ||
| 160 | } addr; | ||
| 161 | } ident; | ||
| 162 | }; | ||
| 121 | #endif /* _UAPI_LINUX_ICMP_H */ | 163 | #endif /* _UAPI_LINUX_ICMP_H */ |