NDIS6 LWF - Find interfaces and inject packets to the right interface

Hello everyone,

I’m porting a kind of virtual switch from Linux/FreeBSD systems to Windows but I’ve reached a brick wall in the last 10 days.
The system is made of 2 main components, a WDM kernel module (the core of the system) and an NDIS LWF module that needs to talk with the core module.
What I need to do is take everything reaching every network interface and redirect it to the core module: then inject the packets (if needed) from the core to the right network interface. The modules are currently speaking with each other with IOCTLs, mainly used to exchange function pointers between them.

What I’ve done for now is the core module (it works with virtual ports right now) but I’m struggling with a big problem. How can I enumerate all the interfaces in the system from the core module? Is there a way to get directly an interface handle from an ifIndex/Guid/friendly_name? I can’t this in userspace for compatibility with the original software.

The second question is, once I’ve enumerated the interfaces, how can I specify which interface is involved in the packet sending procedure? I need to call from the core module NdisSendNetBufferLists() specifying the right NDIS_HANDLE?

Thanks everyone,

-Alessio