https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d5ad2057d7f9ef52ae321…
commit d5ad2057d7f9ef52ae3214ce78c6d6bbabaee3b0
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Fri Dec 20 23:19:41 2019 +0300
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Tue Apr 7 05:32:40 2020 +0300
[SDK][IP] Pass IP options to ReceiveDatagramHandler
---
sdk/lib/drivers/ip/transport/datagram/datagram.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/sdk/lib/drivers/ip/transport/datagram/datagram.c
b/sdk/lib/drivers/ip/transport/datagram/datagram.c
index c910ed6c386..13acca1f181 100644
--- a/sdk/lib/drivers/ip/transport/datagram/datagram.c
+++ b/sdk/lib/drivers/ip/transport/datagram/datagram.c
@@ -74,8 +74,6 @@ DGDeliverData(
*/
{
KIRQL OldIrql;
- PTDI_IND_RECEIVE_DATAGRAM ReceiveHandler;
- PVOID HandlerContext;
LONG AddressLength;
PVOID SourceAddress;
ULONG BytesTaken;
@@ -164,15 +162,22 @@ DGDeliverData(
}
else if (AddrFile->RegisteredReceiveDatagramHandler)
{
- TI_DbgPrint(MAX_TRACE, ("Calling receive event handler.\n"));
+ PTDI_IND_RECEIVE_DATAGRAM ReceiveHandler = AddrFile->ReceiveDatagramHandler;
+ PVOID HandlerContext = AddrFile->ReceiveDatagramHandlerContext;
+ PVOID OptionsData = NULL;
+ INT32 OptionsSize = 0;
- ReceiveHandler = AddrFile->ReceiveDatagramHandler;
- HandlerContext = AddrFile->ReceiveDatagramHandlerContext;
+ TI_DbgPrint(MAX_TRACE, ("Calling receive event handler.\n"));
if (SrcAddress->Type == IP_ADDRESS_V4)
{
AddressLength = sizeof(IPv4_RAW_ADDRESS);
SourceAddress = &SrcAddress->Address.IPv4Address;
+ OptionsSize = IPPacket->HeaderSize - sizeof(IPv4_HEADER);
+ if (OptionsSize > 0)
+ {
+ OptionsData = (PUCHAR)IPPacket->Header + sizeof(IPv4_HEADER);
+ }
}
else /* (Address->Type == IP_ADDRESS_V6) */
{
@@ -183,11 +188,13 @@ DGDeliverData(
ReferenceObject(AddrFile);
UnlockObject(AddrFile, OldIrql);
+ TI_DbgPrint(MIN_TRACE, ("OptionsSize %d DataSize: %u\n", OptionsSize,
DataSize));
+
Status = (*ReceiveHandler)(HandlerContext,
AddressLength,
SourceAddress,
- 0,
- NULL,
+ OptionsSize,
+ OptionsData,
TDI_RECEIVE_ENTIRE_MESSAGE,
DataSize,
DataSize,
@@ -209,7 +216,6 @@ DGDeliverData(
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
}
-
VOID DGReceiveComplete(PVOID Context, NTSTATUS Status, ULONG Count) {
PDATAGRAM_RECEIVE_REQUEST ReceiveRequest =
(PDATAGRAM_RECEIVE_REQUEST)Context;