Skip to content

Commit 1c77f80

Browse files
Askar Safintgross35
Askar Safin
authored andcommitted
Add IN6ADDR_ANY_INIT, IN6ADDR_LOOPBACK_INIT, in6addr_any, in6addr_loopback
(backport <#3693>) [ move constants to the align module to support old rustc - Trevor ] (cherry picked from commit 8db9bc7)
1 parent f9aa12d commit 1c77f80

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

libc-test/semver/unix.txt

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ IF_NAMESIZE
152152
IGNBRK
153153
IGNCR
154154
IGNPAR
155+
IN6ADDR_ANY_INIT
156+
IN6ADDR_LOOPBACK_INIT
155157
INADDR_ANY
156158
INADDR_BROADCAST
157159
INADDR_LOOPBACK
@@ -586,6 +588,8 @@ hstrerror
586588
if_indextoname
587589
if_nametoindex
588590
in6_addr
591+
in6addr_any
592+
in6addr_loopback
589593
in_addr
590594
in_addr_t
591595
in_port_t

src/unix/align.rs

+8
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ s! {
44
pub s6_addr: [u8; 16],
55
}
66
}
7+
8+
pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
9+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
10+
};
11+
12+
pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
13+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
14+
};

src/unix/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@ pub const ATF_PERM: ::c_int = 0x04;
313313
pub const ATF_PUBL: ::c_int = 0x08;
314314
pub const ATF_USETRAILERS: ::c_int = 0x10;
315315

316+
extern "C" {
317+
pub static in6addr_loopback: in6_addr;
318+
pub static in6addr_any: in6_addr;
319+
}
320+
316321
cfg_if! {
317322
if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
318323
// required libraries for L4Re and the ESP-IDF framework are linked externally, ATM

src/unix/no_align.rs

+10
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ s! {
44
__align: [u32; 0],
55
}
66
}
7+
8+
pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
9+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
10+
__align: [0u32; 0],
11+
};
12+
13+
pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
14+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
15+
__align: [0u32; 0],
16+
};

0 commit comments

Comments
 (0)