datapath-windows/ovsext/Vport.c
/*
 * --------------------------------------------------------------------------
 * For external and internal vports 'portFriendlyName' parameter, provided by
  * Hyper-V, is overwritten with the interface alias name and NIC friendly name
  * equivalent.
 * --------------------------------------------------------------------------
 */
For external and internal vports 'portFriendlyName' parameter, provided by
Hyper-V, is overwritten with the interface alias name and NIC friendly name
equivalent.
For external and internal vports ' portFriendlyName ' parameter provided by Hyper - V is overwritten with the interface alias name and NIC friendly name equivalent .
static NTSTATUS
GetNICAlias(PNDIS_SWITCH_NIC_PARAMETERS nicParam,
            IF_COUNTED_STRING *portFriendlyName)
{
    NTSTATUS status = STATUS_SUCCESS;
    WCHAR interfaceName[IF_MAX_STRING_SIZE + 1];
    NET_LUID interfaceLuid;
    size_t len;
    if (nicParam->NicType == NdisSwitchNicTypeInternal) {
        RtlCopyMemory(portFriendlyName, &nicParam->NicFriendlyName,
                      sizeof nicParam->NicFriendlyName);
    return status;
    }
    status = ConvertInterfaceGuidToLuid(&nicParam->NetCfgInstanceId,
                                        &interfaceLuid);
    if (status == STATUS_SUCCESS) {
        status = ConvertInterfaceLuidToAlias(&interfaceLuid, interfaceName,
                                             IF_MAX_STRING_SIZE + 1);
        if (status == STATUS_SUCCESS) {
            RtlStringCbPrintfW(portFriendlyName->String,
                               IF_MAX_STRING_SIZE, L"%s", interfaceName);
            status = RtlStringCbLengthW(portFriendlyName->String,
                                        IF_MAX_STRING_SIZE, &len);
            if (!NT_SUCCESS(status)) {
                OVS_LOG_ERROR("Failed to get the length of the string,"
                              "status: %x", status);
                return status;
            }
            portFriendlyName->Length = (USHORT)len;
        } else {
            OVS_LOG_ERROR("Fail to convert interface LUID to alias, status: %x",
                status);
        }
    } else {
        OVS_LOG_ERROR("Fail to convert interface GUID to LUID, status: %x",
                      status);
    }
    return status;
}
static NTSTATUS GetNICAlias ( PNDIS_SWITCH_NIC_PARAMETERS nicParam , IF_COUNTED_STRING * portFriendlyName ) { NTSTATUS status = STATUS_SUCCESS ; WCHAR interfaceName [ IF_MAX_STRING_SIZE + 1 ] ; NET_LUID interfaceLuid ; size_t len ; if ( nicParam -> NicType == NdisSwitchNicTypeInternal ) { RtlCopyMemory ( portFriendlyName , & nicParam -> NicFriendlyName , sizeof nicParam -> NicFriendlyName ) ; return status ; } status = ConvertInterfaceGuidToLuid ( & nicParam -> NetCfgInstanceId , & interfaceLuid ) ; if ( status == STATUS_SUCCESS ) { status = ConvertInterfaceLuidToAlias ( & interfaceLuid , interfaceName , IF_MAX_STRING_SIZE + 1 ) ; if ( status == STATUS_SUCCESS ) { RtlStringCbPrintfW ( portFriendlyName -> String , IF_MAX_STRING_SIZE , L" " , interfaceName ) ; status = RtlStringCbLengthW ( portFriendlyName -> String , IF_MAX_STRING_SIZE , & len ) ; if ( ! NT_SUCCESS ( status ) ) { OVS_LOG_ERROR ( " " " " , status ) ; return status ; } portFriendlyName -> Length = ( USHORT ) len ; } else { OVS_LOG_ERROR ( " " , status ) ; } } else { OVS_LOG_ERROR ( " " , status ) ; } return status ; }
For external and internal vports 'portFriendlyName' parameter, provided by
 Hyper-V, is overwritten with the interface alias name and NIC friendly name
 equivalent.
For external and internal vports ' portFriendlyName ' parameter provided by Hyper - V is overwritten with the interface alias name and NIC friendly name equivalent .
/*
         * Must be called from PASSIVE_LEVEL. Resulted in a
         * STATUS_INVALID_DEVICE_REQUEST if not.
         */