netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Corubba Smith <corubba@gmx.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH ulogd2] nfct: add network namespace support
Date: Wed, 12 Mar 2025 09:37:16 +0100	[thread overview]
Message-ID: <20250312083716.GA14222@breakpoint.cc> (raw)
In-Reply-To: <7d1478b6-ec25-4286-a365-ce28293f4a40@gmx.de>

Corubba Smith <corubba@gmx.de> wrote:
> Add a new option which allows opening the netlink socket in a different
> network namespace. This way you can run ulogd in one (management)
> network namespace which is able to talk with your export target (e.g.
> database or IPFIX collector), and import flows from multiple (customer)
> network namespaces.

Makes sense to me.

> This commit only implements it for NFCT. I wanted to gather some
> feedback before also implementing it for the other netlink-based
> plugins.

Does it make sense to have this configured on a per-plugin basis?

>    Input plugins:
>      NFLOG plugin:			${enable_nflog}
>      NFCT plugin:			${enable_nfct}

> +#ifdef NETNS_SUPPORT
> +	if (strlen(target_netns_path) > 0) {
> +		errno = 0;
> +		original_netns_fd = open("/proc/self/ns/net", O_RDONLY | O_CLOEXEC);
> +		if (original_netns_fd < 0) {
> +			ulogd_log(ULOGD_FATAL, "error opening original network namespace: %s\n", strerror(errno));
> +			goto err_ons;
> +		}

I think that in order to not have copypastry in all relevant plugins
it would be better to turn code in the NETNS_SUPPORT ifdefs section
into library helpers.

The helpers would always exist; in case ulogd2 is built without
support they would raise an error.

That would also keep the ifdef out of plugin code.

  reply	other threads:[~2025-03-12  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08 23:14 [PATCH ulogd2] nfct: add network namespace support Corubba Smith
2025-03-12  8:37 ` Florian Westphal [this message]
2025-03-12 12:19   ` Corubba Smith

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=20250312083716.GA14222@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=corubba@gmx.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).