Changeset 67431 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 15, 2017 9:41:18 PM (8 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/netif.h
r65428 r67431 117 117 } 118 118 119 DECLINLINE(ULONG) composeIPv6PrefixLenghFromAddress(PRTNETADDRIPV6 aAddrPtr)120 {121 int res = ASMBitFirstClear(aAddrPtr, sizeof(RTNETADDRIPV6)*8);122 return res != -1 ? res : 128;123 }124 125 DECLINLINE(int) prefixLength2IPv6Address(ULONG cPrefix, PRTNETADDRIPV6 aAddrPtr)126 {127 if (cPrefix > 128)128 return VERR_INVALID_PARAMETER;129 if (!aAddrPtr)130 return VERR_INVALID_PARAMETER;131 132 RT_ZERO(*aAddrPtr);133 134 ASMBitSetRange(aAddrPtr, 0, cPrefix);135 136 return VINF_SUCCESS;137 }138 139 119 DECLINLINE(Bstr) composeHardwareAddress(PRTMAC aMacPtr) 140 120 { -
trunk/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
r65120 r67431 163 163 if (RT_SUCCESS(rc)) 164 164 { 165 int iPrefixIPv6; 166 165 167 m.realIPAddress = m.IPAddress = info.IPAddress.u; 166 168 m.realNetworkMask = m.networkMask = info.IPNetMask.u; 167 169 m.dhcpEnabled = info.bDhcpEnabled; 168 170 m.realIPV6Address = m.IPV6Address = composeIPv6Address(&info.IPv6Address); 169 m.realIPV6PrefixLength = m.IPV6NetworkMaskPrefixLength = composeIPv6PrefixLenghFromAddress(&info.IPv6NetMask); 171 RTNetMaskToPrefixIPv6(&info.IPv6NetMask, &iPrefixIPv6); 172 m.realIPV6PrefixLength = m.IPV6NetworkMaskPrefixLength = iPrefixIPv6; 170 173 m.hardwareAddress = composeHardwareAddress(&info.MACAddress); 171 174 #ifdef RT_OS_WINDOWS … … 220 223 mIfType = ifType; 221 224 225 int iPrefixIPv6; 226 222 227 m.realIPAddress = m.IPAddress = pIf->IPAddress.u; 223 228 m.realNetworkMask = m.networkMask = pIf->IPNetMask.u; 224 229 m.realIPV6Address = m.IPV6Address = composeIPv6Address(&pIf->IPv6Address); 225 m.realIPV6PrefixLength = m.IPV6NetworkMaskPrefixLength = composeIPv6PrefixLenghFromAddress(&pIf->IPv6NetMask); 230 RTNetMaskToPrefixIPv6(&pIf->IPv6NetMask, &iPrefixIPv6); 231 m.realIPV6PrefixLength = m.IPV6NetworkMaskPrefixLength = iPrefixIPv6; 226 232 m.dhcpEnabled = pIf->bDhcpEnabled; 227 233 m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress); -
trunk/src/VBox/Main/src-server/win/NetIf-win.cpp
r67390 r67431 25 25 #define NETIF_WITHOUT_NETCFG 26 26 27 #include <iprt/asm.h>28 27 #include <iprt/err.h> 29 28 #include <list> … … 181 180 { 182 181 fIPv6Found = true; 183 ASMBitSetRange(&pInfo->IPv6NetMask, 0, pPrefix->PrefixLength);182 RTNetPrefixToMaskIPv6(pPrefix->PrefixLength, &pInfo->IPv6NetMask); 184 183 } 185 184 else … … 1715 1714 { 1716 1715 uPrefixLenV6 = pPrefix->PrefixLength; 1717 ASMBitSetRange(&pInfo->IPv6NetMask, 0, pPrefix->PrefixLength);1716 RTNetPrefixToMaskIPv6(pPrefix->PrefixLength, &pInfo->IPv6NetMask); 1718 1717 } 1719 1718 else … … 1775 1774 netIfLog(("netIfFillInfoWithAddresses: Invalid IPv6 prefix length of %d\n", pAddrLh->OnLinkPrefixLength)); 1776 1775 else 1777 ASMBitSetRange(&pInfo->IPv6NetMask, 0, pAddrLh->OnLinkPrefixLength);1776 RTNetPrefixToMaskIPv6(pAddrLh->OnLinkPrefixLength, &pInfo->IPv6NetMask); 1778 1777 } 1779 1778 break; 1780 1779 } 1781 1780 } 1782 netIfLog(("netIfFillInfoWithAddresses: %RTnaipv4/%u\n", 1783 pInfo->IPAddress, ASMBitFirstClear(&pInfo->IPNetMask, sizeof(RTNETADDRIPV4)*8))); 1784 netIfLog(("netIfFillInfoWithAddresses: %RTnaipv6/%u\n", 1785 &pInfo->IPv6Address, composeIPv6PrefixLenghFromAddress(&pInfo->IPv6NetMask))); 1781 1782 if (fIPFound) 1783 { 1784 int iPrefixIPv4 = -1; 1785 RTNetMaskToPrefixIPv4(&pInfo->IPNetMask, &iPrefixIPv4); 1786 netIfLog(("netIfFillInfoWithAddresses: %RTnaipv4/%u\n", pInfo->IPAddress, iPrefixIPv4)); 1787 } 1788 if (fIPv6Found) 1789 { 1790 int iPrefixIPv6 = -1; 1791 RTNetMaskToPrefixIPv6(&pInfo->IPv6NetMask, &iPrefixIPv6); 1792 netIfLog(("netIfFillInfoWithAddresses: %RTnaipv6/%u\n", &pInfo->IPv6Address, iPrefixIPv6)); 1793 } 1786 1794 } 1787 1795
Note:
See TracChangeset
for help on using the changeset viewer.