Re: [PATCH v2 iptables-nft 1/3] xlate: get rid of escape_quotes

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

 



Phil Sutter <phil@xxxxxx> wrote:
> On Tue, Nov 29, 2022 at 03:05:40PM +0100, Florian Westphal wrote:
> [...]
> > diff --git a/extensions/libxt_LOG.c b/extensions/libxt_LOG.c
> > index e3f4290ba003..b6fe0b2edda1 100644
> > --- a/extensions/libxt_LOG.c
> > +++ b/extensions/libxt_LOG.c
> > @@ -151,12 +151,8 @@ static int LOG_xlate(struct xt_xlate *xl,
> >  	const char *pname = priority2name(loginfo->level);
> >  
> >  	xt_xlate_add(xl, "log");
> > -	if (strcmp(loginfo->prefix, "") != 0) {
> > -		if (params->escape_quotes)
> > -			xt_xlate_add(xl, " prefix \\\"%s\\\"", loginfo->prefix);
> > -		else
> > -			xt_xlate_add(xl, " prefix \"%s\"", loginfo->prefix);
> > -	}
> > +	if (strcmp(loginfo->prefix, "") != 0)
> > +		xt_xlate_add(xl, " prefix \"%s\"", loginfo->prefix);
> 
> Use the occasion and replace the strcmp() call with a check for first
> array elem?

Can do, but gcc should do that substitution too.

> > +	bool				escape_quotes; /* not used anymore, retained for ABI */
> >  };
> 
> We *could* rename the variable to intentionally break API so people
> notice. OTOH, escape_quotes will always be false which is exactly what
> we need.

Dunno.  I suggest to keep it and remove it once we change ABI for some
other reason.



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

  Powered by Linux