Re: [RFC NETFILTER 2/4]: Add xt_rateest match

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

 



On Nov 25 2007 18:29, Patrick McHardy wrote:
>> > +	spin_lock_bh(&info->est1->lock);
>> > +	rstats	= &info->est1->rstats;
>> > +	if (info->flags & XT_RATEEST_MATCH_DELTA) {
>> > +		bps1	= info->bps1 >= rstats->bps ?
>> > +					info->bps1 - rstats->bps : 0;
>> > +		pps1	= info->pps1 >= rstats->pps ?
>> > +					info->pps1 - rstats->pps : 0;
>> > +	} else {
>> > +		bps1	= rstats->bps;
>> > +		pps1	= rstats->pps;
>> > +	}
>> > +	spin_unlock_bh(&info->est1->lock);
>> > +
>> > +	if (info->flags & XT_RATEEST_MATCH_ABS) {
>> > +		bps2	= info->bps2;
>> > +		pps2	= info->pps2;
>> 
>> I think you can cut down on the extra whitespace around = here,
>> it already lines up nicely anyway.
>
> True, that needs some reformatting anyway, especially the ? .. : ..
> looks weird.
>

Try moving the assign-zero out of the if;
Or maybe it is already zero.

	rstats = &info->est1->rstat;
	bps1 = 0;
	pps1 = 0;
	if (delta) {
		if (info->bps1 >= rstats->bps)
			bps1 = info->bps1 - rstats->bps;
		if (info->pps1 >= rstats->pps)
			pps1 = info->pps1 - rstats->pps;
	} else ...
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux