Changeset 48417 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 10, 2013 3:58:39 PM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/NATNetworkImpl.h
r48107 r48417 40 40 # define NATSR_EXECUTABLE_NAME "VBoxNetNAT" 41 41 #endif 42 43 enum ADDRESSLOOKUPTYPE 44 { 45 ADDR_GATEWAY, 46 ADDR_DHCP, 47 ADDR_DHCPLOWERIP, 48 ADDR_ANY 49 }; 42 50 43 51 class NATNetworkServiceRunner: public NetworkServiceRunner … … 128 136 private: 129 137 int recalculateIpv4AddressAssignments(); 130 int findFirstAvailableOffset( uint32_t *);138 int findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *); 131 139 132 140 typedef std::map<Utf8Str, settings::NATRule> NATRuleMap; -
trunk/src/VBox/Main/src-server/NATNetworkImpl.cpp
r48415 r48417 904 904 905 905 906 int NATNetwork::findFirstAvailableOffset( uint32_t *poff)906 int NATNetwork::findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff) 907 907 { 908 908 RTNETADDRIPV4 network, netmask; … … 918 918 { 919 919 920 if (off == m->offGateway)921 continue;922 923 if (off == m->offDhcp)924 continue;925 926 920 bool skip = false; 927 921 for (it = m->llNATLoopbackOffsetList.begin(); … … 937 931 } 938 932 933 if (skip) 934 continue; 935 936 if (off == m->offGateway) 937 { 938 if (addrType == ADDR_GATEWAY) 939 break; 940 else 941 continue; 942 } 943 944 if (off == m->offDhcp) 945 { 946 if (addrType == ADDR_DHCP) 947 break; 948 else 949 continue; 950 } 951 939 952 if (!skip) 940 953 break; … … 955 968 AssertRCReturn(rc, rc); 956 969 957 findFirstAvailableOffset( &m->offGateway);970 findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway); 958 971 if (m->fNeedDhcpServer) 959 findFirstAvailableOffset( &m->offDhcp);972 findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp); 960 973 961 974 /* I don't remember the reason CIDR calculated on the host. */ … … 975 988 RTNETADDRIPV4 dhcplowerip = network; 976 989 uint32_t offDhcpLowerIp; 977 findFirstAvailableOffset( &offDhcpLowerIp);990 findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp); 978 991 dhcplowerip.u = RT_H2N_U32(dhcplowerip.u + offDhcpLowerIp); 979 992
Note:
See TracChangeset
for help on using the changeset viewer.