2 * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #define OFP_ERRORS_H 1
24 #include "openflow/openflow.h"
31 * We embed system errno values and OpenFlow standard and vendor extension
32 * error codes into the positive range of "int":
34 * - Errno values are assumed to use the range 1 through 2**30 - 1.
36 * (C and POSIX say that errno values are positive. We assume that they
37 * are less than 2**29. They are actually less than 65536 on at least
38 * Linux, FreeBSD, OpenBSD, and Windows.)
40 * - OpenFlow standard and vendor extension error codes use the range
41 * starting at 2**30 (OFPERR_OFS).
43 * Zero and negative values are not used.
46 #define OFPERR_OFS (1 << 30)
48 /* OpenFlow error codes.
50 * The comments below are parsed by the extract-ofp-errors program at build
51 * time and used to determine the mapping between "enum ofperr" constants and
52 * error type/code values used in the OpenFlow protocol:
54 * - The first part of each comment specifies OpenFlow type/code for each
55 * protocol that supports the error.
57 * - Additional text is a human-readable description of the meaning of each
58 * error, used to explain the error to the user. Any text enclosed in
59 * square brackets is omitted; this can be used to explain rationale for
60 * choice of error codes in the case where this is desirable. */
62 /* Expected duplications. */
64 /* Expected: 3,5 in OF1.1 means both OFPBIC_BAD_EXPERIMENTER and
65 * OFPBIC_BAD_EXP_TYPE. */
67 /* ## ------------------ ## */
68 /* ## OFPET_HELLO_FAILED ## */
69 /* ## ------------------ ## */
71 /* OF1.0+(0,0). No compatible version. */
72 OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS,
74 /* OF1.0+(0,1). Permissions error. */
77 /* ## ----------------- ## */
78 /* ## OFPET_BAD_REQUEST ## */
79 /* ## ----------------- ## */
81 /* OF1.0+(1,0). ofp_header.version not supported. */
82 OFPERR_OFPBRC_BAD_VERSION,
84 /* OF1.0+(1,1). ofp_header.type not supported. */
85 OFPERR_OFPBRC_BAD_TYPE,
87 /* OF1.0+(1,2). ofp_stats_msg.type not supported. */
88 OFPERR_OFPBRC_BAD_STAT,
90 /* OF1.0+(1,3). Vendor not supported (in ofp_vendor_header or
92 OFPERR_OFPBRC_BAD_VENDOR,
94 /* OF1.0+(1,4). Vendor subtype not supported. */
95 OFPERR_OFPBRC_BAD_SUBTYPE,
97 /* OF1.0+(1,5). Permissions error. */
100 /* OF1.0+(1,6). Wrong request length for type. */
101 OFPERR_OFPBRC_BAD_LEN,
103 /* OF1.0+(1,7). Specified buffer has already been used. */
104 OFPERR_OFPBRC_BUFFER_EMPTY,
106 /* OF1.0+(1,8). Specified buffer does not exist. */
107 OFPERR_OFPBRC_BUFFER_UNKNOWN,
109 /* NX1.0(1,512), OF1.1+(1,9). Specified table-id invalid or does not exist.
110 * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID,
111 * is used for OpenFlow 1.0 as there seems to be no appropriste error
112 * code defined the specification. ] */
113 OFPERR_OFPBRC_BAD_TABLE_ID,
115 /* OF1.2+(1,10). Denied because controller is slave. */
116 OFPERR_OFPBRC_IS_SLAVE,
118 /* NX1.0(1,514), NX1.1(1,514), OF1.2+(1,11). Invalid port.
119 * [ A non-standard error (1,514), formerly
120 * OFPERR_NXBRC_BAD_IN_PORT is used for OpenFlow 1.0 and 1.1 as there
121 * seems to be no appropriste error code defined the specifications. ] */
122 OFPERR_OFPBRC_BAD_PORT,
124 /* OF1.2+(1,12). Invalid packet in packet-out. */
125 OFPERR_OFPBRC_BAD_PACKET,
127 /* OF1.3+(1,13). Multipart request overflowed the assigned buffer. */
128 OFPERR_OFPBRC_MULTIPART_BUFFER_OVERFLOW,
130 /* NX1.0+(1,256). Invalid NXM flow match. */
131 OFPERR_NXBRC_NXM_INVALID,
133 /* NX1.0+(1,257). The nxm_type, or nxm_type taken in combination with
134 * nxm_hasmask or nxm_length or both, is invalid or not implemented. */
135 OFPERR_NXBRC_NXM_BAD_TYPE,
137 /* NX1.0+(1,515). Must-be-zero field had nonzero value. */
138 OFPERR_NXBRC_MUST_BE_ZERO,
140 /* NX1.0+(1,516). The reason in an ofp_port_status message is not
142 OFPERR_NXBRC_BAD_REASON,
144 /* NX1.0+(1,517). The 'id' in an NXST_FLOW_MONITOR request is the same as
145 * an existing monitor id (or two monitors in the same NXST_FLOW_MONITOR
146 * request have the same 'id'). */
147 OFPERR_NXBRC_FM_DUPLICATE_ID,
149 /* NX1.0+(1,518). The 'flags' in an NXST_FLOW_MONITOR request either does
150 * not specify at least one of the NXFMF_ADD, NXFMF_DELETE, or NXFMF_MODIFY
151 * flags, or specifies a flag bit that is not defined. */
152 OFPERR_NXBRC_FM_BAD_FLAGS,
154 /* NX1.0+(1,519). The 'id' in an NXT_FLOW_MONITOR_CANCEL request is not
155 * the id of any existing monitor. */
156 OFPERR_NXBRC_FM_BAD_ID,
158 /* NX1.0+(1,520). The 'event' in an NXST_FLOW_MONITOR reply does not
159 * specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or
161 OFPERR_NXBRC_FM_BAD_EVENT,
163 /* ## ---------------- ## */
164 /* ## OFPET_BAD_ACTION ## */
165 /* ## ---------------- ## */
167 /* OF1.0+(2,0). Unknown action type. */
168 OFPERR_OFPBAC_BAD_TYPE,
170 /* OF1.0+(2,1). Length problem in actions. */
171 OFPERR_OFPBAC_BAD_LEN,
173 /* OF1.0+(2,2). Unknown experimenter id specified. */
174 OFPERR_OFPBAC_BAD_VENDOR,
176 /* OF1.0+(2,3). Unknown action type for experimenter id. */
177 OFPERR_OFPBAC_BAD_VENDOR_TYPE,
179 /* OF1.0+(2,4). Problem validating output port. */
180 OFPERR_OFPBAC_BAD_OUT_PORT,
182 /* OF1.0+(2,5). Bad action argument. */
183 OFPERR_OFPBAC_BAD_ARGUMENT,
185 /* OF1.0+(2,6). Permissions error. */
188 /* OF1.0+(2,7). Can't handle this many actions. */
189 OFPERR_OFPBAC_TOO_MANY,
191 /* OF1.0+(2,8). Problem validating output queue. */
192 OFPERR_OFPBAC_BAD_QUEUE,
194 /* OF1.1+(2,9). Invalid group id in forward action. */
195 OFPERR_OFPBAC_BAD_OUT_GROUP,
197 /* OF1.1+(2,10). Action can't apply for this match. */
198 OFPERR_OFPBAC_MATCH_INCONSISTENT,
200 /* OF1.1+(2,11). Action order is unsupported for the action list in an
201 * Apply-Actions instruction */
202 OFPERR_OFPBAC_UNSUPPORTED_ORDER,
204 /* OF1.1+(2,12). Actions uses an unsupported tag/encap. */
205 OFPERR_OFPBAC_BAD_TAG,
207 /* OF1.2+(2,13). Unsupported type in SET_FIELD action. */
208 OFPERR_OFPBAC_SET_TYPE,
210 /* OF1.2+(2,14). Length problem in SET_FIELD action. */
211 OFPERR_OFPBAC_SET_LEN,
213 /* OF1.2+(2,15). Bad argument in SET_FIELD action. */
214 OFPERR_OFPBAC_ARGUMENT,
216 /* NX1.0+(2,256). Must-be-zero action argument had nonzero value. */
217 OFPERR_NXBAC_MUST_BE_ZERO,
219 /* ## --------------------- ## */
220 /* ## OFPET_BAD_INSTRUCTION ## */
221 /* ## --------------------- ## */
223 /* OF1.1+(3,0). Unknown instruction. */
224 OFPERR_OFPBIC_UNKNOWN_INST,
226 /* OF1.1+(3,1). Switch or table does not support the instruction. */
227 OFPERR_OFPBIC_UNSUP_INST,
229 /* OF1.1+(3,2). Invalid Table-ID specified. */
230 OFPERR_OFPBIC_BAD_TABLE_ID,
232 /* OF1.1+(3,3). Metadata value unsupported by datapath. */
233 OFPERR_OFPBIC_UNSUP_METADATA,
235 /* OF1.1+(3,4). Metadata mask value unsupported by datapath. */
236 OFPERR_OFPBIC_UNSUP_METADATA_MASK,
238 /* OF1.1+(3,5). Unknown experimenter id specified. */
239 OFPERR_OFPBIC_BAD_EXPERIMENTER,
241 /* OF1.1(3,5), OF1.2+(3,6). Unknown instruction for experimenter id. */
242 OFPERR_OFPBIC_BAD_EXP_TYPE,
244 /* OF1.2+(3,7). Length problem in instructions. */
245 OFPERR_OFPBIC_BAD_LEN,
247 /* OF1.2+(3,8). Permissions error. */
250 /* ## --------------- ## */
251 /* ## OFPET_BAD_MATCH ## */
252 /* ## --------------- ## */
254 /* OF1.1+(4,0). Unsupported match type specified by the match */
255 OFPERR_OFPBMC_BAD_TYPE,
257 /* OF1.1+(4,1). Length problem in match. */
258 OFPERR_OFPBMC_BAD_LEN,
260 /* OF1.1+(4,2). Match uses an unsupported tag/encap. */
261 OFPERR_OFPBMC_BAD_TAG,
263 /* OF1.1+(4,3). Unsupported datalink addr mask - switch does not support
264 * arbitrary datalink address mask. */
265 OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
267 /* OF1.1+(4,4). Unsupported network addr mask - switch does not support
268 * arbitrary network address mask. */
269 OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
271 /* OF1.1+(4,5). Unsupported wildcard specified in the match. */
272 OFPERR_OFPBMC_BAD_WILDCARDS,
274 /* OF1.1+(4,6). Unsupported field in the match. */
275 OFPERR_OFPBMC_BAD_FIELD,
277 /* NX1.0(1,258), OF1.1+(4,7). Unsupported value in a match
279 OFPERR_OFPBMC_BAD_VALUE,
281 /* NX1.0(1,259), NX1.1(1,259), OF1.2+(4,8). Unsupported mask specified in
282 * the match, field is not dl-address or nw-address. */
283 OFPERR_OFPBMC_BAD_MASK,
285 /* NX1.0(1,260), NX1.1(1,260), OF1.2+(4,9). A prerequisite was not met. */
286 OFPERR_OFPBMC_BAD_PREREQ,
288 /* NX1.0(1,261), NX1.1(1,261), OF1.2+(4,10). A field type was
290 OFPERR_OFPBMC_DUP_FIELD,
292 /* OF1.2+(4,11). Permissions error. */
295 /* ## --------------------- ## */
296 /* ## OFPET_FLOW_MOD_FAILED ## */
297 /* ## --------------------- ## */
299 /* OF1.1+(5,0). Unspecified error. */
300 OFPERR_OFPFMFC_UNKNOWN,
302 /* OF1.0(3,0), OF1.1+(5,1). Flow not added because of full table(s). */
303 OFPERR_OFPFMFC_TABLE_FULL,
305 /* OF1.1+(5,2). Table does not exist */
306 OFPERR_OFPFMFC_BAD_TABLE_ID,
308 /* OF1.0(3,1), OF1.1+(5,3). Attempted to add overlapping flow with
309 * CHECK_OVERLAP flag set. */
310 OFPERR_OFPFMFC_OVERLAP,
312 /* OF1.0(3,2), OF1.1+(5,4). Permissions error. */
313 OFPERR_OFPFMFC_EPERM,
315 /* OF1.1+(5,5). Flow not added because of unsupported idle/hard
317 OFPERR_OFPFMFC_BAD_TIMEOUT,
319 /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */
320 OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
322 /* OF1.0(3,4), OF1.1+(5,6). Unsupported or unknown command. */
323 OFPERR_OFPFMFC_BAD_COMMAND,
325 /* OF1.2+(5,7). Unsupported or unknown flags. */
326 OFPERR_OFPFMFC_BAD_FLAGS,
328 /* OF1.0(3,5). Unsupported action list - cannot process in the order
330 OFPERR_OFPFMFC_UNSUPPORTED,
332 /* NX1.0(3,256), NX1.1(5,256). Generic hardware error. */
333 OFPERR_NXFMFC_HARDWARE,
335 /* NX1.0(3,257), NX1.1(5,257). A nonexistent table ID was specified in the
336 * "command" field of struct ofp_flow_mod, when the nxt_flow_mod_table_id
337 * extension is enabled. */
338 OFPERR_NXFMFC_BAD_TABLE_ID,
340 /* ## ---------------------- ## */
341 /* ## OFPET_GROUP_MOD_FAILED ## */
342 /* ## ---------------------- ## */
344 /* OF1.1+(6,0). Group not added because a group ADD attempted to replace
345 * an already-present group. */
346 OFPERR_OFPGMFC_GROUP_EXISTS,
348 /* OF1.1+(6,1). Group not added because Group specified is invalid. */
349 OFPERR_OFPGMFC_INVALID_GROUP,
351 /* OF1.1+(6,2). Switch does not support unequal load sharing with select
353 OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
355 /* OF1.1+(6,3). The group table is full. */
356 OFPERR_OFPGMFC_OUT_OF_GROUPS,
358 /* OF1.1+(6,4). The maximum number of action buckets for a group has been
360 OFPERR_OFPGMFC_OUT_OF_BUCKETS,
362 /* OF1.1+(6,5). Switch does not support groups that forward to groups. */
363 OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
365 /* OF1.1+(6,6). This group cannot watch the watch_port or watch_group
367 OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
369 /* OF1.1+(6,7). Group entry would cause a loop. */
372 /* OF1.1+(6,8). Group not modified because a group MODIFY attempted to
373 * modify a non-existent group. */
374 OFPERR_OFPGMFC_UNKNOWN_GROUP,
376 /* OF1.2+(6,9). Group not deleted because another
377 group is forwarding to it. */
378 OFPERR_OFPGMFC_CHAINED_GROUP,
380 /* OF1.2+(6,10). Unsupported or unknown group type. */
381 OFPERR_OFPGMFC_BAD_TYPE,
383 /* OF1.2+(6,11). Unsupported or unknown command. */
384 OFPERR_OFPGMFC_BAD_COMMAND,
386 /* OF1.2+(6,12). Error in bucket. */
387 OFPERR_OFPGMFC_OFPGMFC_BAD_BUCKET,
389 /* OF1.2+(6,13). Error in watch port/group. */
390 OFPERR_OFPGMFC_OFPGMFC_BAD_WATCH,
392 /* OF1.2+(6,14). Permissions error. */
393 OFPERR_OFPGMFC_OFPGMFC_EPERM,
395 /* ## --------------------- ## */
396 /* ## OFPET_PORT_MOD_FAILED ## */
397 /* ## --------------------- ## */
399 /* OF1.0(4,0), OF1.1+(7,0). Specified port does not exist. */
400 OFPERR_OFPPMFC_BAD_PORT,
402 /* OF1.0(4,1), OF1.1+(7,1). Specified hardware address does not match the
404 OFPERR_OFPPMFC_BAD_HW_ADDR,
406 /* OF1.1+(7,2). Specified config is invalid. */
407 OFPERR_OFPPMFC_BAD_CONFIG,
409 /* OF1.1+(7,3). Specified advertise is invalid. */
410 OFPERR_OFPPMFC_BAD_ADVERTISE,
412 /* OF1.2+(7,4). Permissions error. */
413 OFPERR_OFPPMFC_EPERM,
415 /* ## ---------------------- ## */
416 /* ## OFPET_TABLE_MOD_FAILED ## */
417 /* ## ---------------------- ## */
419 /* OF1.1+(8,0). Specified table does not exist. */
420 OFPERR_OFPTMFC_BAD_TABLE,
422 /* OF1.1+(8,1). Specified config is invalid. */
423 OFPERR_OFPTMFC_BAD_CONFIG,
425 /* OF1.2+(8,2). Permissions error. */
426 OFPERR_OFPTMFC_EPERM,
428 /* ## --------------------- ## */
429 /* ## OFPET_QUEUE_OP_FAILED ## */
430 /* ## --------------------- ## */
432 /* OF1.0(5,0), OF1.1+(9,0). Invalid port (or port does not exist). */
433 OFPERR_OFPQOFC_BAD_PORT,
435 /* OF1.0(5,1), OF1.1+(9,1). Queue does not exist. */
436 OFPERR_OFPQOFC_BAD_QUEUE,
438 /* OF1.0(5,2), OF1.1+(9,2). Permissions error. */
439 OFPERR_OFPQOFC_EPERM,
441 /* ## -------------------------- ## */
442 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
443 /* ## -------------------------- ## */
445 /* OF1.1+(10,0). Specified flags is invalid. */
446 OFPERR_OFPSCFC_BAD_FLAGS,
448 /* OF1.1+(10,1). Specified len is invalid. */
449 OFPERR_OFPSCFC_BAD_LEN,
451 /* OF1.2+(10,2). Permissions error. */
452 OFPERR_OFPSCFC_EPERM,
454 /* ## ------------------------- ## */
455 /* ## OFPET_ROLE_REQUEST_FAILED ## */
456 /* ## ------------------------- ## */
458 /* OF1.2+(11,0). Stale Message: old generation_id. */
459 OFPERR_OFPRRFC_STALE,
461 /* OF1.2+(11,1). Controller role change unsupported. */
462 OFPERR_OFPRRFC_UNSUP,
464 /* NX1.0(1,513), NX1.1(1,513), OF1.2+(11,2). Invalid role. */
465 OFPERR_OFPRRFC_BAD_ROLE,
467 /* ## ---------------------- ## */
468 /* ## OFPET_METER_MOD_FAILED ## */
469 /* ## ---------------------- ## */
471 /* OF1.3+(12,0). Unspecified error. */
472 OFPERR_OFPMMFC_UNKNOWN,
474 /* OF1.3+(12,1). Meter not added because a Meter ADD attempted to
475 * replace an existing Meter. */
476 OFPERR_OFPMMFC_METER_EXISTS,
478 /* OF1.3+(12,2). Meter not added because Meter specified is invalid. */
479 OFPERR_OFPMMFC_INVALID_METER,
481 /* OF1.3+(12,3). Meter not modified because a Meter MODIFY attempted
482 * to modify a non-existent Meter. */
483 OFPERR_OFPMMFC_UNKNOWN_METER,
485 /* OF1.3+(12,4). Unsupported or unknown command. */
486 OFPERR_OFPMMFC_BAD_COMMAND,
488 /* OF1.3+(12,5). Flag configuration unsupported. */
489 OFPERR_OFPMMFC_BAD_FLAGS,
491 /* OF1.3+(12,6). Rate unsupported. */
492 OFPERR_OFPMMFC_BAD_RATE,
494 /* OF1.3+(12,7). Burst size unsupported. */
495 OFPERR_OFPMMFC_BAD_BURST,
497 /* OF1.3+(12,8). Band unsupported. */
498 OFPERR_OFPMMFC_BAD_BAND,
500 /* OF1.3+(12,9). Band value unsupported. */
501 OFPERR_OFPMMFC_BAD_BAND_VALUE,
503 /* OF1.3+(12,10). No more meters available. */
504 OFPERR_OFPMMFC_OUT_OF_METERS,
506 /* OF1.3+(12,11). The maximum number of properties for a meter has
508 OFPERR_OFPMMFC_OUT_OF_BANDS,
510 /* ## --------------------------- ## */
511 /* ## OFPET_TABLE_FEATURES_FAILED ## */
512 /* ## --------------------------- ## */
514 /* OF1.3+(13,0). Specified table does not exist. */
515 OFPERR_OFPTFFC_BAD_TABLE,
517 /* OF1.3+(13,1). Invalid metadata mask. */
518 OFPERR_OFPTFFC_BAD_METADATA,
520 /* OF1.3+(13,2). Unknown property type. */
521 OFPERR_OFPTFFC_BAD_TYPE,
523 /* OF1.3+(13,3). Length problem in properties. */
524 OFPERR_OFPTFFC_BAD_LEN,
526 /* OF1.3+(13,4). Unsupported property value. */
527 OFPERR_OFPTFFC_BAD_ARGUMENT,
529 /* OF1.3+(13,5). Permissions error. */
530 OFPERR_OFPTFFC_EPERM,
532 /* ## ------------------ ## */
533 /* ## OFPET_EXPERIMENTER ## */
534 /* ## ------------------ ## */
537 const char *ofperr_domain_get_name(enum ofp_version);
539 bool ofperr_is_valid(enum ofperr);
540 bool ofperr_is_encodable(enum ofperr, enum ofp_version);
542 enum ofperr ofperr_decode(enum ofp_version, uint16_t type, uint16_t code);
543 enum ofperr ofperr_from_name(const char *);
545 enum ofperr ofperr_decode_msg(const struct ofp_header *,
546 struct ofpbuf *payload);
547 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
548 struct ofpbuf *ofperr_encode_hello(enum ofperr, enum ofp_version ofp_version,
550 int ofperr_get_type(enum ofperr, enum ofp_version);
551 int ofperr_get_code(enum ofperr, enum ofp_version);
553 const char *ofperr_get_name(enum ofperr);
554 const char *ofperr_get_description(enum ofperr);
556 void ofperr_format(struct ds *, enum ofperr);
557 const char *ofperr_to_string(enum ofperr);
559 #endif /* ofp-errors.h */