Re: [PATCH] netfilter: xtables: introduce xt_length revision 2½

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

 



On Monday 2010-08-02 18:01, Patrick McHardy wrote:
>>>> +	if (info->flags & XT_LENGTH_LAYER3)
>>>> +		len = ntohs(iph->tot_len);
>>>> +	else if (info->flags & XT_LENGTH_LAYER4)
>>>> +		len = ntohs(iph->tot_len) - par->thoff;
>>>> +	else if (info->flags & XT_LENGTH_LAYER5)
>>>> +		hit = xtlength_layer5(&len, skb, iph->protocol, par->thoff);
>>>> +	else if (info->flags & XT_LENGTH_LAYER7)
>>>> +		hit = xtlength_layer7(&len, skb, iph->protocol, par->thoff);
>>>> +	if (!hit)
>>>> +		return false;
>>>> +}
>>>
>>> This serie of tests is expensive and useless.[...]
>> Not really[...]
>> 
>> The compiler is smart enough to see that a run of if tests against
>> the same variable with different values is transformable into a
>> switch statement.
>
>They are mutually exclusive though, so using a bitmask doesn't make
>much sense.

Right. Since that's been already fixed in the submission, can it go in? 
:)
--
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