lkml.org 
[lkml]   [2023]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] samples/bpf: Add sample usage for BPF_PROG_TYPE_NETFILTER
Date
David Wang <00107082@163.com> writes:

> This sample code implements a simple ipv4
> blacklist via the new bpf type BPF_PROG_TYPE_NETFILTER,
> which was introduced in 6.4.
>
> The bpf program drops package if destination ip address
> hits a match in the map of type BPF_MAP_TYPE_LPM_TRIE,
>
> The userspace code would load the bpf program,
> attach it to netfilter's FORWARD/OUTPUT hook,
> and then write ip patterns into the bpf map.
>
> Signed-off-by: David Wang <00107082@163.com>
> ---
> samples/bpf/Makefile | 3 +
> samples/bpf/netfilter_ip4_blacklist.bpf.c | 62 +++++++++++++++
> samples/bpf/netfilter_ip4_blacklist.c | 96 +++++++++++++++++++++++
> 3 files changed, 161 insertions(+)
> create mode 100644 samples/bpf/netfilter_ip4_blacklist.bpf.c
> create mode 100644 samples/bpf/netfilter_ip4_blacklist.c

According to https://docs.kernel.org/process/coding-style.html#naming
you should avoid new use of blacklist. You should use somethink like
denylist or blocklist instead.

\
 
 \ /
  Last update: 2023-09-05 18:25    [W:0.131 / U:3.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site