nat: fixed return values of enable/disable call
[vpp.git] / src / vnet / error.h
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright(c) 2022 Cisco Systems, Inc.
3  */
4 #ifndef included_vnet_error_h
5 #define included_vnet_error_h
6
7 #include <stdarg.h>
8 #include <vppinfra/types.h>
9 #include <vppinfra/format.h>
10
11 #define foreach_vnet_error                                                    \
12   _ (UNSPECIFIED, -1, "Unspecified Error")                                    \
13   _ (INVALID_SW_IF_INDEX, -2, "Invalid sw_if_index")                          \
14   _ (NO_SUCH_FIB, -3, "No such FIB / VRF")                                    \
15   _ (NO_SUCH_INNER_FIB, -4, "No such inner FIB / VRF")                        \
16   _ (NO_SUCH_LABEL, -5, "No such label")                                      \
17   _ (NO_SUCH_ENTRY, -6, "No such entry")                                      \
18   _ (INVALID_VALUE, -7, "Invalid value")                                      \
19   _ (INVALID_VALUE_2, -8, "Invalid value #2")                                 \
20   _ (UNIMPLEMENTED, -9, "Unimplemented")                                      \
21   _ (INVALID_SW_IF_INDEX_2, -10, "Invalid sw_if_index #2")                    \
22   _ (SYSCALL_ERROR_1, -11, "System call error #1")                            \
23   _ (SYSCALL_ERROR_2, -12, "System call error #2")                            \
24   _ (SYSCALL_ERROR_3, -13, "System call error #3")                            \
25   _ (SYSCALL_ERROR_4, -14, "System call error #4")                            \
26   _ (SYSCALL_ERROR_5, -15, "System call error #5")                            \
27   _ (SYSCALL_ERROR_6, -16, "System call error #6")                            \
28   _ (SYSCALL_ERROR_7, -17, "System call error #7")                            \
29   _ (SYSCALL_ERROR_8, -18, "System call error #8")                            \
30   _ (SYSCALL_ERROR_9, -19, "System call error #9")                            \
31   _ (SYSCALL_ERROR_10, -20, "System call error #10")                          \
32   _ (FEATURE_DISABLED, -30, "Feature disabled by configuration")              \
33   _ (INVALID_REGISTRATION, -31, "Invalid registration")                       \
34   _ (NEXT_HOP_NOT_IN_FIB, -50, "Next hop not in FIB")                         \
35   _ (UNKNOWN_DESTINATION, -51, "Unknown destination")                         \
36   _ (NO_PATHS_IN_ROUTE, -52, "No paths specified in route")                   \
37   _ (NEXT_HOP_NOT_FOUND_MP, -53, "Next hop not found (multipath)")            \
38   _ (NO_MATCHING_INTERFACE, -54, "No matching interface for probe")           \
39   _ (INVALID_VLAN, -55, "Invalid VLAN")                                       \
40   _ (VLAN_ALREADY_EXISTS, -56, "VLAN subif already exists")                   \
41   _ (INVALID_SRC_ADDRESS, -57, "Invalid src address")                         \
42   _ (INVALID_DST_ADDRESS, -58, "Invalid dst address")                         \
43   _ (ADDRESS_LENGTH_MISMATCH, -59, "Address length mismatch")                 \
44   _ (ADDRESS_NOT_FOUND_FOR_INTERFACE, -60, "Address not found for interface") \
45   _ (ADDRESS_NOT_DELETABLE, -61, "Address not deletable")                     \
46   _ (IP6_NOT_ENABLED, -62, "ip6 not enabled")                                 \
47   _ (NO_SUCH_NODE, -63, "No such graph node")                                 \
48   _ (NO_SUCH_NODE2, -64, "No such graph node #2")                             \
49   _ (NO_SUCH_TABLE, -65, "No such table")                                     \
50   _ (NO_SUCH_TABLE2, -66, "No such table #2")                                 \
51   _ (NO_SUCH_TABLE3, -67, "No such table #3")                                 \
52   _ (SUBIF_ALREADY_EXISTS, -68, "Subinterface already exists")                \
53   _ (SUBIF_CREATE_FAILED, -69, "Subinterface creation failed")                \
54   _ (INVALID_MEMORY_SIZE, -70, "Invalid memory size requested")               \
55   _ (INVALID_INTERFACE, -71, "Invalid interface")                             \
56   _ (INVALID_VLAN_TAG_COUNT, -72,                                             \
57      "Invalid number of tags for requested operation")                        \
58   _ (INVALID_ARGUMENT, -73, "Invalid argument")                               \
59   _ (UNEXPECTED_INTF_STATE, -74, "Unexpected interface state")                \
60   _ (TUNNEL_EXIST, -75, "Tunnel already exists")                              \
61   _ (INVALID_DECAP_NEXT, -76, "Invalid decap-next")                           \
62   _ (RESPONSE_NOT_READY, -77, "Response not ready")                           \
63   _ (NOT_CONNECTED, -78, "Not connected to the data plane")                   \
64   _ (IF_ALREADY_EXISTS, -79, "Interface already exists")                      \
65   _ (BOND_SLAVE_NOT_ALLOWED, -80,                                             \
66      "Operation not allowed on slave of BondEthernet")                        \
67   _ (VALUE_EXIST, -81, "Value already exists")                                \
68   _ (SAME_SRC_DST, -82, "Source and destination are the same")                \
69   _ (IP6_MULTICAST_ADDRESS_NOT_PRESENT, -83,                                  \
70      "IP6 multicast address required")                                        \
71   _ (SR_POLICY_NAME_NOT_PRESENT, -84, "Segment routing policy name required") \
72   _ (NOT_RUNNING_AS_ROOT, -85, "Not running as root")                         \
73   _ (ALREADY_CONNECTED, -86, "Connection to the data plane already exists")   \
74   _ (UNSUPPORTED_JNI_VERSION, -87, "Unsupported JNI version")                 \
75   _ (IP_PREFIX_INVALID, -88, "IP prefix invalid (masked bits set in address") \
76   _ (INVALID_WORKER, -89, "Invalid worker thread")                            \
77   _ (LISP_DISABLED, -90, "LISP is disabled")                                  \
78   _ (CLASSIFY_TABLE_NOT_FOUND, -91, "Classify table not found")               \
79   _ (INVALID_EID_TYPE, -92, "Unsupported LISP EID type")                      \
80   _ (CANNOT_CREATE_PCAP_FILE, -93, "Cannot create pcap file")                 \
81   _ (INCORRECT_ADJACENCY_TYPE, -94,                                           \
82      "Invalid adjacency type for this operation")                             \
83   _ (EXCEEDED_NUMBER_OF_RANGES_CAPACITY, -95,                                 \
84      "Operation would exceed configured capacity of ranges")                  \
85   _ (EXCEEDED_NUMBER_OF_PORTS_CAPACITY, -96,                                  \
86      "Operation would exceed capacity of number of ports")                    \
87   _ (INVALID_ADDRESS_FAMILY, -97, "Invalid address family")                   \
88   _ (INVALID_SUB_SW_IF_INDEX, -98, "Invalid sub-interface sw_if_index")       \
89   _ (TABLE_TOO_BIG, -99, "Table too big")                                     \
90   _ (CANNOT_ENABLE_DISABLE_FEATURE, -100, "Cannot enable/disable feature")    \
91   _ (BFD_EEXIST, -101, "Duplicate BFD object")                                \
92   _ (BFD_ENOENT, -102, "No such BFD object")                                  \
93   _ (BFD_EINUSE, -103, "BFD object in use")                                   \
94   _ (BFD_NOTSUPP, -104, "BFD feature not supported")                          \
95   _ (ADDRESS_IN_USE, -105, "Address in use")                                  \
96   _ (ADDRESS_NOT_IN_USE, -106, "Address not in use")                          \
97   _ (QUEUE_FULL, -107, "Queue full")                                          \
98   _ (APP_UNSUPPORTED_CFG, -108, "Unsupported application config")             \
99   _ (URI_FIFO_CREATE_FAILED, -109, "URI FIFO segment create failed")          \
100   _ (LISP_RLOC_LOCAL, -110, "RLOC address is local")                          \
101   _ (BFD_EAGAIN, -111, "BFD object cannot be manipulated at this time")       \
102   _ (INVALID_GPE_MODE, -112, "Invalid GPE mode")                              \
103   _ (LISP_GPE_ENTRIES_PRESENT, -113, "LISP GPE entries are present")          \
104   _ (ADDRESS_FOUND_FOR_INTERFACE, -114, "Address found for interface")        \
105   _ (SESSION_CONNECT, -115, "Session failed to connect")                      \
106   _ (ENTRY_ALREADY_EXISTS, -116, "Entry already exists")                      \
107   _ (SVM_SEGMENT_CREATE_FAIL, -117, "Svm segment create fail")                \
108   _ (APPLICATION_NOT_ATTACHED, -118, "Application not attached")              \
109   _ (BD_ALREADY_EXISTS, -119, "Bridge domain already exists")                 \
110   _ (BD_IN_USE, -120, "Bridge domain has member interfaces")                  \
111   _ (BD_NOT_MODIFIABLE, -121, "Bridge domain 0 can't be deleted/modified")    \
112   _ (BD_ID_EXCEED_MAX, -122, "Bridge domain ID exceeds 16M limit")            \
113   _ (SUBIF_DOESNT_EXIST, -123, "Subinterface doesn't exist")                  \
114   _ (L2_MACS_EVENT_CLINET_PRESENT, -124,                                      \
115      "Client already exist for L2 MACs events")                               \
116   _ (INVALID_QUEUE, -125, "Invalid queue")                                    \
117   _ (UNSUPPORTED, -126, "Unsupported")                                        \
118   _ (DUPLICATE_IF_ADDRESS, -127,                                              \
119      "Address already present on another interface")                          \
120   _ (APP_INVALID_NS, -128, "Invalid application namespace")                   \
121   _ (APP_WRONG_NS_SECRET, -129, "Wrong app namespace secret")                 \
122   _ (APP_CONNECT_SCOPE, -130, "Connect scope")                                \
123   _ (APP_ALREADY_ATTACHED, -131, "App already attached")                      \
124   _ (SESSION_REDIRECT, -132, "Redirect failed")                               \
125   _ (ILLEGAL_NAME, -133, "Illegal name")                                      \
126   _ (NO_NAME_SERVERS, -134, "No name servers configured")                     \
127   _ (NAME_SERVER_NOT_FOUND, -135, "Name server not found")                    \
128   _ (NAME_RESOLUTION_NOT_ENABLED, -136, "Name resolution not enabled")        \
129   _ (NAME_SERVER_FORMAT_ERROR, -137, "Server format error (bug!)")            \
130   _ (NAME_SERVER_NO_SUCH_NAME, -138, "No such name")                          \
131   _ (NAME_SERVER_NO_ADDRESSES, -139, "No addresses available")                \
132   _ (NAME_SERVER_NEXT_SERVER, -140, "Retry with new server")                  \
133   _ (APP_CONNECT_FILTERED, -141, "Connect was filtered")                      \
134   _ (ACL_IN_USE_INBOUND, -142, "Inbound ACL in use")                          \
135   _ (ACL_IN_USE_OUTBOUND, -143, "Outbound ACL in use")                        \
136   _ (INIT_FAILED, -144, "Initialization Failed")                              \
137   _ (NETLINK_ERROR, -145, "Netlink error")                                    \
138   _ (BIER_BSL_UNSUP, -146, "BIER bit-string-length unsupported")              \
139   _ (INSTANCE_IN_USE, -147, "Instance in use")                                \
140   _ (INVALID_SESSION_ID, -148, "Session ID out of range")                     \
141   _ (ACL_IN_USE_BY_LOOKUP_CONTEXT, -149, "ACL in use by a lookup context")    \
142   _ (INVALID_VALUE_3, -150, "Invalid value #3")                               \
143   _ (NON_ETHERNET, -151, "Interface is not an Ethernet interface")            \
144   _ (BD_ALREADY_HAS_BVI, -152, "Bridge domain already has a BVI interface")   \
145   _ (INVALID_PROTOCOL, -153, "Invalid Protocol")                              \
146   _ (INVALID_ALGORITHM, -154, "Invalid Algorithm")                            \
147   _ (RSRC_IN_USE, -155, "Resource In Use")                                    \
148   _ (KEY_LENGTH, -156, "invalid Key Length")                                  \
149   _ (FIB_PATH_UNSUPPORTED_NH_PROTO, -157, "Unsupported FIB Path protocol")    \
150   _ (API_ENDIAN_FAILED, -159, "Endian mismatch detected")                     \
151   _ (NO_CHANGE, -160, "No change in table")                                   \
152   _ (MISSING_CERT_KEY, -161, "Missing certifcate or key")                     \
153   _ (LIMIT_EXCEEDED, -162, "limit exceeded")                                  \
154   _ (IKE_NO_PORT, -163, "port not managed by IKE")                            \
155   _ (UDP_PORT_TAKEN, -164, "UDP port already taken")                          \
156   _ (EAGAIN, -165, "Retry stream call with cursor")                           \
157   _ (INVALID_VALUE_4, -166, "Invalid value #4")                               \
158   _ (BUSY, -167, "Busy")                                                      \
159   _ (BUG, -168, "Bug")                                                        \
160   _ (FEATURE_ALREADY_DISABLED, -169, "Feature already disabled")              \
161   _ (FEATURE_ALREADY_ENABLED, -170, "Feature already enabled")
162
163 typedef enum
164 {
165 #define _(a, b, c) VNET_ERR_##a = (b),
166   foreach_vnet_error
167 #undef _
168     VNET_N_ERROR,
169 } vnet_error_t;
170
171 clib_error_t __clib_warn_unused_result *vnet_error (vnet_error_t code,
172                                                     char *fmt, ...);
173
174 format_function_t format_vnet_api_errno;
175
176 #endif