File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,15 @@ namespace dhcp {
1717
1818AddressRange::AddressRange (const IOAddress& start, const IOAddress& end)
1919 : start_(start), end_(end) {
20- // The start must be lower or equal the end.
21- if (end_ < start_) {
22- isc_throw (BadValue, " invalid address range boundaries " << start_ << " :" << end_);
23- }
2420 // Two IPv4 or two IPv6 addresses are expected as range boundaries.
2521 if (start_.getFamily () != end_.getFamily ()) {
2622 isc_throw (BadValue, " address range boundaries must have the same type: " << start_
2723 << " :" << end_);
2824 }
25+ // The start must be lower or equal the end.
26+ if (end_ < start_) {
27+ isc_throw (BadValue, " invalid address range boundaries " << start_ << " :" << end_);
28+ }
2929}
3030
3131PrefixRange::PrefixRange (const asiolink::IOAddress& prefix, const uint8_t length, const uint8_t delegated)
@@ -44,6 +44,7 @@ PrefixRange::PrefixRange(const asiolink::IOAddress& prefix, const uint8_t length
4444 << " and prefix length " << static_cast <int >(length)
4545 << " must not be greater than 128" );
4646 }
47+ // Now calculate the last prefix in the range.
4748 auto prefixes_num = prefixesInRange (prefix_length_, delegated_length_);
4849 uint64_t addrs_in_prefix = static_cast <uint64_t >(1 ) << (128 - delegated_length_);
4950 end_ = offsetAddress (prefix, (prefixes_num - 1 ) * addrs_in_prefix);
You can’t perform that action at this time.
0 commit comments