Re[2]: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark

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

 



>---- Original Message ----
>From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
>To: "Hans Schillstrom" <hans@xxxxxxxxxxxxxxx>
>Cc: kaber@xxxxxxxxx, pablo@xxxxxxxxxxxxx, jengelh@xxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, hans.schillstrom@xxxxxxxxxxxx
>Sent: Fri, Nov 25, 2011, 3:43 PM
>Subject: Re: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark
>
>Le vendredi 25 novembre 2011 à 10:36 +0100, Hans Schillstrom a écrit :
>> From: Hans Schillstrom <hans.schillstrom@xxxxxxxxxxxx>
>> 
>> The target allows you to create rules in the "raw" and "mangle" tables
>> which alter the netfilter mark (nfmark) field within a given range.
>> First a 32 bit hash value is generated then modulus by <limit> and
>> finally an offset is added before it's written to nfmark.
>> Prior to routing, the nfmark can influence the routing method (see
>> "Use netfilter MARK value as routing key") and can also be used by
>> other subsystems to change their behavior.
>> 
>
>
>Oh well, yet another duplicated flow dissector ...
>
>> +/*
>> + * Calc hash value, special casre is taken on icmp and fragmented messages
>> + * i.e. fragmented messages don't use ports.
>> + */
>> +__u32 hmark_v6(struct sk_buff *skb, const struct xt_action_param *par)
>> +{
>> +	struct xt_hmark_info *info = (struct xt_hmark_info *)par->targinfo;
>
>
>
>> +no6ports:
>> +	nexthdr &= info->prmask;
>> +	/* get a consistent hash (same value on both flow directions) */
>> +	if (addr2 < addr1)
>> +		swap(addr1, addr2);
>> +	hash = jhash_3words(addr1, addr2, ports.v32, info->hashrnd) ^ nexthdr;
>
>whats the point computing hash, if info->hmod is null, since we dont set
>skb->mark ?

No point at all :-)
I'll rearange that

>
>> +	if (info->hmod)
>> +		skb->mark = (hash % info->hmod) + info->hoffs;
>> +
>> +	return XT_CONTINUE;
>> +}
>> +#endif
>> +
>
>
>Same problem/question on hmark_v4()

Thanks
Hans

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