Re: [NETFILTER] early_drop() imrovement (v3)
From: Jan Engelhardt
Date: Mon Jun 25 2007 - 10:36:59 EST
On Jun 25 2007 15:53, Patrick McHardy wrote:
>Vasily Averin wrote:
>> +static int early_drop(const struct nf_conntrack_tuple *orig)
>> +{
>> + unsigned int i, hash, cnt;
>> + int ret = 0;
>> +
>> + hash = hash_conntrack(orig);
>> + cnt = NF_CT_PER_BUCKET;
>> +
>> + for (i = 0;
>> + !ret && cnt && i < nf_conntrack_htable_size;
>> + ++i, hash = ++hash % nf_conntrack_htable_size)
>> + ret = __early_drop(&nf_conntrack_hash[hash], &cnt);
>
>Formatting is a bit ugly, looks much nicer as:
>
> for (i = 0; i < nf_conntrack_htable_size; i++) {
>
> ret = __early_drop(&nf_conntrack_hash[hash], &cnt);
> if (ret || !cnt)
> break;
> hash = ++hash % nf_conntrack_htable_size;
> }
gcc warning: operation on âhashâ may be undefined
Jan
--