Subject: Re: [PATCH v3 bpf-next 2/3] net: netfilter: add bpf_ct_set_nat_info kfunc helper

From: Lorenzo Bianconi <[email-masked]>
Date: Sat, 24 Sep 2022 00:20:09 +0200

> Hi Lorenzo,

Hi Nathan,

> 
> On Wed, Sep 21, 2022 at 06:48:26PM +0200, Lorenzo Bianconi wrote:
> > Introduce bpf_ct_set_nat_info kfunc helper in order to set source and
> > destination nat addresses/ports in a new allocated ct entry not inserted
> > in the connection tracking table yet.
> > 
> > Signed-off-by: Lorenzo Bianconi <[email-masked]>
> 
> This commit is now in -next as commit 0fabd2aa199f ("net: netfilter: add
> bpf_ct_set_nat_info kfunc helper"). Unfortunately, it introduces a
> circular dependency when I build with my distribution's (Arch Linux)
> configuration:
> 
> $ curl -LSso .config https://github.com/archlinux/svntogit-packages/raw/packages/linux/trunk/config
> 
> $ make -skj"$(nproc)" INSTALL_MOD_PATH=rootfs INSTALL_MOD_STRIP=1 olddefconfig all modules_install
> ...
> WARN: multiple IDs found for 'nf_conn': 99333, 114119 - using 99333
> WARN: multiple IDs found for 'nf_conn': 99333, 115663 - using 99333
> WARN: multiple IDs found for 'nf_conn': 99333, 117330 - using 99333
> WARN: multiple IDs found for 'nf_conn': 99333, 119583 - using 99333
> depmod: ERROR: Cycle detected: nf_conntrack -> nf_nat -> nf_conntrack
> depmod: ERROR: Found 2 modules in dependency cycles!

I guess the issue occurs when we compile both nf_conntrack and nf_nat as module
since now we introduced the dependency "nf_conntrack -> nf_nat".
Discussing with Kumar, in order to fix it, we can move bpf_ct_set_nat_info() in
nf_nat module (with some required registration code similar to register_nf_conntrack_bpf()).
What do you think?
Sorry for the inconvenience.

Regards,
Lorenzo

> ...
> 
> The WARN lines are there before this change but I figured they were
> worth including anyways, in case they factor in here.
> 
> If there is any more information I can provide or patches I can test,
> please let me know!
> 
> Cheers,
> Nathan