@@ -486,8 +486,7 @@ impl Ipv4Addr {
486486 /// - addresses used for documentation (see [`Ipv4Addr::is_documentation()`])
487487 /// - the unspecified address (see [`Ipv4Addr::is_unspecified()`]), and the whole
488488 /// `0.0.0.0/8` block
489- /// - addresses reserved for future protocols (see
490- /// [`Ipv4Addr::is_ietf_protocol_assignment()`], except
489+ /// - addresses reserved for future protocols, except
491490 /// `192.0.0.9/32` and `192.0.0.10/32` which are globally routable
492491 /// - addresses reserved for future use (see [`Ipv4Addr::is_reserved()`]
493492 /// - addresses reserved for networking devices benchmarking (see
@@ -560,7 +559,8 @@ impl Ipv4Addr {
560559 && !self . is_broadcast ( )
561560 && !self . is_documentation ( )
562561 && !self . is_shared ( )
563- && !self . is_ietf_protocol_assignment ( )
562+ // addresses reserved for future protocols (`192.0.0.0/24`)
563+ && !( self . octets ( ) [ 0 ] == 192 && self . octets ( ) [ 1 ] == 0 && self . octets ( ) [ 2 ] == 0 )
564564 && !self . is_reserved ( )
565565 && !self . is_benchmarking ( )
566566 // Make sure the address is not in 0.0.0.0/8
@@ -589,40 +589,6 @@ impl Ipv4Addr {
589589 self . octets ( ) [ 0 ] == 100 && ( self . octets ( ) [ 1 ] & 0b1100_0000 == 0b0100_0000 )
590590 }
591591
592- /// Returns [`true`] if this address is part of `192.0.0.0/24`, which is reserved to
593- /// IANA for IETF protocol assignments, as documented in [IETF RFC 6890].
594- ///
595- /// Note that parts of this block are in use:
596- ///
597- /// - `192.0.0.8/32` is the "IPv4 dummy address" (see [IETF RFC 7600])
598- /// - `192.0.0.9/32` is the "Port Control Protocol Anycast" (see [IETF RFC 7723])
599- /// - `192.0.0.10/32` is used for NAT traversal (see [IETF RFC 8155])
600- ///
601- /// [IETF RFC 6890]: https://tools.ietf.org/html/rfc6890
602- /// [IETF RFC 7600]: https://tools.ietf.org/html/rfc7600
603- /// [IETF RFC 7723]: https://tools.ietf.org/html/rfc7723
604- /// [IETF RFC 8155]: https://tools.ietf.org/html/rfc8155
605- ///
606- /// # Examples
607- ///
608- /// ```
609- /// #![feature(ip)]
610- /// use std::net::Ipv4Addr;
611- ///
612- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 0).is_ietf_protocol_assignment(), true);
613- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 8).is_ietf_protocol_assignment(), true);
614- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 9).is_ietf_protocol_assignment(), true);
615- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 255).is_ietf_protocol_assignment(), true);
616- /// assert_eq!(Ipv4Addr::new(192, 0, 1, 0).is_ietf_protocol_assignment(), false);
617- /// assert_eq!(Ipv4Addr::new(191, 255, 255, 255).is_ietf_protocol_assignment(), false);
618- /// ```
619- #[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
620- #[ unstable( feature = "ip" , issue = "27709" ) ]
621- #[ inline]
622- pub const fn is_ietf_protocol_assignment ( & self ) -> bool {
623- self . octets ( ) [ 0 ] == 192 && self . octets ( ) [ 1 ] == 0 && self . octets ( ) [ 2 ] == 0
624- }
625-
626592 /// Returns [`true`] if this address part of the `198.18.0.0/15` range, which is reserved for
627593 /// network devices benchmarking. This range is defined in [IETF RFC 2544] as `192.18.0.0`
628594 /// through `198.19.255.255` but [errata 423] corrects it to `198.18.0.0/15`.
0 commit comments