+ return BAD_ARGUMENT;
+}
+
+/* Given a flow, checks that the destination field represented by 'dst_header'
+ * in the range ['ofs', 'ofs' + 'n_bits') is valid. */
+int
+nxm_dst_check(ovs_be32 dst_header, unsigned int ofs, unsigned int n_bits,
+ const struct flow *flow)
+{
+ const struct nxm_field *dst = nxm_field_lookup(ntohl(dst_header));
+
+ if (!n_bits) {
+ VLOG_WARN_RL(&rl, "zero bit destination field");
+ } else if (!field_ok(dst, flow, ofs + n_bits)) {
+ VLOG_WARN_RL(&rl, "invalid destination field");
+ } else if (!dst->writable) {
+ VLOG_WARN_RL(&rl, "destination field is not writable");
+ } else {
+ return 0;