Re[2]: [v4 PATCH 1/2] NETFILTER module xt_hmark, new target for HASH based fwmark
From: Hans Schillstrom <hidden>
Date: 2011-11-25 14:53:40
Also in:
netfilter-devel
---- Original Message ---- From: Eric Dumazet <redacted> To: "Hans Schillstrom" <redacted> Cc: kaber@trash.net, pablo@netfilter.org, jengelh@medozas.de, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, hans.schillstrom@ericsson.com 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 :quoted
From: Hans Schillstrom <redacted> 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 ...quoted
+/* + * 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;quoted
+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
quoted
+ 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html