VirtualBox

Ignore:
Timestamp:
Jul 12, 2019 11:00:54 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132112
Message:

Main: Redoing the IDHCPServer interface, part II. Implemented groups and fixed a couple of bugs. Made RTNetStrToMacAddr understand hexstrings w/o colon separators. bugref:9288

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/net/macstr.cpp

    r76553 r79747  
    5151{
    5252    /*
     53     * First check if it might be a 12 xdigit string without any separators.
     54     */
     55    size_t cchValue = strlen(pszValue);
     56    if (cchValue >= 12 && memchr(pszValue, ':', 12) == NULL)
     57    {
     58        bool fOkay = true;
     59        for (size_t off = 0; off < 12 && fOkay; off++)
     60            fOkay = RT_C_IS_XDIGIT(pszValue[off]);
     61        if (fOkay && cchValue > 12)
     62            for (size_t off = 12; off < cchValue && fOkay; off++)
     63                fOkay = RT_C_IS_SPACE(pszValue[off]);
     64        if (fOkay)
     65        {
     66            int rc = RTStrConvertHexBytes(pszValue, pAddr, sizeof(*pAddr), 0);
     67            if (RT_SUCCESS(rc))
     68                rc = VINF_SUCCESS;
     69            return rc;
     70        }
     71    }
     72
     73    /*
    5374     * Not quite sure if I should accept stuff like "08::27:::1" here...
    5475     * The code is accepting "::" patterns now, except for for the first
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