VirtualBox

Changeset 42256 in vbox


Ignore:
Timestamp:
Jul 20, 2012 12:08:44 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings / Network page: Early notify about MAC address field errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r42254 r42256  
    217217    }
    218218
    219     /* Validate MAC-address: */
     219    /* Validate MAC-address length: */
    220220    if (m_pMACEditor->text().size() < 12)
    221221    {
     
    223223        fValid = false;
    224224    }
    225     else
    226     {
    227         QRegExp validator("[0-9A-Fa-f][02468ACEace][0-9A-Fa-f]{10}");
    228         if (!validator.exactMatch(m_pMACEditor->text()))
    229         {
    230             strWarning = tr("the second digit cannot be odd, as only unicast MAC addresses allowed.");
     225    /* Make sure MAC-address is unicast: */
     226    if (m_pMACEditor->text().size() >= 2)
     227    {
     228        QRegExp validator("^[0-9A-Fa-f][02468ACEace]");
     229        if (validator.indexIn(m_pMACEditor->text()) != 0)
     230        {
     231            strWarning = tr("the second digit in the MAC Address field cannot be odd, "
     232                            "as only unicast addresses are allowed.");
    231233            fValid = false;
    232234        }
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