From 5a27eb793d7ee0aa1c94aac6d3b33557f509bf9b Mon Sep 17 00:00:00 2001 From: Slatian Date: Wed, 22 Feb 2023 23:05:38 +0100 Subject: [PATCH] Fixed bug where global adresses wre classified as having an unknown scope --- src/ipinfo.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ipinfo.rs b/src/ipinfo.rs index 07d8d35..5a2660f 100644 --- a/src/ipinfo.rs +++ b/src/ipinfo.rs @@ -61,6 +61,8 @@ impl AddressInfo { } else if addr.is_broadcast() { address_cast = AddressCast::Broadcast; address_scope = AddressScope::LinkLocal; + } else { + address_scope = AddressScope::Global; } }, IpAddr::V6(addr) => { @@ -88,6 +90,8 @@ impl AddressInfo { 0 | 3 | 0xf => address_scope = AddressScope::Reserved, _ => address_scope = AddressScope::Unknown, } + } else if segments[0] & 0xe000 == 0x2000 { + address_scope = AddressScope::Global; } }