ocaml-ipaddr
ocaml-ipaddr copied to clipboard
classify routable and non-routable addresses
This distinguishes loopback and link-local in the IPv4 case. IPv6 needs investigation.
RFC 3927 states
The IPv4 prefix 169.254/16 is registered with the IANA for this
purpose. The first 256 and last 256 addresses in the 169.254/16
prefix are reserved for future use and MUST NOT be selected by a host
using this dynamic configuration mechanism.
For IPV6 this is relevant:
[2.5.6](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.6). Link-Local IPv6 Unicast Addresses
Link-Local addresses are for use on a single link. Link-Local
addresses have the following format:
| 10 |
| bits | 54 bits | 64 bits |
+----------+-------------------------+----------------------------+
|1111111010| 0 | interface ID |
+----------+-------------------------+----------------------------+
Link-Local addresses are designed to be used for addressing on a
single link for purposes such as automatic address configuration,
neighbor discovery, or when no routers are present.
Routers must not forward any packets with Link-Local source or
destination addresses to other links.
and I guess the IPv4 link-local addressed translated as well, unlikely as they might be:
[2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2). IPv4-Mapped IPv6 Address
A second type of IPv6 address that holds an embedded IPv4 address is
defined. This address type is used to represent the addresses of
IPv4 nodes as IPv6 addresses. The format of the "IPv4-mapped IPv6
address" is as follows:
| 80 bits | 16 | 32 bits |
+--------------------------------------+--------------------------+
|0000..............................0000|FFFF| IPv4 address |
+--------------------------------------+----+---------------------+
See [[RFC4038](https://datatracker.ietf.org/doc/html/rfc4038)] for background on the usage of the "IPv4-mapped IPv6
address".