Re: [PATCH nf-next 02/11] netfilter: nf_tables: move bind list_head into relevant subtypes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> On Mon, May 13, 2024 at 03:00:42PM +0200, Florian Westphal wrote:
> [...]
> > @@ -1621,12 +1620,23 @@ static inline int nft_set_elem_is_dead(const struct nft_set_ext *ext)
> >   */
> >  struct nft_trans {
> >  	struct list_head		list;
> > -	struct list_head		binding_list;
> >  	int				msg_type;
> >  	bool				put_net;
> >  	struct nft_ctx			ctx;
> >  };
> >  
> > +/**
> > + * struct nft_trans_binding - nf_tables object with binding support in transaction
> > + * @nft_trans:    base structure, MUST be first member
> 
> This comment says nft_trans MUST be first.

Yes, thats because current code assumes that it can
cast any subtype to nft_trans.

Once everything is converted to container_of that would
not be necessary but I think it would still be better to do it
this way.

> I can add BUILD_BUG_ON for all nft_trans_* objects to check that
> nft_trans always comes first (ie. this comes at offset 0 in this
> structure).

Sounds good, thanks!




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux