1. A non-transitory machine readable medium storing a program that when executed by at least one processing unit forwards packets, the program comprising sets of instructions for: receiving a packet; examining a plurality of rules to find a common match which includes a set of one or more bits that the rules have in common with one another; identifying the position of a diff bit from the packet header, the diff bit being a bit that is different from a bit in the common match; from a wildcard mask, unmasking a bit that is at the same bit position as the position of the diff bit; and generating a flow based on the matching rule and the wildcard mask, wherein the flow is used to process other packets that match each bit which is un-wildcarded.