Re: [PATCH nf-next v2 1/1] netfilter: nf_tables: Eliminate duplicated codes in nf_tables_table_enable

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

 



On Fri, Jan 20, 2017 at 8:30 PM, Feng Gao <gfree.wind@xxxxxxxxx> wrote:
> Hi Liping,
>
> On Fri, Jan 20, 2017 at 6:57 PM, Liping Zhang <zlpnobody@xxxxxxxxx> wrote:
>> 2017-01-20 15:42 GMT+08:00 Feng Gao <gfree.wind@xxxxxxxxx>:
>> [...]
>>> In v2 patch, I copied your recommend codes "if (cnt && --cnt == 0)".
>>> Today I think it is not right to use "--cnt", it should use "cnt--".
>>> Because when the cnt is 1, the "--cnt" would break directly.
>>> So I send the v3 patch.
>>
>> But this "if (cnt && cnt-- == 0) break;" check condition seems still incorrect,
>> when the cnt is 1, next round cnt will become 0, so we will fail to break the
>> loop ...
>
> Thanks your catch.
> So we should keep the "(cnt && --cnt == 0)", with
> _nf_tables_table_disable(net, afi, table, i+1) in the error handler of
> nf_tables_table_enable.
>
> Do you think if "i+1" is a little werid?
>
> Regards
> Feng

Because the cnt has two usages, it is used as one flag and one counter.
So it is hard to meet these two requirements.

Then I bring one new counter "i", when cnt is positive and i equals
cnt, it could break.
The codes like following:
if (cnt && i++ == cnt) and the i is initialized as 0.

The v4 patch is sent already.

Regards
Feng
--
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