From 8db9bc7059af69dcde2f6c99892df11a06bfc0e8 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Sat, 11 May 2024 01:51:07 +0300 Subject: [PATCH] Add IN6ADDR_ANY_INIT, IN6ADDR_LOOPBACK_INIT, in6addr_any, in6addr_loopback --- libc-test/semver/unix.txt | 4 ++++ src/unix/mod.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 5e84434b46bf4..3dae14ea16d41 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -152,6 +152,8 @@ IF_NAMESIZE IGNBRK IGNCR IGNPAR +IN6ADDR_ANY_INIT +IN6ADDR_LOOPBACK_INIT INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK @@ -586,6 +588,8 @@ hstrerror if_indextoname if_nametoindex in6_addr +in6addr_any +in6addr_loopback in_addr in_addr_t in_port_t diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 51984bc2c42c2..253442335a2e1 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -305,6 +305,13 @@ pub const INADDR_ANY: in_addr_t = 0; pub const INADDR_BROADCAST: in_addr_t = 4294967295; pub const INADDR_NONE: in_addr_t = 4294967295; +pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], +}; +pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], +}; + pub const ARPOP_REQUEST: u16 = 1; pub const ARPOP_REPLY: u16 = 2; @@ -313,6 +320,11 @@ pub const ATF_PERM: ::c_int = 0x04; pub const ATF_PUBL: ::c_int = 0x08; pub const ATF_USETRAILERS: ::c_int = 0x10; +extern "C" { + pub static in6addr_loopback: in6_addr; + pub static in6addr_any: in6_addr; +} + cfg_if! { if #[cfg(any(target_os = "l4re", target_os = "espidf"))] { // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM