about summary refs log tree commit diff
path: root/library/std/src/sys/unix/ext/net.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-12 16:30:46 +0000
committerbors <bors@rust-lang.org>2020-08-12 16:30:46 +0000
commit3df25ae186e89c885d9a71cd37fbd7a37e39fc85 (patch)
tree9b52046f5e87a28f9c4da32fc80810cfe041eff0 /library/std/src/sys/unix/ext/net.rs
parentded20c98be8585b2a9fe4eeadd1be5524f6ffb17 (diff)
parentd892a07c67dfa4f347b62ecf96de184c41dae5dd (diff)
downloadrust-3df25ae186e89c885d9a71cd37fbd7a37e39fc85.tar.gz
rust-3df25ae186e89c885d9a71cd37fbd7a37e39fc85.zip
Auto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt
Add Ipv6Addr::to_ipv4_mapped

* add Ipv6Addr::to_ipv4_mapped
* ~~deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4~~ reference: #75150

According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10), the "IPv4-Compatible IPv6 address" is deprecated.

> 2.5.5.1.  IPv4-Compatible IPv6 Address
>
>    The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6
>    transition.  The format of the "IPv4-Compatible IPv6 address" is as
>    follows:
>
>    |                80 bits               | 16 |      32 bits        |
>    +--------------------------------------+--------------------------+
>    |0000..............................0000|0000|    IPv4 address     |
>    +--------------------------------------+----+---------------------+
>
>    Note: The IPv4 address used in the "IPv4-Compatible IPv6 address"
>    must be a globally-unique IPv4 unicast address.
>
>    The "IPv4-Compatible IPv6 address" is now deprecated because the
>    current IPv6 transition mechanisms no longer use these addresses.
>    New or updated implementations are not required to support this
>    address type.

And the current implementation of `Ipv4Addr::to_ipv6_compatible`is incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.

Please let me know if there are any issues with this pull request.
Diffstat (limited to 'library/std/src/sys/unix/ext/net.rs')
0 files changed, 0 insertions, 0 deletions