#endif
#include "fd-util.h"
-#include "socket-bind.h"
+#include "bpf-socket-bind.h"
#if BPF_FRAMEWORK
/* libbpf, clang, llvm and bpftool compile time dependencies are satisfied */
return 0;
}
-int socket_bind_supported(void) {
+int bpf_socket_bind_supported(void) {
_cleanup_(socket_bind_bpf_freep) struct socket_bind_bpf *obj = NULL;
int r;
return can_link_bpf_program(obj->progs.sd_bind4);
}
-int socket_bind_add_initial_link_fd(Unit *u, int fd) {
+int bpf_socket_bind_add_initial_link_fd(Unit *u, int fd) {
int r;
assert(u);
return 0;
}
-int socket_bind_install(Unit *u) {
+int bpf_socket_bind_install(Unit *u) {
int r;
assert(u);
return r;
}
-int serialize_socket_bind(Unit *u, FILE *f, FDSet *fds) {
+int bpf_serialize_socket_bind(Unit *u, FILE *f, FDSet *fds) {
int r;
assert(u);
}
#else /* ! BPF_FRAMEWORK */
-int socket_bind_supported(void) {
+int bpf_socket_bind_supported(void) {
return false;
}
-int socket_bind_add_initial_link_fd(Unit *u, int fd) {
+int bpf_socket_bind_add_initial_link_fd(Unit *u, int fd) {
return 0;
}
-int socket_bind_install(Unit *u) {
+int bpf_socket_bind_install(Unit *u) {
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP), "Failed to install socket bind: BPF framework is not supported");
}
-int serialize_socket_bind(Unit *u, FILE *f, FDSet *fds) {
+int bpf_serialize_socket_bind(Unit *u, FILE *f, FDSet *fds) {
return 0;
}
#endif
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include "fdset.h"
+#include "unit.h"
+
+int bpf_socket_bind_supported(void);
+
+/* Add BPF link fd created before daemon-reload or daemon-reexec. FDs will be closed at the end of
+ * socket_bind_install. */
+int bpf_socket_bind_add_initial_link_fd(Unit *u, int fd);
+
+int bpf_socket_bind_install(Unit *u);
+
+int bpf_serialize_socket_bind(Unit *u, FILE *f, FDSet *fds);
#include "bpf-devices.h"
#include "bpf-firewall.h"
#include "bpf-foreign.h"
+#include "bpf-socket-bind.h"
#include "btrfs-util.h"
#include "bus-error.h"
#include "cgroup-setup.h"
#include "percent-util.h"
#include "process-util.h"
#include "procfs-util.h"
-#include "socket-bind.h"
#include "special.h"
#include "stat-util.h"
#include "stdio-util.h"
static void cgroup_apply_socket_bind(Unit *u) {
assert(u);
- (void) socket_bind_install(u);
+ (void) bpf_socket_bind_install(u);
}
static int cgroup_apply_devices(Unit *u) {
mask |= CGROUP_MASK_BPF_FOREIGN;
/* BPF-based bind{4|6} hooks */
- r = socket_bind_supported();
+ r = bpf_socket_bind_supported();
if (r > 0)
mask |= CGROUP_MASK_BPF_SOCKET_BIND;
#include "alloc-util.h"
#include "bpf-firewall.h"
#include "bpf-program.h"
+#include "bpf-socket-bind.h"
#include "bus-error.h"
#include "bus-internal.h"
#include "bus-util.h"
#endif
#include "securebits-util.h"
#include "signal-util.h"
-#include "socket-bind.h"
#include "socket-netlink.h"
#include "specifier.h"
#include "stat-util.h"
bpf-firewall.h
bpf-foreign.c
bpf-foreign.h
+ bpf-socket-bind.c
+ bpf-socket-bind.h
cgroup.c
cgroup.h
core-varlink.c
load-fragment.h
locale-setup.c
locale-setup.h
- manager.c
- manager.h
manager-dump.c
manager-dump.h
+ manager.c
+ manager.h
mount.c
mount.h
namespace.c
slice.h
smack-setup.c
smack-setup.h
- socket-bind.c
- socket-bind.h
socket.c
socket.h
swap.c
+++ /dev/null
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-#include "fdset.h"
-#include "unit.h"
-
-int socket_bind_supported(void);
-
-/* Add BPF link fd created before daemon-reload or daemon-reexec.
- * FDs will be closed at the end of socket_bind_install. */
-int socket_bind_add_initial_link_fd(Unit *u, int fd);
-
-int socket_bind_install(Unit *u);
-
-int serialize_socket_bind(Unit *u, FILE *f, FDSet *fds);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "bpf-socket-bind.h"
#include "bus-util.h"
#include "dbus.h"
#include "fileio-label.h"
#include "format-util.h"
#include "parse-util.h"
#include "serialize.h"
-#include "socket-bind.h"
#include "string-table.h"
#include "unit-serialize.h"
#include "user-util.h"
(void) serialize_cgroup_mask(f, "cgroup-enabled-mask", u->cgroup_enabled_mask);
(void) serialize_cgroup_mask(f, "cgroup-invalidated-mask", u->cgroup_invalidated_mask);
- (void) serialize_socket_bind(u, f, fds);
+ (void) bpf_serialize_socket_bind(u, f, fds);
if (uid_is_valid(u->ref_uid))
(void) serialize_item_format(f, "ref-uid", UID_FMT, u->ref_uid);
continue;
}
- (void) socket_bind_add_initial_link_fd(u, fd);
+ (void) bpf_socket_bind_add_initial_link_fd(u, fd);
}
continue;
}
#include "alloc-util.h"
#include "bpf-firewall.h"
#include "bpf-foreign.h"
+#include "bpf-socket-bind.h"
#include "bus-common-errors.h"
#include "bus-util.h"
#include "cgroup-setup.h"
#include "rm-rf.h"
#include "set.h"
#include "signal-util.h"
-#include "socket-bind.h"
#include "sparse-endian.h"
#include "special.h"
#include "specifier.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "bpf-socket-bind.h"
#include "load-fragment.h"
#include "manager.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "rm-rf.h"
#include "service.h"
-#include "socket-bind.h"
#include "strv.h"
#include "tests.h"
#include "unit.h"
if (!can_memlock())
return log_tests_skipped("Can't use mlock(), skipping.");
- r = socket_bind_supported();
+ r = bpf_socket_bind_supported();
if (r <= 0)
return log_tests_skipped("socket-bind is not supported, skipping.");