- Timestamp:
- Jan 28, 2022 3:04:07 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
r93472 r93479 333 333 void AddressIPv4::deriveBroadcast(PCRTNETADDRIPV4 pcAddress, int iPrefix) 334 334 { 335 /* Note: the address is big-endian. */336 335 RTNETADDRIPV4 mask, broadcast; 337 336 int rc = RTNetPrefixToMaskIPv4(iPrefix, &mask); … … 773 772 virtual const char *defaultNetwork() { return "192.168.56.1/21"; }; /* Matches defaults in VBox/Main/include/netif.h, see @bugref{10077}. */ 774 773 774 protected: 775 bool isValidUnicastAddress(PCRTNETADDRIPV4 address); 776 775 777 private: 776 778 RTNETADDRIPV4 m_address; … … 794 796 rc = RTNetStrToIPv4Cidr(pcszIpAddress, &m_address, &m_prefix); 795 797 #endif 796 m_fValid = RT_SUCCESS(rc); 798 m_fValid = RT_SUCCESS(rc) && isValidUnicastAddress(&m_address); 799 } 800 801 bool NetworkAddressIPv4::isValidUnicastAddress(PCRTNETADDRIPV4 address) 802 { 803 /* Multicast addresses are not allowed. */ 804 if ((address->au8[0] & 0xF0) == 0xE0) 805 return false; 806 807 /* Broadcast address is not allowed. */ 808 if (address->au32[0] == 0xFFFFFFFF) /* Endianess does not matter in this particual case. */ 809 return false; 810 811 /* Loopback addresses are not allowed. */ 812 if ((address->au8[0] & 0xFF) == 0x7F) 813 return false; 814 815 return true; 797 816 } 798 817
Note:
See TracChangeset
for help on using the changeset viewer.