Hi,

I'm attempting to write a function for a kernel driver of ours that will
listen for a UDP broadcast on a specified port. I'm attempting to
communicate with a device on the network that when given a directed UDP
packet on a specified port unfortunately responds with a UDP broadcast to a
different port.

I tried to do an IoCallDriver call with an IRP created with
TdiBuildQueryInformation and a QType of TDI_QUERY_BROADCAST_ADDRESS to obtain
the broadcast address of the local-node. I get a status of STATUS_CANCELLED
returned.

I have many functions in our kernel drive that can communicate via UDP and
TCP successfully, but I can't seem to create a connection to the local
broadcast address. These functions work with abstract "Sockets". I know
there are no sockets like in WinSock2 in the kernel space, but our functions
use this concept via the IoGetDeviceObjectPointer call, etc., etc.. So I
have a function that will successfully create a "Socket" and with this
"Socket" I try to:

1. Find the local-node broadcast address via TdiBuildQueryInformation.
(Unsuccessfully.)
2. Attempt to bind to 0xFFFFFFFF and setup a TDI_EVENT_RECEIVE_DATAGRAM
event handler. I see the broadcast using Etherpeek, but the event handler is
never fired.

So I know that the code I have that creates a "Socket" works because I use
it all over the driver code and it works. However, I'm not sure if I have to
create the "Socket" a little different because I want to use it to accept
broadcasts. I know that in WinSock2 you have to open the socket and prime,
or set the broadcast option, to use broadcasts. It would seem logical that
there was some sort of priming needed in the kernel space using TDI also.

Any help on this subject would be much appreciated.

Thanks,
-David G

RE: Listening to broadcasts for a port using TDI by DavidG

DavidG
Thu May 18 16:32:01 CDT 2006

Sorry, never mind. It looks like my codes is OK. It was just Microsoft
Firewall. I guess since this is a driver and not an application that the
firewall did not pop up a prompt to allow or disallow access, it just
disallows it. Anyone know how to get the firewall to prompt?

-David G