Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

icmp: add support for RFC 8335 PROBE

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

Signed-off-by: Andreas Roeseler <andreas.a.roeseler@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andreas Roeseler and committed by
David S. Miller
2b246b25 fdb5cc6a

+42
+42
include/uapi/linux/icmp.h
··· 20 20 21 21 #include <linux/types.h> 22 22 #include <asm/byteorder.h> 23 + #include <linux/in.h> 24 + #include <linux/if.h> 25 + #include <linux/in6.h> 23 26 24 27 #define ICMP_ECHOREPLY 0 /* Echo Reply */ 25 28 #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ ··· 69 66 #define ICMP_EXC_TTL 0 /* TTL count exceeded */ 70 67 #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ 71 68 69 + /* Codes for EXT_ECHO (PROBE) */ 70 + #define ICMP_EXT_ECHO 42 71 + #define ICMP_EXT_ECHOREPLY 43 72 + #define ICMP_EXT_MAL_QUERY 1 /* Malformed Query */ 73 + #define ICMP_EXT_NO_IF 2 /* No such Interface */ 74 + #define ICMP_EXT_NO_TABLE_ENT 3 /* No such Table Entry */ 75 + #define ICMP_EXT_MULT_IFS 4 /* Multiple Interfaces Satisfy Query */ 76 + 77 + /* Constants for EXT_ECHO (PROBE) */ 78 + #define EXT_ECHOREPLY_ACTIVE (1 << 2)/* active bit in reply message */ 79 + #define EXT_ECHOREPLY_IPV4 (1 << 1)/* ipv4 bit in reply message */ 80 + #define EXT_ECHOREPLY_IPV6 1 /* ipv6 bit in reply message */ 81 + #define EXT_ECHO_CTYPE_NAME 1 82 + #define EXT_ECHO_CTYPE_INDEX 2 83 + #define EXT_ECHO_CTYPE_ADDR 3 84 + #define ICMP_AFI_IP 1 /* Address Family Identifier for ipv4 */ 85 + #define ICMP_AFI_IP6 2 /* Address Family Identifier for ipv6 */ 72 86 73 87 struct icmphdr { 74 88 __u8 type; ··· 138 118 __u8 class_type; 139 119 }; 140 120 121 + /* RFC 8335: 2.1 Header for c-type 3 payload */ 122 + struct icmp_ext_echo_ctype3_hdr { 123 + __be16 afi; 124 + __u8 addrlen; 125 + __u8 reserved; 126 + }; 127 + 128 + /* RFC 8335: 2.1 Interface Identification Object */ 129 + struct icmp_ext_echo_iio { 130 + struct icmp_extobj_hdr extobj_hdr; 131 + union { 132 + char name[IFNAMSIZ]; 133 + __be32 ifindex; 134 + struct { 135 + struct icmp_ext_echo_ctype3_hdr ctype3_hdr; 136 + union { 137 + struct in_addr ipv4_addr; 138 + struct in6_addr ipv6_addr; 139 + } ip_addr; 140 + } addr; 141 + } ident; 142 + }; 141 143 #endif /* _UAPI_LINUX_ICMP_H */