From 78c896b3b3127515478090c19447e27dc406427e Mon Sep 17 00:00:00 2001 From: Jianfeng Tan Date: Mon, 18 Nov 2019 06:59:50 +0000 Subject: TLDKv2 Signed-off-by: Jianfeng Tan Signed-off-by: Jielong Zhou Signed-off-by: Jian Zhang Signed-off-by: Chen Zhao Change-Id: I55c39de4c6cd30f991f35631eb507f770230f08e --- test/packetdrill/icmp.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 test/packetdrill/icmp.h (limited to 'test/packetdrill/icmp.h') diff --git a/test/packetdrill/icmp.h b/test/packetdrill/icmp.h new file mode 100644 index 0000000..a35c8b5 --- /dev/null +++ b/test/packetdrill/icmp.h @@ -0,0 +1,97 @@ +/* + * Copyright 2013 Google Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ +/* + * Author: ncardwell@google.com (Neal Cardwell) + * + * Our own ICMPv4 header declarations, so we have something that's + * portable and somewhat more readable than a typical system header + * file. + */ + +#ifndef __ICMP_HEADERS_H__ +#define __ICMP_HEADERS_H__ + +#include "types.h" + +/* Most ICMPv6 message types include a copy of the outbound IP header + * and the first few bytes inside, to allow the receiver to demux by + * TCP/UDP port. The following constant specifies the number of bytes + * of TCP header that we will echo. We echo 8 bytes because that + * is the minimum number of bytes that the Linux TCP stack needs to + * read the source and destination TCP port and TCP sequence number, + * which it needs to properly demux an incoming ICMP packet to a + * specific TCP connection. + */ +#define ICMP_ECHO_BYTES 8 + +struct icmpv4 { + __u8 type; + __u8 code; + __sum16 checksum; + union { + struct { + __be16 id; + __be16 sequence; + } echo; + __be32 gateway; + struct { + __be16 unused; + __be16 mtu; + } frag; /* PMTU discovery, RFC 1191 */ + } message; +}; + +/* Our own ICMP definitions, since the names vary between platforms. */ + +/* ICMPv4 types */ +#define ICMP_ECHOREPLY 0 +#define ICMP_DEST_UNREACH 3 +#define ICMP_SOURCE_QUENCH 4 +#define ICMP_REDIRECT 5 +#define ICMP_ECHO 8 +#define ICMP_TIME_EXCEEDED 11 +#define ICMP_PARAMETERPROB 12 +#define ICMP_TIMESTAMP 13 +#define ICMP_TIMESTAMPREPLY 14 +#define ICMP_INFO_REQUEST 15 +#define ICMP_INFO_REPLY 16 +#define ICMP_ADDRESS 17 +#define ICMP_ADDRESSREPLY 18 +#define NR_ICMP_TYPES 18 + +/* Codes for ICMP_DEST_UNREACH */ +#define ICMP_NET_UNREACH 0 +#define ICMP_HOST_UNREACH 1 +#define ICMP_PROT_UNREACH 2 +#define ICMP_PORT_UNREACH 3 +#define ICMP_FRAG_NEEDED 4 +#define ICMP_SR_FAILED 5 +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 +#define ICMP_PREC_VIOLATION 14 +#define ICMP_PREC_CUTOFF 15 +#define NR_ICMP_UNREACH 15 + +#endif /* __ICMP_HEADERS_H__ */ -- cgit 1.2.3-korg