enum ofperr error;
size_t i;
+ /* Verify actions before we start to modify any rules, to avoid partial
+ * flow table modifications. */
+ for (i = 0; i < rules->n; i++) {
+ struct rule *rule = rules->rules[i];
+
+ error = ofpacts_check(fm->ofpacts, fm->ofpacts_len, &fm->match.flow,
+ u16_to_ofp(ofproto->max_ports), rule->table_id,
+ request && request->version > OFP10_VERSION);
+ if (error) {
+ return error;
+ }
+ }
+
type = fm->command == OFPFC_ADD ? OFOPERATION_REPLACE : OFOPERATION_MODIFY;
group = ofopgroup_create(ofproto, ofconn, request, fm->buffer_id);
error = OFPERR_OFPBRC_EPERM;
continue;
}
- /* Verify actions, enforce consistency check on OF1.1+. */
- error = ofpacts_check(fm->ofpacts, fm->ofpacts_len, &fm->match.flow,
- u16_to_ofp(ofproto->max_ports), rule->table_id,
- request && request->version > OFP10_VERSION);
- if (error) {
- return error;
- }
-
actions_changed = !ofpacts_equal(fm->ofpacts, fm->ofpacts_len,
rule->actions->ofpacts,
rule->actions->ofpacts_len);
OVS_VSWITCHD_STOP
AT_CLEANUP
+AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
+OVS_VSWITCHD_START(
+ [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
+AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
+AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
+ [1], [], [stderr])
+
+# The output should look like this:
+#
+# OFPT_ERROR (OF1.1) (xid=0x2): OFPBRC_BAD_TABLE_ID
+# OFPT_FLOW_MOD (OF1.1) (xid=0x2):
+# (***truncated to 64 bytes from 160***)
+# 00000000 02 0e 00 a0 00 00 00 02-00 00 00 00 00 00 00 00 |................|
+# 00000010 00 00 00 00 00 00 00 00-01 00 00 00 00 00 80 00 |................|
+# 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
+# 00000030 00 00 00 58 00 00 00 00-00 00 03 ff 00 00 00 00 |...X............|
+#
+# This 'sed' command captures the error message but drops details.
+AT_CHECK([sed '/truncated/d
+/^000000.0/d' stderr | STRIP_XIDS], [0],
+ [OFPT_ERROR (OF1.1): OFPBRC_BAD_TABLE_ID
+OFPT_FLOW_MOD (OF1.1):
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])