On Tue, May 22, 2012 at 12:31:30AM -0700, Ben Pfaff wrote: > This is another step toward OpenFlow 1.1 support. The change does not > affect any outwardly visible OpenFlow behavior yet. > > Signed-off-by: Ben Pfaff <b...@nicira.com>
I forgot that so far we only implement CIDR masks for IP source and destination addresses. Here's an incremental. diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 84cb350..edc9d41 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -347,6 +347,11 @@ ofputil_cls_rule_from_ofp11_match(const struct ofp11_match *match, if (!(wc & OFPFW11_NW_PROTO)) { cls_rule_set_nw_proto(rule, match->nw_proto); } + + if (!ip_is_cidr(~match->nw_src_mask) || + !ip_is_cidr(~match->nw_dst_mask)) { + return OFPERR_OFPBMC_BAD_NW_ADDR_MASK; + } cls_rule_set_nw_src_masked(rule, match->nw_src, ~match->nw_src_mask); cls_rule_set_nw_dst_masked(rule, match->nw_dst, ~match->nw_dst_mask); } diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 46cdfc4..0bb219d 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -761,12 +761,26 @@ dnl Try invalid TOS: 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl 00000000 00 000000 0000000000000000ffffffffffffffff +dnl Try non-CIDR nw_src_mask: +# bad ofp11_match: OFPBMC_BAD_NW_ADDR_MASK +0000 0058 00000000 000003f7 dnl +000000000000ffffffffffff 000000000000ffffffffffff dnl +0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl +00000000 00 000000 0000000000000000ffffffffffffffff + # ip,nw_dst=192.168.128.0/24 0000 0058 00000000 000003f7 dnl 000000000000ffffffffffff 000000000000ffffffffffff dnl 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl 00000000 00 000000 0000000000000000ffffffffffffffff +dnl Try non-CIDR nw_dst_mask: +# bad ofp11_match: OFPBMC_BAD_NW_ADDR_MASK +0000 0058 00000000 000003f7 dnl +000000000000ffffffffffff 000000000000ffffffffffff dnl +0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl +00000000 00 000000 0000000000000000ffffffffffffffff + # arp,nw_src=192.168.128.0/24 0000 0058 00000000 000003f7 dnl 000000000000ffffffffffff 000000000000ffffffffffff dnl _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev