diff --git a/Cargo.toml b/Cargo.toml index 0beb3d5308..11ebb98a14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,6 +135,7 @@ math_libm = [] no_trace = ["log/release_max_level_debug"] # for very verbose activity beyond trace level trace_tls = [] +ip6 = [] [profile.dev] panic = "abort" diff --git a/cbindgen.globdefs.toml b/cbindgen.globdefs.toml index 7e7e19e231..3f8cd4dc70 100644 --- a/cbindgen.globdefs.toml +++ b/cbindgen.globdefs.toml @@ -14,6 +14,7 @@ # XXX: silences a warning "feature = no_std" = "__relibc__" +"feature = ip6" = "__ip6__" # Ensure attributes are passed down from Rust # must be included where attributes are used in relibc diff --git a/src/header/arpa_inet/mod.rs b/src/header/arpa_inet/mod.rs index c0c5cdf491..10c13dae35 100644 --- a/src/header/arpa_inet/mod.rs +++ b/src/header/arpa_inet/mod.rs @@ -222,7 +222,7 @@ pub unsafe extern "C" fn inet_pton(af: c_int, src: *const c_char, dst: *mut c_vo for part in s_addr.iter_mut().take(4) { if let Some(n) = octets .next() - .filter(|x| !x.len() > 3) + .filter(|x| x.len() <= 3) .and_then(|x| u8::from_str(x).ok()) { *part = n; diff --git a/src/header/sys_socket/constants.rs b/src/header/sys_socket/constants.rs index f043163a74..faeca8331a 100644 --- a/src/header/sys_socket/constants.rs +++ b/src/header/sys_socket/constants.rs @@ -168,6 +168,7 @@ pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 47; /// Internet domain sockets for use with IPv4 sockets. pub const AF_INET: c_int = 2; /// Internet domain sockets for use with IPv6 sockets. +#[cfg(feature = "ip6")] pub const AF_INET6: c_int = 10; /// Non-POSIX, see . ///