numam-dpdk/lib/librte_net/rte_icmp.h

43 lines
813 B
C
Raw Normal View History

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2013 6WIND S.A.
* All rights reserved.
app/testpmd: add engine that replies to ARP and ICMP echo requests Add a new specific packet processing engine in the "testpmd" application that only replies to ARP requests and to ICMP echo requests. For this purpose, a new "icmpecho" forwarding mode is provided that can be dynamically selected with the following testpmd command: set fwd icmpecho before starting the receipt of packets on the selected ports. Then, the "icmpecho" engine performs the following actions on all received packets: - replies to a received ARP request by sending back on the RX port a ARP reply with a "sender hardware address" field containing the MAC address of the RX port, - replies to a ICMP echo request by sending back on the RX port a ICMP echo reply, swapping the IP source and the IP destination address in the IP header, - otherwise, simply drops the received packet. When replying to a received packet that was encapsulated into a VLAN tunnel, the reply is sent back with the same VLAN identifier. By default, the testpmd configures VLAN header stripping RX option on each port. This option is not managed by the icmpecho engine which won't detect packets that were encapsulated into a VLAN. To address this issue, the VLAN header stripping option must be previously switched off with the following testpmd command: vlan set strip off When the "verbose" mode has been set with the testpmd command "set verbose 1", the "icmpecho" engine displays informations about each received packet. The "icmpecho" forwarding engine can also be used to simply check port connectivity at the hardware level (check that cables are well-plugged) and at the software level (receipt of VLAN packets, for instance). Signed-off-by: Ivan Boule <ivan.boule@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-04-30 13:30:11 +00:00
*/
#ifndef _RTE_ICMP_H_
#define _RTE_ICMP_H_
/**
* @file
*
* ICMP-related defines
*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* ICMP Header
*/
struct icmp_hdr {
uint8_t icmp_type; /* ICMP packet type. */
uint8_t icmp_code; /* ICMP packet code. */
uint16_t icmp_cksum; /* ICMP packet checksum. */
uint16_t icmp_ident; /* ICMP packet identifier. */
uint16_t icmp_seq_nb; /* ICMP packet sequence number. */
} __attribute__((__packed__));
/* ICMP packet types */
#define IP_ICMP_ECHO_REPLY 0
#define IP_ICMP_ECHO_REQUEST 8
#ifdef __cplusplus
}
#endif
#endif /* RTE_ICMP_H_ */