Thanks for the replies.
I fixed the UDP send problem so we’re good there but now I am trying to
receive data from a multicast group.
To receive, the driver is doing the following:
- Bind to the UDP stack
- Using the Local IP Add and the Multicast group address, the driver
attempts to join the MCast group.
When the driver send the IOCTL_TCP_SET_INFORMATION_EX, IoCallDriver returns
with a STATUS_INVALID_ADDRESS error.
The code that the driver is calling is below.
For what is is worth, the driver is able to successfully send
IOCTL_TCP_SET_INFORMATION_EX for AO_OPTION_MCASTIF and AO_OPTION_MCASTTTL
using the same code.
Any ideas will be greatly appreciated.
TIA.
Code:
NTSTATUS
AddMulticast(
PFILE_OBJECT pFileObject,
ULONG IPAdd) // In host order
{
NSTATUS status
DEVICE_OBJECT pDeviceObject
IO__STATUS_BLOCK IoStatusBlock;
PIRP pIrp;
KEVENT event;
PTCP_REQUEST_SET_INFORMATION_EX pInputInfo;
ULONG remoteAddr = htonl(0xE000001);
ULONG localAddr = htonl(0xC0A8010F);
struct ip_mreq mreq;
mreq.imr_multiaddr.s_addr = remoteAddr;
mreq.imr_interface.s_addr = localAddr;
KeInitializeEvent(&event, NotificationEvent, FALSE);
pInputInfo = (PTCP_REQUEST_SET_INFORMATION_EX)ExAllocatePoolWithTag(
PagedPool,
sizeof(TCP_REQUEST_SET_INFORMATION_EX)+sizeof(struct ip_mreq),
JS_UTIL_TAG);
if (pInputInfo == NULL)
{
DBGPRINT(5, (“AddMulticast: Failed to allocate memory.\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}
// Join the MCast group
RtlZeroMemory(pInputInfo,
sizeof(TCP_REQUEST_SET_INFORMATION_EX)+sizeof(struct ip_mreq));
pInputInfo->ID.toi_entity.tei_entity = CL_TL_ENTITY;
pInputInfo->ID.toi_entity.tei_instance = TL_INSTANCE;
pInputInfo->ID.toi_class = INFO_CLASS_PROTOCOL;
pInputInfo->ID.toi_type = INFO_TYPE_ADDRESS_OBJECT;
pInputInfo->ID.toi_id = AO_OPTION_ADD_MCAST;
pInputInfo->BufferSize = sizeof(struct ip_mreq);
RtlCopyMemory(pInputInfo->Buffer, (PUCHAR)&mreq, sizeof(struct ip_mreq));
pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
pIrp = IoBuildDeviceIoControlRequest( IOCTL_TCP_SET_INFORMATION_EX,
pDeviceObject,
pInputInfo,
sizeof(TCP_REQUEST_SET_INFORMATION_EX)+pInputInfo->BufferSize,
NULL,
0,
FALSE,
&event,
&IoStatusBlock);
PIO_STACK_LOCATION pStack;
pStack = IoGetNextIrpStackLocation(pIrp);
pStack->FileObject = pFileObject;
status = IoCallDriver(pDeviceObject, pIrp);
if(status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = IoStatusBlock.Status;
}
else if (!NT_SUCCESS(status))
{
DBGPRINT(5, (“AddMulticast: Failed to add to multicast group. Status:
%#x.\n”, status));
}
ExFreePoolWithTag(pInput, JS_UTIL_TAG);
return status;
}
“JimmyJ” wrote in message news:xxxxx@ntdev…
> All,
>
> I am writing a TDI client driver to run on WinXP, SP2. One of the
> requirements of the driver is to send/rcv multicast packets. The driver
> works in conjunction with a WSK app that adds a local interface to the
> multicast cast group. Within the TDI client driver we are doing the
> following:
> 1. Binding to the IPMULTICAST device using the IP address of the local
> interface plus an arbitary port number.
> 2. To send the datagram, we are using TdiBuildSendDatagram with the
> SendDatagramInfo set with the address of the multicast add/port.
>
> When the driver calls IoCallDriver to send the datagram, it returns with
> and invalid parameter error.
>
> So the question is: can someone please tell me how to send a UDP datagram
> to a multicast group from within a TDI client driver?
>
> TIA,
> Jim
>
>
>
>