Florian Westphal
84601d6ee6
bpf: add bpf_link support for BPF_NETFILTER programs
...
Add bpf_link support skeleton. To keep this reviewable, no bpf program
can be invoked yet, if a program is attached only a c-stub is called and
not the actual bpf program.
Defaults to 'y' if both netfilter and bpf syscall are enabled in kconfig.
Uapi example usage:
union bpf_attr attr = { };
attr.link_create.prog_fd = progfd;
attr.link_create.attach_type = 0; /* unused */
attr.link_create.netfilter.pf = PF_INET;
attr.link_create.netfilter.hooknum = NF_INET_LOCAL_IN;
attr.link_create.netfilter.priority = -128;
err = bpf(BPF_LINK_CREATE, &attr, sizeof(attr));
... this would attach progfd to ipv4:input hook.
Such hook gets removed automatically if the calling program exits.
BPF_NETFILTER program invocation is added in followup change.
NF_HOOK_OP_BPF enum will eventually be read from nfnetlink_hook, it
allows to tell userspace which program is attached at the given hook
when user runs 'nft hook list' command rather than just the priority
and not-very-helpful 'this hook runs a bpf prog but I can't tell which
one'.
Will also be used to disallow registration of two bpf programs with
same priority in a followup patch.
v4: arm32 cmpxchg only supports 32bit operand
s/prio/priority/
v3: restrict prog attachment to ip/ip6 for now, lets lift restrictions if
more use cases pop up (arptables, ebtables, netdev ingress/egress etc).
Signed-off-by: Florian Westphal <fw@strlen.de >
Link: https://lore.kernel.org/r/20230421170300.24115-2-fw@strlen.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2023-04-21 11:34:14 -07:00
..
2022-12-06 07:30:55 +09:00
2023-04-10 10:21:33 -07:00
2021-07-01 13:19:48 -07:00
2021-11-19 11:52:25 +00:00
2023-03-17 07:58:18 +00:00
2023-04-21 11:34:14 -07:00
2023-02-22 21:25:23 -08:00
2021-11-17 20:17:05 -08:00
2022-07-22 12:53:22 +01:00
2023-03-09 11:31:44 +01:00
2023-02-16 10:39:28 +01:00
2023-02-20 16:46:10 -08:00
2023-03-17 08:56:37 +00:00
2023-01-06 09:43:32 +00:00
2023-03-18 12:23:33 +00:00
2023-03-29 08:19:38 +01:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2023-03-18 12:23:34 +00:00
2022-08-09 22:14:02 -07:00
2021-12-13 12:34:09 +00:00
2022-09-16 14:34:01 +01:00
2022-11-02 20:38:13 -07:00
2022-07-22 12:53:22 +01:00
2023-04-07 08:47:20 +01:00
2021-03-26 17:43:55 +01:00
2022-08-24 13:46:58 +01:00
2022-11-16 11:31:47 +02:00
2023-03-24 11:45:51 +01:00
2023-01-28 13:51:22 +01:00
2023-01-27 11:19:46 +00:00
2021-12-22 15:03:47 -08:00
2022-07-22 12:53:22 +01:00
2021-12-22 15:03:51 -08:00
2022-07-24 18:39:17 -06:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2023-01-20 09:33:22 +00:00
2023-02-13 09:49:14 +00:00
2023-02-20 08:54:23 +00:00
2023-04-09 15:35:49 +01:00
2023-04-03 10:04:27 +01:00
2021-11-29 19:50:45 -08:00
2022-12-05 21:58:27 -08:00
2023-01-13 20:59:14 -08:00
2023-03-28 18:52:28 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-06 16:06:02 -08:00
2021-12-16 07:18:35 -08:00
2022-07-28 22:21:54 -07:00
2022-09-20 09:13:38 +02:00
2023-02-20 16:46:10 -08:00
2023-01-27 11:19:46 +00:00
2023-04-12 16:40:39 -07:00
2022-12-01 15:09:10 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2022-11-21 13:09:07 +00:00
2022-10-31 10:43:04 +00:00
2021-01-29 20:39:14 -08:00
2022-08-25 16:07:42 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2023-03-07 20:11:36 +01:00
2023-01-28 13:55:10 +01:00
2022-04-06 22:09:39 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-29 11:58:54 +01:00
2022-07-22 12:53:22 +01:00
2022-08-24 19:30:07 -07:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2022-10-31 20:14:27 -07:00
2022-12-30 07:25:52 +00:00
2023-03-17 08:56:37 +00:00
2022-12-30 07:25:52 +00:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2023-03-29 08:22:52 +01:00
2023-03-28 18:52:22 -07:00
2022-04-25 11:40:45 +01:00
2022-04-11 17:37:50 -07:00
2023-04-13 16:43:38 -07:00
2023-02-02 14:02:01 +01:00
2023-01-25 22:45:00 -08:00
2022-09-29 07:18:00 +02:00
2022-07-22 12:53:22 +01:00
2022-10-31 20:14:27 -07:00
2022-09-02 20:34:32 -07:00
2023-02-13 19:55:32 -08:00
2021-03-23 14:14:50 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-07 20:44:59 -08:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-28 11:29:36 +02:00
2021-11-07 19:25:29 +00:00
2021-08-30 01:51:36 +02:00
2023-03-22 13:54:57 +01:00
2022-10-12 12:57:19 +02:00
2022-09-23 06:56:08 -07:00
2022-04-01 12:04:15 +01:00
2021-10-29 13:23:51 +01:00
2021-03-26 15:14:56 -07:00
2022-07-22 12:53:22 +01:00
2022-12-12 13:11:24 -08:00
2022-11-18 12:14:55 +00:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2023-03-21 21:32:18 -07:00
2022-05-11 12:43:10 +01:00
2022-10-24 11:04:43 +01:00
2021-12-10 06:38:26 -08:00
2023-04-10 17:56:18 -07:00
2022-07-22 12:53:22 +01:00
2023-01-28 00:33:51 -08:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2023-01-28 13:51:22 +01:00
2022-07-22 12:53:22 +01:00
2023-02-21 09:15:39 -08:00
2022-12-01 12:42:46 +01:00
2023-02-20 16:46:10 -08:00
2023-03-09 23:24:14 -08:00
2022-07-22 12:53:22 +01:00
2022-07-15 18:50:35 -07:00
2021-08-09 15:34:21 -07:00
2022-07-22 12:53:22 +01:00
2023-04-06 12:01:20 -07:00
2023-03-17 08:56:37 +00:00
2022-10-11 17:42:58 -06:00
2022-07-22 12:53:22 +01:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2023-03-28 18:52:22 -07:00
2022-10-31 18:10:21 -07:00
2023-02-20 16:46:10 -08:00
2023-03-15 08:20:12 +00:00
2022-07-22 12:53:22 +01:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2023-03-15 08:18:35 +00:00
2022-10-25 11:35:16 +02:00
2023-03-28 18:52:28 -07:00
2021-08-03 13:05:26 +01:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2022-11-09 19:06:13 -08:00
2023-02-16 09:27:07 +01:00
2023-04-13 16:43:38 -07:00
2022-09-22 17:27:41 -07:00
2022-10-24 09:40:39 +01:00
2022-12-12 15:04:39 -08:00
2022-07-22 12:53:22 +01:00
2022-11-08 16:42:28 +00:00
2022-10-24 10:52:50 +01:00
2022-10-12 17:50:37 -07:00
2023-03-17 22:41:16 -07:00
2023-03-18 12:23:34 +00:00
2022-07-22 12:53:22 +01:00
2022-09-30 07:55:46 -07:00
2023-03-07 09:33:43 -08:00
2023-04-13 16:43:38 -07:00
2023-03-20 11:29:33 +02:00
2023-04-06 09:53:05 -07:00