mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 05:24:26 +01:00
add IPv6 check for Link-Local unicast address
This commit is contained in:
@@ -57,6 +57,7 @@ namespace Tins {
|
||||
|
||||
const IPv6Address loopback_address = "::1";
|
||||
const AddressRange<IPv6Address> multicast_range = IPv6Address("ff00::") / 8;
|
||||
const AddressRange<IPv6Address> local_unicast_range = IPv6Address("fe80::") / 10;
|
||||
|
||||
IPv6Address IPv6Address::from_prefix_length(uint32_t prefix_length) {
|
||||
IPv6Address address;
|
||||
@@ -138,6 +139,10 @@ bool IPv6Address::is_multicast() const {
|
||||
return multicast_range.contains(*this);
|
||||
}
|
||||
|
||||
bool IPv6Address::is_local_unicast() const {
|
||||
return local_unicast_range.contains(*this);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& os, const IPv6Address& addr) {
|
||||
return os << addr.to_string();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user