Hi, I installed some rulesets generated by ClassBench (a ruleset benchmark for generating ACL and FW rules) in Open vSwitch, and I find many megaflow's mask has discontiguous bits. Like mask = 0xfc in network byte order. After some code investigation I find the problem is in the function *mask_set_prefix_bits*:
staticvoidmask_set_prefix_bits(struct flow_wildcards *wc, uint8_t be32ofs, unsignedint n_bits) { ovs_be32 *mask = &((ovs_be32 *)&wc->masks)[be32ofs]; unsignedint i; for (i = 0; i < n_bits / 32; i++) { mask[i] = OVS_BE32_MAX; }if (n_bits % 32) { mask[i] |= htonl(~0u << (32 - n_bits % 32)); }} For example, if the input n_bits = 6, the mask should be 0x2f, as there is 6 contiguous bits. However, the current code will generate 0xfc: (0xFFFFFFFF << (32 - 6) ) = 0xFC000000 and htonl (0xFC000000) = 0xFC. I am writing this to make sure that I am correct. The OVS code I use is 2.4 release version. Thanks. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev