VirtualBox

Changeset 17989 in vbox


Ignore:
Timestamp:
Mar 16, 2009 11:24:48 PM (16 years ago)
Author:
vboxsync
Message:

Fixes for ip addresses and masks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r17981 r17989  
    414414    CheckComRCReturnRC (autoCaller.rc());
    415415
     416    if (Bstr(aIPAddress).isEmpty())
     417        if (m.IPAddress)
     418            return NetIfEnableStaticIpConfig(mVBox, this, m.IPAddress, 0, 0);
     419        else
     420            return S_OK;
     421
    416422    ULONG ip, mask;
    417423    ip = inet_addr(Utf8Str(aIPAddress).raw());
    418424    if(ip != INADDR_NONE)
    419425    {
    420         mask = inet_addr(Utf8Str(aNetMask).raw());
     426        if (Bstr(aNetMask).isEmpty())
     427            mask = 0xFFFFFF;
     428        else
     429            mask = inet_addr(Utf8Str(aNetMask).raw());
    421430        if(mask != INADDR_NONE)
    422431        {
    423             int rc = NetIfEnableStaticIpConfig(mVBox, this, m.IPAddress, ip, mask);
     432            int rc = S_OK;
     433            if (m.IPAddress != ip || m.networkMask != mask)
     434                rc = NetIfEnableStaticIpConfig(mVBox, this, m.IPAddress, ip, mask);
    424435            if (RT_SUCCESS(rc))
    425436            {
     
    451462    CheckComRCReturnRC (autoCaller.rc());
    452463
    453     int rc = NetIfEnableStaticIpConfigV6(mVBox, this, m.IPV6Address, aIPV6Address, aIPV6MaskPrefixLength);
     464    if (aIPV6MaskPrefixLength == 0)
     465        aIPV6MaskPrefixLength = 64;
     466    int rc = S_OK;
     467    if (m.IPV6Address != aIPV6Address || m.IPV6NetworkMaskPrefixLength != aIPV6MaskPrefixLength)
     468        rc = NetIfEnableStaticIpConfigV6(mVBox, this, m.IPV6Address, aIPV6Address, aIPV6MaskPrefixLength);
    454469    if (RT_FAILURE(rc))
    455470    {
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