summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/icmp6-test-util.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libsystemd-network/icmp6-test-util.c (renamed from src/libsystemd-network/icmp6-util-unix.c)21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/libsystemd-network/icmp6-util-unix.c b/src/libsystemd-network/icmp6-test-util.c
index 01edb85..3c78109 100644
--- a/src/libsystemd-network/icmp6-util-unix.c
+++ b/src/libsystemd-network/icmp6-test-util.c
@@ -1,12 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/icmp6.h>
#include <netinet/ip6.h>
#include <unistd.h>
#include "fd-util.h"
-#include "icmp6-util-unix.h"
+#include "icmp6-test-util.h"
-send_ra_t send_ra_function = NULL;
int test_fd[2] = EBADF_PAIR;
static struct in6_addr dummy_link_local = {
@@ -16,22 +16,15 @@ static struct in6_addr dummy_link_local = {
},
};
-int icmp6_bind_router_solicitation(int ifindex) {
- if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0)
+int icmp6_bind(int ifindex, bool is_router) {
+ if (!is_router && socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0)
return -errno;
- return test_fd[0];
+ return test_fd[is_router];
}
-int icmp6_bind_router_advertisement(int ifindex) {
- return test_fd[1];
-}
-
-int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
- if (!send_ra_function)
- return 0;
-
- return send_ra_function(0);
+int icmp6_send(int fd, const struct in6_addr *dst, const struct iovec *iov, size_t n_iov) {
+ return writev(fd, iov, n_iov);
}
int icmp6_receive(