Tech Support > Microsoft Windows > Drivers > Getting the ip address of a bound miniport from an intermediate driver
Getting the ip address of a bound miniport from an intermediate driver
Posted by Hillel on October 23rd, 2005


Hello all

I am writing an intermediate driver that should filter packets
addressed to the ip address of a bound miniport driver. I managed to
get the ip from the NDIS_PACKET structure, but I can't find how to
retrieve it from the bound miniport.

I tried looking for a NDIS_REQUEST to send the miniport, but with no
success.

Anyone can guide me on this?

Thanks
Hillel

Posted by Thomas F. Divine [DDK MVP] on October 23rd, 2005



"Hillel" <hillel.t@gmail.com> wrote in message
news:1130056585.711986.198390@g49g2000cwa.googlegr oups.com...
You cab filter (watch) OID_GEN_NETWORK_LAYER_ADDRESS.

Pay attention to the documentation. The lower-level NIC may not be
interested in this OID, and if it that is the case you must filter the OID
"one the way back" and change the status to NDIS_STATUS_SUCCESS.

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com


Posted by Maxim S. Shatskih on October 23rd, 2005


TCPIP will notify your IM from the upper egde by sending you the OID
(forgot the exact name - like "network layer addresses") - with the list of
IPs.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Hillel" <hillel.t@gmail.com> wrote in message
news:1130056585.711986.198390@g49g2000cwa.googlegr oups.com...


Posted by Hillel on October 24th, 2005


Thanks Maxim and Thomas. Your help was valuable.

For future use I attach the code snippet I added to my miniport
SetInformationHandler:
if (Oid == OID_GEN_NETWORK_LAYER_ADDRESSES)
{
INT i;
PNETWORK_ADDRESS_LIST NetworkAddressList = InformationBuffer;

for (i=0; i<NetworkAddressList->AddressCount; ++i)
{
PNETWORK_ADDRESS NetworkAddress = &NetworkAddressList->Address[i];

// Address type is valid as at this point NetworkAddressList >= 1
if (NetworkAddress->AddressType == NDIS_PROTOCOL_ID_TCP_IP)
{
pAdapt->IPv4Addr = *(PNETWORK_ADDRESS_IP)NetworkAddress->Address;
DbgPrint("IP Addr:%08X\n", pAdapt->IPv4Addr.in_addr); // This is the
ip address
break;
}
}
}
Note: as Thomas pointed out the code also indicates success to upper
protocols after making the actual ndis request (see DDK).
Note 2: This snippet only saves the first IP address of the interface.
This can be changed by removing the break statement and collecting all
addresses into pre allocated storage.

One more question:
I am using XP SP1 DDK, and the struct NETWORK_ADDRESS_IP I used to
parse the address, is not documented there. The equivalent struct
TDI_ADDRESS_IP is. Anyone knows why is it, and why creating two structs
in the first place?


Thanks
Hillel