VirtualBox

Ignore:
Timestamp:
Mar 18, 2015 5:44:08 PM (10 years ago)
Author:
vboxsync
Message:

Main/src-server/solaris: Fix description matching for vboxvnic_templates that don't have an instance number immediately following it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp

    r51092 r54838  
    5252
    5353#include "DynLoadLibSolaris.h"
     54
     55/** @todo Unify this define with VBoxNetFltBow-solaris.c */
     56#define VBOXBOW_VNIC_TEMPLATE_NAME      "vboxvnic_template"
     57
    5458
    5559static uint32_t getInstance(const char *pszIfaceName, char *pszDevName)
     
    172176        SolarisNICMap.insert(NICPair("spwr", "SMC EtherPower II 10/100 (9432) Ethernet"));
    173177        SolarisNICMap.insert(NICPair("vboxnet", "VirtualBox Host Ethernet"));
    174         SolarisNICMap.insert(NICPair("vboxvnic_template", "VirtualBox Virtual Network Interface Template"));
     178        SolarisNICMap.insert(NICPair(VBOXBOW_VNIC_TEMPLATE_NAME, "VirtualBox Virtual Network Interface Template"));
    175179        SolarisNICMap.insert(NICPair("vlan", "Virtual LAN Ethernet"));
    176180        SolarisNICMap.insert(NICPair("vr", "VIA Rhine Fast Ethernet"));
     
    191195        if (Description != "")
    192196            RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - %s", szNICInstance, Description.c_str());
     197        else if (!strncmp(szNICInstance, RT_STR_TUPLE(VBOXBOW_VNIC_TEMPLATE_NAME)))
     198        {
     199            /*
     200             * We want prefix matching only for "vboxvnic_template" as it's possible to create "vboxvnic_template_abcd123",
     201             * which our Solaris Crossbow NetFilter driver will interpret as a VNIC template.
     202             */
     203            Description = SolarisNICMap[VBOXBOW_VNIC_TEMPLATE_NAME];
     204            RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - %s", szNICInstance, Description.c_str());
     205        }
    193206        else
    194207            RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - Ethernet", szNICInstance);
     
    300313     * Skip our own dynamic VNICs but don't skip VNIC templates.
    301314     * These names originate from VBoxNetFltBow-solaris.c, hardcoded here for now.
    302      */
    303     if (    strncmp(pszIface, RT_STR_TUPLE("vboxvnic_template"))
     315     *                                                                           .
     316     * ASSUMES template name is longer than 'vboxvnic'.
     317     */
     318    if (    strncmp(pszIface, RT_STR_TUPLE(VBOXBOW_VNIC_TEMPLATE_NAME))
    304319        && !strncmp(pszIface, RT_STR_TUPLE("vboxvnic")))
    305320        return _B_FALSE;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette