BPF List
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Florian Westphal <fw@strlen.de>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	netfilter-devel@vger.kernel.org, dxu@dxuuu.xyz, qde@naccy.de
Subject: Re: [PATCH bpf-next v3 3/6] netfilter: nfnetlink hook: dump bpf prog id
Date: Thu, 20 Apr 2023 11:54:22 +0200	[thread overview]
Message-ID: <ZEELzpNCnYJuZyod@corigine.com> (raw)
In-Reply-To: <20230418131038.18054-4-fw@strlen.de>

On Tue, Apr 18, 2023 at 03:10:35PM +0200, Florian Westphal wrote:
> This allows userspace ("nft list hooks") to show which bpf program
> is attached to which hook.
> 
> Without this, user only knows bpf prog is attached at prio
> x, y, z at INPUT and FORWARD, but can't tell which program is where.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Hi Florian,

as it seems there will be a v4, some kdoc nits from my side.

> ---
>  include/uapi/linux/netfilter/nfnetlink_hook.h | 20 ++++-
>  net/netfilter/nfnetlink_hook.c                | 81 ++++++++++++++++---
>  2 files changed, 87 insertions(+), 14 deletions(-)
> 
> diff --git a/include/uapi/linux/netfilter/nfnetlink_hook.h b/include/uapi/linux/netfilter/nfnetlink_hook.h
> index bbcd285b22e1..63b7dbddf0b1 100644
> --- a/include/uapi/linux/netfilter/nfnetlink_hook.h
> +++ b/include/uapi/linux/netfilter/nfnetlink_hook.h
> @@ -32,8 +32,12 @@ enum nfnl_hook_attributes {
>  /**
>   * enum nfnl_hook_chain_info_attributes - chain description
>   *
> - * NFNLA_HOOK_INFO_DESC: nft chain and table name (enum nft_table_attributes) (NLA_NESTED)
> + * NFNLA_HOOK_INFO_DESC: nft chain and table name (NLA_NESTED)
>   * NFNLA_HOOK_INFO_TYPE: chain type (enum nfnl_hook_chaintype) (NLA_U32)

nit: -,.s/NFLA/@NFLA/

> + *
> + * NFNLA_HOOK_INFO_DESC depends on NFNLA_HOOK_INFO_TYPE value:
> + *   NFNL_HOOK_TYPE_NFTABLES: enum nft_table_attributes
> + *   NFNL_HOOK_TYPE_BPF: enum nfnl_hook_bpf_info_attributes
>   */
>  enum nfnl_hook_chain_info_attributes {
>  	NFNLA_HOOK_INFO_UNSPEC,
> @@ -56,9 +60,23 @@ enum nfnl_hook_chain_desc_attributes {
>   * enum nfnl_hook_chaintype - chain type
>   *
>   * @NFNL_HOOK_TYPE_NFTABLES nf_tables base chain
> + * @NFNL_HOOK_TYPE_BPF bpf program

nit: s/@NFNL_HOOK_TYPE_NFTABLES/@NFNL_HOOK_TYPE_NFTABLES:/
     s/@NFNL_HOOK_TYPE_BPF/@NFNL_HOOK_TYPE_BPF:/

>   */
>  enum nfnl_hook_chaintype {
>  	NFNL_HOOK_TYPE_NFTABLES = 0x1,
> +	NFNL_HOOK_TYPE_BPF,
> +};
> +
> +/**
> + * enum nfnl_hook_bpf_info_attributes - bpf prog description

nit: s/nfnl_hook_bpf_info_attributes/nfnl_hook_bpf_attributes/

> + *
> + * NFNLA_BPF_INFO_ID: bpf program id (NLA_U32)

nit: s/NFNLA_BPF_INFO_ID:/NFNLA_HOOK_BPF_ID:/

> + */
> +enum nfnl_hook_bpf_attributes {
> +	NFNLA_HOOK_BPF_UNSPEC,
> +	NFNLA_HOOK_BPF_ID,
> +	__NFNLA_HOOK_BPF_MAX,
>  };
> +#define NFNLA_HOOK_BPF_MAX (__NFNLA_HOOK_BPF_MAX - 1)

...

  reply	other threads:[~2023-04-20  9:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 13:10 [PATCH bpf-next v3 0/6] bpf: add netfilter program type Florian Westphal
2023-04-18 13:10 ` [PATCH bpf-next v3 1/6] bpf: add bpf_link support for BPF_NETFILTER programs Florian Westphal
2023-04-18 18:35   ` Alexei Starovoitov
2023-04-18 19:48     ` Florian Westphal
2023-04-19  5:57   ` kernel test robot
2023-04-18 13:10 ` [PATCH bpf-next v3 2/6] bpf: minimal support for programs hooked into netfilter framework Florian Westphal
2023-04-19  2:11   ` Alexei Starovoitov
2023-04-18 13:10 ` [PATCH bpf-next v3 3/6] netfilter: nfnetlink hook: dump bpf prog id Florian Westphal
2023-04-20  9:54   ` Simon Horman [this message]
2023-04-18 13:10 ` [PATCH bpf-next v3 4/6] netfilter: disallow bpf hook attachment at same priority Florian Westphal
2023-04-18 13:10 ` [PATCH bpf-next v3 5/6] tools: bpftool: print netfilter link info Florian Westphal
2023-04-18 14:20   ` Quentin Monnet
2023-04-18 19:50     ` Florian Westphal
2023-04-18 13:10 ` [PATCH bpf-next v3 6/6] bpf: add test_run support for netfilter program type Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZEELzpNCnYJuZyod@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=bpf@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=qde@naccy.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox