1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include <netinet/ip6.h>
7 #include "icmp6-util-unix.h"
9 send_ra_t send_ra_function
= NULL
;
10 int test_fd
[2] = EBADF_PAIR
;
12 static struct in6_addr dummy_link_local
= {
14 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15 0x12, 0x34, 0x56, 0xff, 0xfe, 0x78, 0x9a, 0xbc,
19 int icmp6_bind(int ifindex
, bool is_router
) {
20 if (!is_router
&& socketpair(AF_UNIX
, SOCK_DGRAM
| SOCK_CLOEXEC
| SOCK_NONBLOCK
, 0, test_fd
) < 0)
23 return test_fd
[is_router
];
26 int icmp6_send_router_solicitation(int s
, const struct ether_addr
*ether_addr
) {
27 if (!send_ra_function
)
30 return send_ra_function(0);
37 struct in6_addr
*ret_sender
,
38 triple_timestamp
*ret_timestamp
) {
40 assert_se(read (fd
, iov_base
, iov_len
) == (ssize_t
) iov_len
);
43 triple_timestamp_now(ret_timestamp
);
46 *ret_sender
= dummy_link_local
;