VirtualBox

Changeset 43144 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Sep 1, 2012 2:44:48 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80517
Message:

BUGZ:3965 Do check if physical network interface found more correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r43138 r43144  
    11321132    {
    11331133        CNetworkAdapter na = machine.GetNetworkAdapter(uAdapterIndex);
    1134         if (na.GetEnabled() &&
    1135             (na.GetAttachmentType() == KNetworkAttachmentType_Bridged ||
    1136              na.GetAttachmentType() == KNetworkAttachmentType_HostOnly))
    1137         {
    1138             QStringList ifNames;
    1139             ifNames << na.GetBridgedInterface()
    1140                     << na.GetHostOnlyInterface();
    1141 
    1142             foreach (const QString &strIfName, ifNames)
     1134
     1135        if (na.GetEnabled())
     1136        {
     1137            QString strIfName = QString();
     1138
     1139            /* Get physical network interface name for currently
     1140             * enabled network attachement type */
     1141            switch (na.GetAttachmentType())
    11431142            {
    1144                 if (!strIfName.isEmpty() &&
    1145                     !QNetworkInterface::interfaceFromName(strIfName).isValid())
    1146                 {
    1147                     LogFlow(("Found invalid network interface: %s\n", strIfName.toStdString().c_str()));
    1148                     failedInterfaceNames << QString("%1 (adapter %2)").arg(strIfName).arg(uAdapterIndex + 1);
     1143                case KNetworkAttachmentType_Bridged:
     1144                    strIfName = na.GetBridgedInterface();
    11491145                    break;
    1150                 }
     1146                case KNetworkAttachmentType_HostOnly:
     1147                    strIfName = na.GetHostOnlyInterface();
     1148                    break;
    11511149            }
    1152         }
    1153     }
    1154     /* Check failed? */
     1150
     1151            if (!strIfName.isEmpty() &&
     1152                !QNetworkInterface::interfaceFromName(strIfName).isValid())
     1153            {
     1154                LogFlow(("Found invalid network interface: %s\n", strIfName.toStdString().c_str()));
     1155                failedInterfaceNames << QString("%1 (adapter %2)").arg(strIfName).arg(uAdapterIndex + 1);
     1156            }
     1157        }
     1158    }
     1159
     1160    /* Check if non-existent interfaces found */
    11551161    if (!failedInterfaceNames.isEmpty())
    11561162    {
Note: See TracChangeset for help on using the changeset viewer.

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