0

How do we retrieve the Local Ip address set of the NIC in NDIS 6. I will be doing some IP header modifications on the received Ethernet Frames, so will be looking for local ip of NIC card that my Filter Attached to.

Rami
  • 5
  • 3

1 Answers1

0

It's generally a layering violation for an NDIS LWF driver (which operates at layer 2 of the OSI stack) to get involved with IP addresses (which are at layer 3 of the OSI stack).

If you have a very good reason do to this, you can query GetUnicastIpAddressTable. Keep in mind that a NIC may not have any IP address (e.g., it's used for non-IP protocols). Or it may carry IP traffic, but the OS doesn't know about any IP address (e.g., a guest VM is sending IP traffic through the host's NIC, but only the guest really knows the IP address).

In other words, NICs don't really have IP addresses. At best, you can say that the NIC may be associated with an IP interface which has some number of IP addresses.

Jeffrey Tippet
  • 3,146
  • 1
  • 14
  • 15
  • I will be setting IP address for adapter manually, instead of "Obtain an IP address automatically" on the IPv4 properties. When the driver attached to the adatper that set the ip, I need to retrive the ip and use it in my driver. As you suggested I have used GetUnicastIpAddressTable to but I am not getting the Ip address that corresponds to the adapter that I attach. I have two adapters which I set ip to 10.135.24.1 (Adapter 1) and 10.136.24.0 (adapter 2). When attached to Adapter 1, I am receiving adapter 2 ip and loopback in the addresstable entries. same is the case with Adapter1. – Rami Mar 03 '17 at 08:25