datapath: Add mask check during flow lookup