Re: [PATCH nf-next 2/4] netfilter: flowtable: consolidate flowtable device check
Lorenzo Bianconi <[email protected]> Sat, 25 Jul 2026 12:25:43 +0200
| Newsgroups | gmane.comp.security.firewalls.netfilter.devel |
|---|---|
| Message-ID | <amSPJ4SY8Keb0EEa@lore-desk> |
> Check that device belongs to the flowtable right after the flowtable > discovery path. This is a preparation patch to obtain the dst entry > from the .fill_forward_path in tunnels. > > No functional changes are intended. > > Signed-off-by: Pablo Neira Ayuso <[email protected]> Acked-by: Lorenzo Bianconi <[email protected]> > --- > net/netfilter/nf_flow_table_path.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/net/netfilter/nf_flow_table_path.c b/net/netfilter/nf_flow_table_path.c > index 261bb44d08eb..8f04a4487897 100644 > --- a/net/netfilter/nf_flow_table_path.c > +++ b/net/netfilter/nf_flow_table_path.c > @@ -90,9 +90,12 @@ struct nft_forward_info { > enum flow_offload_xmit_type xmit_type; > }; > > +static bool nft_flowtable_find_dev(const struct net_device *dev, > + struct nft_flowtable *ft); > + > static int nft_dev_path_info(const struct net_device_path_stack *stack, > struct nft_forward_info *info, > - unsigned char *ha, struct nf_flowtable *flowtable) > + unsigned char *ha, struct nft_flowtable *ft) > { > const struct net_device_path *path; > int i; > @@ -178,10 +181,13 @@ static int nft_dev_path_info(const struct net_device_path_stack *stack, > } > } > > - if (nf_flowtable_hw_offload(flowtable) && > + if (nf_flowtable_hw_offload(&ft->data) && > nft_is_valid_ether_device(info->dev)) > info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; > > + if (!nft_flowtable_find_dev(info->dev, ft)) > + return -1; > + > return 0; > } > > @@ -253,10 +259,7 @@ static int nft_dev_forward_path(const struct nft_pktinfo *pkt, > int i; > > if (nft_dev_fill_forward_path(dst, ct, dir, ha, &stack) < 0 || > - nft_dev_path_info(&stack, &info, ha, &ft->data) < 0) > - return -ENOENT; > - > - if (!nft_flowtable_find_dev(info.dev, ft)) > + nft_dev_path_info(&stack, &info, ha, ft) < 0) > return -ENOENT; > > route->tuple[!dir].in.ifindex = info.dev->ifindex; > -- > 2.47.3 >
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCamSPJwAKCRA6cBh0uS2t rG8UAPwIJHhfLiKzLcdVr3pJwOS11yLsTz85OQ1z90H61WH0ZgEAstAdCavhYmHf ZflV00x9aAQcecXKdK6GeCnii8GAnQs= =jt8V -----END PGP SIGNATURE-----