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 /* NX1.0+(1,521). The error that occurred cannot be represented in this
164 * OpenFlow version. */
165 OFPERR_NXBRC_UNENCODABLE_ERROR,
167 /* ## ---------------- ## */
168 /* ## OFPET_BAD_ACTION ## */
169 /* ## ---------------- ## */
171 /* OF1.0+(2,0). Unknown action type. */
172 OFPERR_OFPBAC_BAD_TYPE,
174 /* OF1.0+(2,1). Length problem in actions. */
175 OFPERR_OFPBAC_BAD_LEN,
177 /* OF1.0+(2,2). Unknown experimenter id specified. */
178 OFPERR_OFPBAC_BAD_VENDOR,
180 /* OF1.0+(2,3). Unknown action type for experimenter id. */
181 OFPERR_OFPBAC_BAD_VENDOR_TYPE,
183 /* OF1.0+(2,4). Problem validating output port. */
184 OFPERR_OFPBAC_BAD_OUT_PORT,
186 /* OF1.0+(2,5). Bad action argument. */
187 OFPERR_OFPBAC_BAD_ARGUMENT,
189 /* OF1.0+(2,6). Permissions error. */
192 /* OF1.0+(2,7). Can't handle this many actions. */
193 OFPERR_OFPBAC_TOO_MANY,
195 /* OF1.0+(2,8). Problem validating output queue. */
196 OFPERR_OFPBAC_BAD_QUEUE,
198 /* OF1.1+(2,9). Invalid group id in forward action. */
199 OFPERR_OFPBAC_BAD_OUT_GROUP,
201 /* OF1.1+(2,10). Action can't apply for this match. */
202 OFPERR_OFPBAC_MATCH_INCONSISTENT,
204 /* OF1.1+(2,11). Action order is unsupported for the action list in an
205 * Apply-Actions instruction */
206 OFPERR_OFPBAC_UNSUPPORTED_ORDER,
208 /* OF1.1+(2,12). Actions uses an unsupported tag/encap. */
209 OFPERR_OFPBAC_BAD_TAG,
211 /* OF1.2+(2,13). Unsupported type in SET_FIELD action. */
212 OFPERR_OFPBAC_SET_TYPE,
214 /* OF1.2+(2,14). Length problem in SET_FIELD action. */
215 OFPERR_OFPBAC_SET_LEN,
217 /* OF1.2+(2,15). Bad argument in SET_FIELD action. */
218 OFPERR_OFPBAC_ARGUMENT,
220 /* NX1.0+(2,256). Must-be-zero action argument had nonzero value. */
221 OFPERR_NXBAC_MUST_BE_ZERO,
223 /* ## --------------------- ## */
224 /* ## OFPET_BAD_INSTRUCTION ## */
225 /* ## --------------------- ## */
227 /* OF1.1+(3,0). Unknown instruction. */
228 OFPERR_OFPBIC_UNKNOWN_INST,
230 /* OF1.1+(3,1). Switch or table does not support the instruction. */
231 OFPERR_OFPBIC_UNSUP_INST,
233 /* OF1.1+(3,2). Invalid Table-ID specified. */
234 OFPERR_OFPBIC_BAD_TABLE_ID,
236 /* OF1.1+(3,3). Metadata value unsupported by datapath. */
237 OFPERR_OFPBIC_UNSUP_METADATA,
239 /* OF1.1+(3,4). Metadata mask value unsupported by datapath. */
240 OFPERR_OFPBIC_UNSUP_METADATA_MASK,
242 /* OF1.1+(3,5). Unknown experimenter id specified. */
243 OFPERR_OFPBIC_BAD_EXPERIMENTER,
245 /* OF1.1(3,5), OF1.2+(3,6). Unknown instruction for experimenter id. */
246 OFPERR_OFPBIC_BAD_EXP_TYPE,
248 /* OF1.2+(3,7). Length problem in instructions. */
249 OFPERR_OFPBIC_BAD_LEN,
251 /* OF1.2+(3,8). Permissions error. */
254 /* ## --------------- ## */
255 /* ## OFPET_BAD_MATCH ## */
256 /* ## --------------- ## */
258 /* OF1.1+(4,0). Unsupported match type specified by the match */
259 OFPERR_OFPBMC_BAD_TYPE,
261 /* OF1.1+(4,1). Length problem in match. */
262 OFPERR_OFPBMC_BAD_LEN,
264 /* OF1.1+(4,2). Match uses an unsupported tag/encap. */
265 OFPERR_OFPBMC_BAD_TAG,
267 /* OF1.1+(4,3). Unsupported datalink addr mask - switch does not support
268 * arbitrary datalink address mask. */
269 OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
271 /* OF1.1+(4,4). Unsupported network addr mask - switch does not support
272 * arbitrary network address mask. */
273 OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
275 /* OF1.1+(4,5). Unsupported wildcard specified in the match. */
276 OFPERR_OFPBMC_BAD_WILDCARDS,
278 /* OF1.1+(4,6). Unsupported field in the match. */
279 OFPERR_OFPBMC_BAD_FIELD,
281 /* NX1.0(1,258), OF1.1+(4,7). Unsupported value in a match
283 OFPERR_OFPBMC_BAD_VALUE,
285 /* NX1.0(1,259), NX1.1(1,259), OF1.2+(4,8). Unsupported mask specified in
286 * the match, field is not dl-address or nw-address. */
287 OFPERR_OFPBMC_BAD_MASK,
289 /* NX1.0(1,260), NX1.1(1,260), OF1.2+(4,9). A prerequisite was not met. */
290 OFPERR_OFPBMC_BAD_PREREQ,
292 /* NX1.0(1,261), NX1.1(1,261), OF1.2+(4,10). A field type was
294 OFPERR_OFPBMC_DUP_FIELD,
296 /* OF1.2+(4,11). Permissions error. */
299 /* ## --------------------- ## */
300 /* ## OFPET_FLOW_MOD_FAILED ## */
301 /* ## --------------------- ## */
303 /* OF1.1+(5,0). Unspecified error. */
304 OFPERR_OFPFMFC_UNKNOWN,
306 /* OF1.0(3,0), OF1.1+(5,1). Flow not added because of full table(s). */
307 OFPERR_OFPFMFC_TABLE_FULL,
309 /* OF1.1+(5,2). Table does not exist */
310 OFPERR_OFPFMFC_BAD_TABLE_ID,
312 /* OF1.0(3,1), OF1.1+(5,3). Attempted to add overlapping flow with
313 * CHECK_OVERLAP flag set. */
314 OFPERR_OFPFMFC_OVERLAP,
316 /* OF1.0(3,2), OF1.1+(5,4). Permissions error. */
317 OFPERR_OFPFMFC_EPERM,
319 /* OF1.1+(5,5). Flow not added because of unsupported idle/hard
321 OFPERR_OFPFMFC_BAD_TIMEOUT,
323 /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */
324 OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
326 /* OF1.0(3,4), OF1.1+(5,6). Unsupported or unknown command. */
327 OFPERR_OFPFMFC_BAD_COMMAND,
329 /* OF1.2+(5,7). Unsupported or unknown flags. */
330 OFPERR_OFPFMFC_BAD_FLAGS,
332 /* OF1.0(3,5). Unsupported action list - cannot process in the order
334 OFPERR_OFPFMFC_UNSUPPORTED,
336 /* NX1.0(3,256), NX1.1(5,256). Generic hardware error. */
337 OFPERR_NXFMFC_HARDWARE,
339 /* NX1.0(3,257), NX1.1(5,257). A nonexistent table ID was specified in the
340 * "command" field of struct ofp_flow_mod, when the nxt_flow_mod_table_id
341 * extension is enabled. */
342 OFPERR_NXFMFC_BAD_TABLE_ID,
344 /* ## ---------------------- ## */
345 /* ## OFPET_GROUP_MOD_FAILED ## */
346 /* ## ---------------------- ## */
348 /* OF1.1+(6,0). Group not added because a group ADD attempted to replace
349 * an already-present group. */
350 OFPERR_OFPGMFC_GROUP_EXISTS,
352 /* OF1.1+(6,1). Group not added because Group specified is invalid. */
353 OFPERR_OFPGMFC_INVALID_GROUP,
355 /* OF1.1+(6,2). Switch does not support unequal load sharing with select
357 OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
359 /* OF1.1+(6,3). The group table is full. */
360 OFPERR_OFPGMFC_OUT_OF_GROUPS,
362 /* OF1.1+(6,4). The maximum number of action buckets for a group has been
364 OFPERR_OFPGMFC_OUT_OF_BUCKETS,
366 /* OF1.1+(6,5). Switch does not support groups that forward to groups. */
367 OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
369 /* OF1.1+(6,6). This group cannot watch the watch_port or watch_group
371 OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
373 /* OF1.1+(6,7). Group entry would cause a loop. */
376 /* OF1.1+(6,8). Group not modified because a group MODIFY attempted to
377 * modify a non-existent group. */
378 OFPERR_OFPGMFC_UNKNOWN_GROUP,
380 /* OF1.2+(6,9). Group not deleted because another
381 group is forwarding to it. */
382 OFPERR_OFPGMFC_CHAINED_GROUP,
384 /* OF1.2+(6,10). Unsupported or unknown group type. */
385 OFPERR_OFPGMFC_BAD_TYPE,
387 /* OF1.2+(6,11). Unsupported or unknown command. */
388 OFPERR_OFPGMFC_BAD_COMMAND,
390 /* OF1.2+(6,12). Error in bucket. */
391 OFPERR_OFPGMFC_OFPGMFC_BAD_BUCKET,
393 /* OF1.2+(6,13). Error in watch port/group. */
394 OFPERR_OFPGMFC_OFPGMFC_BAD_WATCH,
396 /* OF1.2+(6,14). Permissions error. */
397 OFPERR_OFPGMFC_OFPGMFC_EPERM,
399 /* ## --------------------- ## */
400 /* ## OFPET_PORT_MOD_FAILED ## */
401 /* ## --------------------- ## */
403 /* OF1.0(4,0), OF1.1+(7,0). Specified port does not exist. */
404 OFPERR_OFPPMFC_BAD_PORT,
406 /* OF1.0(4,1), OF1.1+(7,1). Specified hardware address does not match the
408 OFPERR_OFPPMFC_BAD_HW_ADDR,
410 /* OF1.1+(7,2). Specified config is invalid. */
411 OFPERR_OFPPMFC_BAD_CONFIG,
413 /* OF1.1+(7,3). Specified advertise is invalid. */
414 OFPERR_OFPPMFC_BAD_ADVERTISE,
416 /* OF1.2+(7,4). Permissions error. */
417 OFPERR_OFPPMFC_EPERM,
419 /* ## ---------------------- ## */
420 /* ## OFPET_TABLE_MOD_FAILED ## */
421 /* ## ---------------------- ## */
423 /* OF1.1+(8,0). Specified table does not exist. */
424 OFPERR_OFPTMFC_BAD_TABLE,
426 /* OF1.1+(8,1). Specified config is invalid. */
427 OFPERR_OFPTMFC_BAD_CONFIG,
429 /* OF1.2+(8,2). Permissions error. */
430 OFPERR_OFPTMFC_EPERM,
432 /* ## --------------------- ## */
433 /* ## OFPET_QUEUE_OP_FAILED ## */
434 /* ## --------------------- ## */
436 /* OF1.0(5,0), OF1.1+(9,0). Invalid port (or port does not exist). */
437 OFPERR_OFPQOFC_BAD_PORT,
439 /* OF1.0(5,1), OF1.1+(9,1). Queue does not exist. */
440 OFPERR_OFPQOFC_BAD_QUEUE,
442 /* OF1.0(5,2), OF1.1+(9,2). Permissions error. */
443 OFPERR_OFPQOFC_EPERM,
445 /* ## -------------------------- ## */
446 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
447 /* ## -------------------------- ## */
449 /* OF1.1+(10,0). Specified flags is invalid. */
450 OFPERR_OFPSCFC_BAD_FLAGS,
452 /* OF1.1+(10,1). Specified len is invalid. */
453 OFPERR_OFPSCFC_BAD_LEN,
455 /* OF1.2+(10,2). Permissions error. */
456 OFPERR_OFPSCFC_EPERM,
458 /* ## ------------------------- ## */
459 /* ## OFPET_ROLE_REQUEST_FAILED ## */
460 /* ## ------------------------- ## */
462 /* OF1.2+(11,0). Stale Message: old generation_id. */
463 OFPERR_OFPRRFC_STALE,
465 /* OF1.2+(11,1). Controller role change unsupported. */
466 OFPERR_OFPRRFC_UNSUP,
468 /* NX1.0(1,513), NX1.1(1,513), OF1.2+(11,2). Invalid role. */
469 OFPERR_OFPRRFC_BAD_ROLE,
471 /* ## ---------------------- ## */
472 /* ## OFPET_METER_MOD_FAILED ## */
473 /* ## ---------------------- ## */
475 /* OF1.3+(12,0). Unspecified error. */
476 OFPERR_OFPMMFC_UNKNOWN,
478 /* OF1.3+(12,1). Meter not added because a Meter ADD attempted to
479 * replace an existing Meter. */
480 OFPERR_OFPMMFC_METER_EXISTS,
482 /* OF1.3+(12,2). Meter not added because Meter specified is invalid. */
483 OFPERR_OFPMMFC_INVALID_METER,
485 /* OF1.3+(12,3). Meter not modified because a Meter MODIFY attempted
486 * to modify a non-existent Meter. */
487 OFPERR_OFPMMFC_UNKNOWN_METER,
489 /* OF1.3+(12,4). Unsupported or unknown command. */
490 OFPERR_OFPMMFC_BAD_COMMAND,
492 /* OF1.3+(12,5). Flag configuration unsupported. */
493 OFPERR_OFPMMFC_BAD_FLAGS,
495 /* OF1.3+(12,6). Rate unsupported. */
496 OFPERR_OFPMMFC_BAD_RATE,
498 /* OF1.3+(12,7). Burst size unsupported. */
499 OFPERR_OFPMMFC_BAD_BURST,
501 /* OF1.3+(12,8). Band unsupported. */
502 OFPERR_OFPMMFC_BAD_BAND,
504 /* OF1.3+(12,9). Band value unsupported. */
505 OFPERR_OFPMMFC_BAD_BAND_VALUE,
507 /* OF1.3+(12,10). No more meters available. */
508 OFPERR_OFPMMFC_OUT_OF_METERS,
510 /* OF1.3+(12,11). The maximum number of properties for a meter has
512 OFPERR_OFPMMFC_OUT_OF_BANDS,
514 /* ## --------------------------- ## */
515 /* ## OFPET_TABLE_FEATURES_FAILED ## */
516 /* ## --------------------------- ## */
518 /* OF1.3+(13,0). Specified table does not exist. */
519 OFPERR_OFPTFFC_BAD_TABLE,
521 /* OF1.3+(13,1). Invalid metadata mask. */
522 OFPERR_OFPTFFC_BAD_METADATA,
524 /* OF1.3+(13,2). Unknown property type. */
525 OFPERR_OFPTFFC_BAD_TYPE,
527 /* OF1.3+(13,3). Length problem in properties. */
528 OFPERR_OFPTFFC_BAD_LEN,
530 /* OF1.3+(13,4). Unsupported property value. */
531 OFPERR_OFPTFFC_BAD_ARGUMENT,
533 /* OF1.3+(13,5). Permissions error. */
534 OFPERR_OFPTFFC_EPERM,
536 /* ## ------------------ ## */
537 /* ## OFPET_EXPERIMENTER ## */
538 /* ## ------------------ ## */
541 const char *ofperr_domain_get_name(enum ofp_version);
543 bool ofperr_is_valid(enum ofperr);
545 enum ofperr ofperr_decode(enum ofp_version, uint16_t type, uint16_t code);
546 enum ofperr ofperr_from_name(const char *);
548 enum ofperr ofperr_decode_msg(const struct ofp_header *,
549 struct ofpbuf *payload);
550 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
551 struct ofpbuf *ofperr_encode_hello(enum ofperr, enum ofp_version ofp_version,
553 int ofperr_get_type(enum ofperr, enum ofp_version);
554 int ofperr_get_code(enum ofperr, enum ofp_version);
556 const char *ofperr_get_name(enum ofperr);
557 const char *ofperr_get_description(enum ofperr);
559 void ofperr_format(struct ds *, enum ofperr);
560 const char *ofperr_to_string(enum ofperr);
562 #endif /* ofp-errors.h */