Modifying a Packet's Extensible Switch Source Port Data

The Hyper-V extensible switch source port is specified by the SourcePortId member in the NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO structure. This structure is contained in the out-of-band (OOB) forwarding context of the packet's NET_BUFFER_LIST structure. For more information about this context, see Hyper-V Extensible Switch Forwarding Context.

The extensible switch extension must follow these guidelines for modifying a packet's source port identifier:

  • The extensible switch extension must call SetNetBufferListSource to modify the source port for a packet. The extension must not directly modify the SourcePortId member of the NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO structure.

  • If the extension is creating or cloning a packet, it must call the AllocateNetBufferListForwardingContext function after it calls NdisAllocateNetBufferList. This function allocates an extensible switch context area for the OOB data that is used for forwarding information for the packet.

    When the extension calls AllocateNetBufferListForwardingContext, the SourcePortId member is set to NDIS_SWITCH_DEFAULT_PORT_ID. This specifies that the packet originated from an extension instead of arriving at an extensible switch port.

    Packets with a source port of NDIS_SWITCH_DEFAULT_PORT_ID are treated by the extensible switch extension data path as privileged and trusted. Such traffic should not be subjected to the policies that are applied to packets from other source ports. For example, packets with a source port identifier of NDIS_SWITCH_DEFAULT_PORT_ID bypass the built-in extensible switch policies that are applied by the underlying miniport edge of the extensible switch. These policies include access control lists (ACLs) and quality of service (QoS).

    When the extension is originating packet traffic, it should use the source port of NDIS_SWITCH_DEFAULT_PORT_ID sparingly and carefully. In most cases, the extension should modify the source port identifier to an active port on the extensible switch. This allows the policies of that port to be applied to the packet.

    However, there may be situations where the extension has to use the source port of NDIS_SWITCH_DEFAULT_PORT_ID for packets that it originates. For example, if the extension originates a control packet that has to be sent to its destination on the physical or virtual network, it should use NDIS_SWITCH_DEFAULT_PORT_ID for the source port identifier. This ensures that the packet will not be filtered and rejected by underlying extensions in the extensible switch driver stack.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft