Skip to content

Commit 2b246b2

Browse files
Andreas Roeselerdavem330
authored andcommitted
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>
1 parent fdb5cc6 commit 2b246b2

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎include/uapi/linux/icmp.h‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
#include <linux/types.h>
2222
#include <asm/byteorder.h>
23+
#include <linux/in.h>
24+
#include <linux/if.h>
25+
#include <linux/in6.h>
2326

2427
#define ICMP_ECHOREPLY 0 /* Echo Reply */
2528
#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
@@ -66,6 +69,23 @@
6669
#define ICMP_EXC_TTL 0 /* TTL count exceeded */
6770
#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
6871

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 */
6989

7090
struct icmphdr {
7191
__u8 type;
@@ -118,4 +138,26 @@ struct icmp_extobj_hdr {
118138
__u8 class_type;
119139
};
120140

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+
};
121163
#endif /* _UAPI_LINUX_ICMP_H */

0 commit comments

Comments
 (0)