troglobit/netcalc

IPv6 address types are missing ULA

Closed this issue · 7 comments

RFC 4193 specifies range of IPv6 for Unique Local Addressing unicast. Netcalc is not recognizing those, instead returning "Unassigned"

David

That's unfortunate. Care to submit a small patch or pull request? :)

I will try and find some time this evening.

David

Got a bit curious myself. Would this work? 😵

diff --git a/misc.c b/misc.c
index 085069d..06533e6 100644
--- a/misc.c
+++ b/misc.c
@@ -1040,6 +1040,8 @@ void v6_type(struct v6addr *in6_addr)
                snprintf(buf, len, "Reserved");
        if ((a & 0xff00) == 0xff00)
                snprintf(buf, len, "Multicast Addresses");
+       if ((a & 0xfc00) == 0xfc00 && in6_addr->nmaskbits == 7)
+               snprintf(buf, len, "Unique Local Unicast");
        if ((a & 0xff80) == 0xfe80)
                snprintf(buf, len, "Link-Local Unicast Addresses");
        if ((a & 0xffc0) == 0xfec0)

ULA's use /48 prefixes.

labeling any ((a & 0xfd00) == 0xfd00) should be enough, I think...

Ref: http://unique-local-ipv6.com

I think it would be useful to have separate message for fc00 and fd00. Most (if not all for now) ULA's will be fdxx (signifying a "locally-assigned ULA") as a value of 0 in the least significant bit is reserved for future use. I would use the terms..
fd00... Locally-Assigned Unique Local Address
fc00... Unique Local Address
Who knows, at some point in the future the difference might be meaningful.

David

Aha, I see. I was reading https://tools.ietf.org/html/rfc4193#section-8, so that's what confused me.

OK, I'll add two new types and reference this issue, if you can audit it later I'd be very grateful :)

GitHub auto-closes issues with 'Fix #...'. If you find a problem with 694614e, just reopen this issue.

I'll hold off the v2.1 release another day.