1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 20:01:35 +01:00

Add Utils::route6_entries

This commit is contained in:
Matias Fontanini
2016-03-06 19:18:33 -08:00
parent c082dfad67
commit 4dcef0f15d
8 changed files with 161 additions and 17 deletions

View File

@@ -49,15 +49,7 @@ IPv6Range operator/(const IPv6Address& addr, int mask) {
if (mask > 128) {
throw std::logic_error("Prefix length cannot exceed 128");
}
IPv6Address last_addr;
IPv6Address::iterator it = last_addr.begin();
while (mask > 8) {
*it = 0xff;
++it;
mask -= 8;
}
*it = 0xff << (8 - mask);
return IPv6Range::from_mask(addr, last_addr);
return IPv6Range::from_mask(addr, IPv6Address::from_prefix_length(mask));
}
} // Tins