[TCPIP] Implement IOCTL_ICMP_ECHO_REQUEST in tcpip.sys

Also clean up ICMP handling code in sdk/lib/drivers/ip
CORE-10760
This commit is contained in:
Victor Perevertkin 2019-11-18 20:55:10 +03:00 committed by Victor Perevertkin
parent dd2ff41dfc
commit 740a859e92
9 changed files with 505 additions and 241 deletions

View file

@ -7,12 +7,15 @@
#pragma once
#include <pshpack1.h>
typedef struct ICMP_HEADER {
UCHAR Type; /* ICMP message type */
UCHAR Code; /* ICMP message code */
USHORT Checksum; /* ICMP message checksum */
ULONG Unused; /* ICMP unused */
UINT8 Type; /* ICMP message type */
UINT8 Code; /* ICMP message code */
UINT16 Checksum; /* ICMP message checksum */
UINT16 Identifier; /* ICMP Echo message identifier */
UINT16 Seq; /* ICMP Echo message sequence num */
} ICMP_HEADER, *PICMP_HEADER;
#include <poppack.h>
/* ICMP message types */
#define ICMP_TYPE_ECHO_REPLY 0 /* Echo reply */
@ -48,6 +51,12 @@ typedef struct ICMP_HEADER {
/* ICMP codes for ICMP_TYPE_PARAMETER */
#define ICMP_CODE_TP_POINTER 1 /* Pointer indicates the error */
NTSTATUS
DispEchoRequest(
PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PIO_STACK_LOCATION IrpSp);
NTSTATUS ICMPSendDatagram(
PADDRESS_FILE AddrFile,
PTDI_CONNECTION_INFORMATION ConnInfo,
@ -63,11 +72,6 @@ VOID ICMPReceive(
PIP_INTERFACE Interface,
PIP_PACKET IPPacket);
VOID ICMPTransmit(
PIP_PACKET IPPacket,
PIP_TRANSMIT_COMPLETE Complete,
PVOID Context);
VOID ICMPReply(
PIP_INTERFACE Interface,
PIP_PACKET IPPacket,

View file

@ -15,7 +15,9 @@
#include <tilists.h>
#include <lock.h>
#include <interface.h>
#include <fileobjs.h>
#include <chew/chew.h>
#include <pseh/pseh2.h>
#include <psdk/ipexport.h>
#endif /* _TCPIP_PCH_ */

View file

@ -36,4 +36,14 @@ NTSTATUS AddGenericHeaderIPv4(
UINT ExtraLength,
PVOID *NextHeader );
NTSTATUS BuildRawIpPacket(
PADDRESS_FILE AddrFile,
PIP_PACKET Packet,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
PIP_ADDRESS LocalAddress,
USHORT LocalPort,
PCHAR DataBuffer,
UINT DataLen);
/* EOF */