Skip to content

Commit

Permalink
ofp-errors: Duplicate instruction error
Browse files Browse the repository at this point in the history
Add OFPERR_OFPBIC_DUP_INST (type = OFPET_BAD_INSTRUCTION, code = 9)
and use it for OpenFlow1.4+.

For OpenFlow1.1 - 1.3 map this error to ONFBIC_DUP_INSTRUCTION
(experimenter = ONF, type = 2600) which is proposed in
OpenFlow enhancement proposal EXT-260 "Add error
code for duplicate instruction.".

Previously ONFBIC_DUP_INSTRUCTION was used for OpenFlow1.3+.

Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
horms authored and blp committed Jun 2, 2014
1 parent 813c5ba commit 0ca30f6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 0 additions & 5 deletions OPENFLOW-1.1+
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ Many of them are necessary for OpenFlow 1.4 as well.
[EXT-256]
[optional for OF1.4+]

* Duplicate instruction error
We already have ONFBIC_DUP_INSTRUCTION.
[EXT-260]
[required for OF1.4+]

* Multipart timeout error
[EXT-264]
[required for OF1.4+]
Expand Down
2 changes: 1 addition & 1 deletion lib/ofp-actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ decode_openflow11_instructions(const struct ofp11_instruction insts[],
}

if (out[type]) {
return OFPERR_ONFBIC_DUP_INSTRUCTION;
return OFPERR_OFPBIC_DUP_INST;
}
out[type] = inst;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ofp-errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ enum ofperr {
/* OF1.2+(3,8). Permissions error. */
OFPERR_OFPBIC_EPERM,

/* ONF1.1+(2600). Duplicate instruction. */
OFPERR_ONFBIC_DUP_INSTRUCTION,
/* ONF1.1-1.3(2600), OF1.4+(3,9). Duplicate instruction. */
OFPERR_OFPBIC_DUP_INST,

/* ## --------------- ## */
/* ## OFPET_BAD_MATCH ## */
Expand Down
4 changes: 2 additions & 2 deletions tests/ofp-actions.at
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ dnl Check that an empty Apply-Actions instruction gets dropped.
0004 0008 00000000

dnl Duplicate instruction type:
# bad OF1.1 instructions: ONFBIC_DUP_INSTRUCTION
# bad OF1.1 instructions: OFPBIC_DUP_INST
0004 0008 00000000 0004 0008 00000000

dnl Instructions not multiple of 8 in length.
Expand Down Expand Up @@ -381,7 +381,7 @@ dnl Write-Metadata too long.
0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000

dnl Write-Metadata duplicated.
# bad OF1.1 instructions: ONFBIC_DUP_INSTRUCTION
# bad OF1.1 instructions: OFPBIC_DUP_INST
0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00

dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
Expand Down
10 changes: 10 additions & 0 deletions tests/ofp-errors.at
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with type OFPBIC_DUP_INST - OF1.4])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 0501001400000000000300090206ccddeeff0011], [0], [dnl
OFPT_ERROR (OF1.4) (xid=0x0): OFPBIC_DUP_INST
OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
(***truncated to 8 bytes from 52445***)
00000000 02 06 cc dd ee ff 00 11- |........ |
])
AT_CLEANUP

dnl OF1.1 had OFPBIC_UNSUP_EXP_INST as 3,5.
dnl OF1.2 broke it into OFPBIC_BAD_EXPERIMENTER as 3,5
dnl and OFPBIC_BAD_EXT_TYPE as 3,6.
Expand Down

0 comments on commit 0ca30f6

Please sign in to comment.