- uint32_t dst = ntohl(ap->dst);
- int ofs = nxm_decode_ofs(ap->ofs_nbits);
- int n_bits = nxm_decode_n_bits(ap->ofs_nbits);
-
- if (!NXM_IS_NX_REG(dst) || NXM_NX_REG_IDX(dst) >= FLOW_N_REGS) {
- VLOG_WARN_RL(&rl, "unsupported destination field %#"PRIx32, dst);
- } else if (ofs + n_bits > nxm_field_bits(dst)) {
- VLOG_WARN_RL(&rl, "destination overflows output field");
- } else if (n_bits < 16) {
- VLOG_WARN_RL(&rl, "minimum of 16 bits required in output field");
- } else {
- return 0;
+ struct mf_subfield dst;
+
+ nxm_decode(&dst, ap->dst, ap->ofs_nbits);
+ if (dst.n_bits < 16) {
+ VLOG_WARN("at least 16 bit destination is required for autopath "
+ "action.");
+ return OFPERR_OFPBAC_BAD_ARGUMENT;