aboutgitcodelistschat:MatrixIRC
path: root/debug/build.c
blob: 766a1f6f366709c64d4c911183d315d9f3f48a29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: GPL-2.0-or-later

/* seitan - Syscall Expressive Interpreter, Transformer and Notifier
 *
 * debug/build.c - Dump BPF file in readable format
 *
 * Copyright 2023 Red Hat GmbH
 * Author: Alice Frosi <afrosi@redhat.com>
 */

#define _GNU_SOURCE
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "filter.h"

struct bpf_call calls[] = {
	{
		.name = "connect",
		.args = { 0, 111, 0, 0, 0, 0 },
		.check_arg = { false, false, false, false, false, false },
	},
};

int main(int argc, char **argv)
{
	int ret;
	if (argc < 2) {
		perror("missing input file");
		exit(EXIT_FAILURE);
	}
	ret = convert_bpf(argv[1], calls, sizeof(calls) / sizeof(calls[0]),
			  true);
	if (ret < 0) {
		perror("converting bpf program");
		exit(EXIT_FAILURE);
	}
	return 0;
}