X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fautopath.c;h=b42826c14eb37e00d60c3101c96c8db0c1e527b4;hb=476466a0e7acb3fd008c6bcf0a0f479f1ad4d885;hp=22c7c110927dadf3a6696b157ea10779def53e0d;hpb=72c644fd6de23d69f66b755237e3f5c74b4d9af7;p=sliver-openvswitch.git diff --git a/lib/autopath.c b/lib/autopath.c index 22c7c1109..b42826c14 100644 --- a/lib/autopath.c +++ b/lib/autopath.c @@ -82,5 +82,14 @@ autopath_parse(struct nx_action_autopath *ap, const char *s_) int autopath_check(const struct nx_action_autopath *ap, const struct flow *flow) { - return nxm_dst_check(ap->dst, ap->ofs_nbits, 16, flow); + int n_bits = nxm_decode_n_bits(ap->ofs_nbits); + int ofs = nxm_decode_ofs(ap->ofs_nbits); + + if (n_bits < 16) { + VLOG_WARN("at least 16 bit destination is required for autopath " + "action."); + return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_ARGUMENT); + } + + return nxm_dst_check(ap->dst, ofs, n_bits, flow); }