1 // SPDX-License-Identifier: GPL-2.0
6 #include <sys/socket.h>
9 #include "../../include/uapi/linux/bpf.h"
10 #include <asm/unistd.h>
15 static int handle_get_cmd(struct mbox_request *cmd)
26 static int handle_set_cmd(struct mbox_request *cmd)
31 static void loop(void)
34 struct mbox_request req;
35 struct mbox_reply reply;
38 n = read(0, &req, sizeof(req));
39 if (n != sizeof(req)) {
40 dprintf(debug_fd, "invalid request %d\n", n);
44 reply.status = req.is_set ?
45 handle_set_cmd(&req) :
48 n = write(1, &reply, sizeof(reply));
49 if (n != sizeof(reply)) {
50 dprintf(debug_fd, "reply failed %d\n", n);
58 debug_fd = open("/dev/kmsg", 00000002);
59 dprintf(debug_fd, "Started bpfilter\n");