Hyper-V 可扩展交换机扩展开发为 NDIS 筛选器驱动程序。 因此,扩展的 INF 要求基于所有 NDIS 筛选器驱动程序的 INF 要求。 为可扩展交换机扩展创建 INF 文件时,应使用 INF 设置进行修改或监视筛选器驱动程序。 有关这些设置的详细信息,请参阅 筛选器驱动程序的 INF 文件设置。
此外,必须为可扩展交换机扩展的 INF 文件遵循以下准则:
可扩展交换机扩展必须安装为修改筛选器驱动程序。
有关修改筛选器驱动程序的 INF 要求的详细信息,请参阅 为修改筛选器驱动程序配置 INF 文件。
Note An extension with a filter class of ms_switch_capture can perform the same tasks as a monitoring filter driver. 有关详细信息,请参阅 筛选器驱动程序的类型。
The FilterMediaTypes entry in the filter INF file defines the driver's bindings to other drivers and interfaces. The FilterMediaTypes entry for an extensible switch extension must include the vmnetextension value. 此值指定对可扩展交换机扩展微型端口适配器的绑定。
The FilterMediaTypes entry allows a comma-delimited list of media types to be specified. 这样,扩展就可以绑定到物理接口或可扩展交换机接口。
The following example shows a FilterMediaTypes entry that allows an extension to be bound to either the physical Ethernet network adapter or an extensible switch virtual network adapter.
HKR, Ndi\Interfaces, FilterMediaTypes, , "ethernet, vmnetextension"If the FilterMediaTypes entry only specifies the vmnetextension value, the extension will only bind to the driver stacks for all extensible switches on the system.
If the FilterMediaTypes entry specifies vmnetextension as well as other media types, the extension can determine whether it is bound within an extensible switch driver stack by calling NdisFGetOptionalSwitchHandlers. 如果函数返回NDIS_STATUS_SUCCESS,则扩展在扩展驱动程序堆栈中绑定。 如果函数返回NDIS_STATUS_NOT_SUPPORTED,扩展将绑定到驱动程序堆栈中,以获取不同的物理网络接口。
For more information about the FilterMediaTypes entry, see Intermediate Driver UpperRange And LowerRange INF File Entries.
The FilterClass value in the INF file for an extension determines its order in a stack of filters. The FilterClass entry must contain one of the values from the following table.
FilterClass value Description ms_switch_capture
此类的扩展监视数据包流量。 但是,此类扩展不能应用端口策略或更改数据包的目标端口。
For more information about this class of extension, see Capturing Extensions.
ms_switch_filter
此类的扩展会筛选数据包流量,并强制实施通过可扩展交换机传送数据包的端口或交换机策略。 此类驱动程序还可以根据策略设置检查和删除每个数据包的目标端口。
For more information about this class of extension, see Filtering Extensions.
ms_switch_forward
An extension of this class has the same capabilities as the ms_switch_filter class. 此类扩展还可以将数据包转发到其他可扩展交换机端口,并将数据包流量注入到任何可扩展交换机端口。
On the ingress data path, this class of extension is invoked after the ms_switch_filter class of extension. On the egress data path, this class of extension is invoked before the ms_switch_filter class of extension.
For more information about this class of extension, see Forwarding Extensions.
Note Only one extension of this class is allowed in the extensible switch driver stack.
使用这些 INF 设置安装扩展时,它将配置为绑定到每个可扩展交换机实例。 但是,绑定将被禁用,并且必须通过 PowerShell cmdlet 显式启用。 有关此过程的详细信息,请参阅 “启用 Hyper-V 可扩展交换机扩展”。