Re: [iptables PATCH 3/8] xtables-restore: Introduce rule counter tokenizer function

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

 



On Fri, Oct 18, 2019 at 11:50:54AM +0200, Phil Sutter wrote:
> Hi Pablo,
> 
> On Fri, Oct 18, 2019 at 10:11:24AM +0200, Pablo Neira Ayuso wrote:
> > On Fri, Oct 18, 2019 at 12:48:31AM +0200, Phil Sutter wrote:
> > > The same piece of code appears three times, introduce a function to take
> > > care of tokenizing and error reporting.
> > > 
> > > Pass buffer pointer via reference so it can be updated to point to after
> > > the counters (if found).
> > > 
> > > While being at it, drop pointless casting when passing pcnt/bcnt to
> > > add_argv().
> > > 
> > > Signed-off-by: Phil Sutter <phil@xxxxxx>
> > 
> > Acked-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> > 
> > If you get to consolidate more common code between xml and native
> > parsers, probably you can add a xtables-restore.c file to store all
> > these functions are common, just an idea for the future.
> 
> I get the point, but we have xtables-restore.c already. Though it
> contains *tables-nft-restore code. I would add to xshared.c until we
> decide it's large enough to split (currently ~750 lines). AFAICT, this
> is the only source file included in both xtables-*-multi binaries. Other
> than that, I could extend libxtables to really share code but it's
> probably not worth it.

OK. No libxtables for this, I'd suggest. This is a library and we
would need to deal with libversion if you expose this API, xshared.c
is fine, I was just wondering if splitting it to encapsulate all
shared parsing code in another file could be useful at some point.



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

  Powered by Linux