finished ipv6 reservations
This commit is contained in:
parent
30355294c0
commit
64b669edc3
@ -42,7 +42,7 @@ A tool to assist in design of segregate/segment/split/subnet networks.
|
|||||||
** Note that for IPv6, some subnetting calculators erroneously report the last address for /64's (e.g. `x:ffff:ffff:ffff:ffff/64`) as usable. They are actually reserved in strictly RFC-compliant networks for EUI-64 reasons (per {rfc}2526[RFC 2526^]). For this reason, *if and only if* a prefix is a /64 *exactly*, `subnetter` will use `x:ffff:ffff:ffff:fffe` as the last host address.
|
** Note that for IPv6, some subnetting calculators erroneously report the last address for /64's (e.g. `x:ffff:ffff:ffff:ffff/64`) as usable. They are actually reserved in strictly RFC-compliant networks for EUI-64 reasons (per {rfc}2526[RFC 2526^]). For this reason, *if and only if* a prefix is a /64 *exactly*, `subnetter` will use `x:ffff:ffff:ffff:fffe` as the last host address.
|
||||||
** There are additional restrictions for /64 subnets, but they fall earlier in the range. These are *not explicitly excluded* in the usable host range, nor are they excluded from the total host count.
|
** There are additional restrictions for /64 subnets, but they fall earlier in the range. These are *not explicitly excluded* in the usable host range, nor are they excluded from the total host count.
|
||||||
* Private networks ({rfc}1918[RFC 1918^]), ULA prefixes ({rfc}4193[RFC 4193^]), and documentation prefixes ({rfc}3849[RFC 3849^], {rfc}5737[RFC 5737^], {rfc}9637[RFC 9637^]) are treated as "normal" networks (in that it is allowed to subnet them).
|
* Private networks ({rfc}1918[RFC 1918^]), ULA prefixes ({rfc}4193[RFC 4193^]), and documentation prefixes ({rfc}3849[RFC 3849^], {rfc}5737[RFC 5737^], {rfc}9637[RFC 9637^]) are treated as "normal" networks (in that it is allowed to subnet them).
|
||||||
* Various other reserved IPv4 and IPv6 addresses/networks will print warnings with their corresponding RFC(s) (unless `-R`/`--allow-reserved` is specified) if they are specified as/included in the initial prefix/network.
|
* Various other reserved IPv4 and IPv6 addresses/networks will print warnings with their corresponding RFC(s) (unless `-R`/`--allow-reserved` is specified) if they are specified as/included in the initial prefix/network. ({rfc}6890[RFC 6890^] and its update via {rfc}8190[RFC 8190^] are useful summaries.)
|
||||||
|
|
||||||
[id="ref"]
|
[id="ref"]
|
||||||
== References
|
== References
|
||||||
|
@ -137,7 +137,7 @@ var (
|
|||||||
0: "Entire IPv4 Internet address prefix; commonly used to indicate default route",
|
0: "Entire IPv4 Internet address prefix; commonly used to indicate default route",
|
||||||
},
|
},
|
||||||
6: map[uint8]string{
|
6: map[uint8]string{
|
||||||
128: "Host route/single host, single endpoints, and loopback (::1 explicitly)",
|
128: "Host route/single host, single endpoints, and loopback (::1/128 explicitly)",
|
||||||
127: "Point-to-Point link (inter-router)",
|
127: "Point-to-Point link (inter-router)",
|
||||||
64: "Single LAN; default prefix size for SLAAC",
|
64: "Single LAN; default prefix size for SLAAC",
|
||||||
60: "Some (very limited) 6rd networks",
|
60: "Some (very limited) 6rd networks",
|
||||||
|
@ -5,8 +5,37 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ReservedNets map[netip.Prefix]string
|
ReservedNets map[netip.Prefix]string
|
||||||
|
// Up to date as of Feb 2, 2025
|
||||||
reservedNetsOrig map[string]string = map[string]string{
|
reservedNetsOrig map[string]string = map[string]string{
|
||||||
|
// IPv6
|
||||||
|
// https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
|
||||||
|
"::/128": "Unspecified Address (RFC 4291 § 2.5.2)",
|
||||||
|
"::1/128": "Loopback Address (RFC 4291 § 2.5.3)",
|
||||||
|
"ff00::/8": "Multicast (RFC 4291 § 2.7)",
|
||||||
|
"::ffff:0:0/96": "IPv4-mapped Address (RFC 4291 § 2.5.5)",
|
||||||
|
"64:ff9b::/96": "IPv4-IPv6 Translation (RFC 6052)",
|
||||||
|
"64:ff9b:1::/48": "IPv4-IPv6 Translation (RFC 8215)",
|
||||||
|
"100::/64": "Discard-Only Address Block (RFC 6666)",
|
||||||
|
"2001::/23": "IETF Protocol Assignments (RFC 2928, IANA IPv6 Special Registry)",
|
||||||
|
"2001::/32": "TEREDO (RFC 4380)",
|
||||||
|
"2001:1::1/128": "Port Control Protocol Anycast (RFC 7723)",
|
||||||
|
"2001:1::2/128": "Traversal Using Relays around NAT Anycast (RFC 8155)",
|
||||||
|
"2001:1::3/128": "DNS-SD Service Registration Protocol Anycast (draft-ietf-dnssd-srp-25)",
|
||||||
|
"2001:2::/48": "Benchmarking (RFC 5180, Errata 1752)",
|
||||||
|
"2001:3::/32": "AMT (RFC 7450)",
|
||||||
|
"2001:4:112::/48": "AS112-v6 (RFC 7535)",
|
||||||
|
"2001:20::/28": "ORCHIDv2 (RFC 7343)",
|
||||||
|
"2001:30::/28": "Drone Remote ID Protocol Entity Tags (DETs) Prefix (RFC 9374)",
|
||||||
|
"2001:db8::/32": "Documentation (RFC 3849)",
|
||||||
|
"2002::/16": "6to4 (RFC 3056)",
|
||||||
|
"2620:4f:8000::/48": "Direct Delegation AS112 Service (RFC 7534)",
|
||||||
|
"3fff::/20": "Documentation (RFC 9637)",
|
||||||
|
"5f00::/16": "Segment Routing (SRv6) SIDs (RFC 9602)",
|
||||||
|
"fc00::/7": "Unique-Local Addressing (RFC 4193)", // private/LAN
|
||||||
|
"fe80::/10": "Link-Local Unicast (RFC 4291 § 2.5.6)",
|
||||||
|
// IPv4
|
||||||
|
// https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml#iana-ipv4-special-registry-1
|
||||||
"": "",
|
"": "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -149,6 +149,24 @@ func AddrInvert(ip netip.Addr) (inverted netip.Addr) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CheckReserved checks nets for any reserved prefixes, either directly or included within the prefix depending on recurse.
|
||||||
|
excludePrivate indicates if LAN networks should be considered as "reserved" or not.
|
||||||
|
|
||||||
|
Any found will be returned in reservations.
|
||||||
|
|
||||||
|
If no reserved networks are found, reservations will be nil.
|
||||||
|
|
||||||
|
Note that prefix-specific broadcasts (e.g. x.255.255.255/8, x.x.x.255/24, ::/64, x:ffff:ffff:ffff:ffff/64, etc.)
|
||||||
|
will *not* be considered as "reserved" as they are considered normal addresses expected for functionality.
|
||||||
|
*/
|
||||||
|
func CheckReserved(nets []*netip.Prefix, recurse, excludePrivate bool) (reservations map[netip.Prefix]string, err error) {
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Contain takes the results of a NetSplitter and returns a StructuredResults.
|
// Contain takes the results of a NetSplitter and returns a StructuredResults.
|
||||||
func Contain(origPfx *netip.Prefix, nets []*netip.Prefix, remaining *netipx.IPSet, splitter NetSplitter) (s *StructuredResults, err error) {
|
func Contain(origPfx *netip.Prefix, nets []*netip.Prefix, remaining *netipx.IPSet, splitter NetSplitter) (s *StructuredResults, err error) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user