Share via

How to obtain network sub-inteface index via user mode WinAPI?

Urfin Dgus 1 Reputation point
2021-08-17T21:46:55.253+00:00

There is network interface index which can be obtained by IP Helper API. Also there is such thing as network sub-interface index which I am struggling to find a way to access.

I am using a third party library which comes with a driver that eventually calls FwpsInjectNetworkReceiveAsync0 function of the Windows Filtering Platform. My user mode code is supposed to deliver this sub-interface index for that function to use, but I do not know where to get it from.

I have looked through the IP Helper API, but all I could find were the functions that return the interface index, not the sub-interface one. Not much information in documentation either it would seem: some enumerations, a few kernel mode functions that require it as argument, but none that would actually deliver it.

Windows development | Windows API - Win32
Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,736 Reputation points Microsoft External Staff
    2021-08-18T02:12:12.753+00:00

    The FwpsInjectNetworkReceiveAsync0 cooperate with FwpsCalloutRegister0. The classifyFn0 callout function of FWPS_CALLOUT0 structure will receive the information. There is a GitHub sample.
    Edit: I also find the PPP_PROJECTION_INFO structure has the SubInterfaceIndex information.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.