summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-02-15 21:53:30 +0100
committerDonald Sharp <sharpd@nvidia.com>2022-02-15 22:38:32 +0100
commit4b7e23e9f2822def568cc9dd1a942d9d36cbb3a5 (patch)
tree58508a1d91e82503d57f4a6693c0db2840f6a44e /bgpd/bgpd.h
parentbgpd: Remove unused BGP_ERR_MAX #define (diff)
downloadfrr-4b7e23e9f2822def568cc9dd1a942d9d36cbb3a5.tar.xz
frr-4b7e23e9f2822def568cc9dd1a942d9d36cbb3a5.zip
bgpd: Convert bgp error codes for cli input to an enum
Conversion of bgp error codes returned for cli input into an enum and then properly handling all the error cases in bgp_vty_return. Because not all error codes returned were properly handled in this function there existed configuration examples that were accepted on the cli without an error message but not saved. Fixes: #10589 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgpd.h78
1 files changed, 40 insertions, 38 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index b2fc3ed54..f3023507f 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1916,44 +1916,46 @@ enum bgp_clear_type {
(((S) == OpenSent) || ((S) == OpenConfirm) || ((S) == Established))
/* BGP error codes. */
-#define BGP_SUCCESS 0
-#define BGP_CREATED 1
-#define BGP_ERR_INVALID_VALUE -1
-#define BGP_ERR_INVALID_FLAG -2
-#define BGP_ERR_INVALID_AS -3
-#define BGP_ERR_PEER_GROUP_MEMBER -5
-#define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -7
-#define BGP_ERR_PEER_GROUP_CANT_CHANGE -8
-#define BGP_ERR_PEER_GROUP_MISMATCH -9
-#define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -10
-#define BGP_ERR_AS_MISMATCH -12
-#define BGP_ERR_PEER_FLAG_CONFLICT -13
-#define BGP_ERR_PEER_GROUP_SHUTDOWN -14
-#define BGP_ERR_PEER_FILTER_CONFLICT -15
-#define BGP_ERR_NOT_INTERNAL_PEER -16
-#define BGP_ERR_REMOVE_PRIVATE_AS -17
-#define BGP_ERR_AF_UNCONFIGURED -18
-#define BGP_ERR_SOFT_RECONFIG_UNCONFIGURED -19
-#define BGP_ERR_INSTANCE_MISMATCH -20
-#define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -21
-#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -22
-#define BGP_ERR_TCPSIG_FAILED -23
-#define BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK -24
-#define BGP_ERR_NO_IBGP_WITH_TTLHACK -25
-#define BGP_ERR_NO_INTERFACE_CONFIG -26
-#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS -27
-#define BGP_ERR_AS_OVERRIDE -28
-#define BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT -29
-#define BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS -30
-#define BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND -31
-#define BGP_ERR_INVALID_FOR_DYNAMIC_PEER -32
-#define BGP_ERR_INVALID_FOR_DIRECT_PEER -34
-#define BGP_ERR_PEER_SAFI_CONFLICT -35
-
-/* BGP GR ERRORS */
-#define BGP_ERR_GR_INVALID_CMD -36
-#define BGP_ERR_GR_OPERATION_FAILED -37
-#define BGP_GR_NO_OPERATION -38
+enum bgp_create_error_code {
+ BGP_SUCCESS = 0,
+ BGP_CREATED = 1,
+ BGP_ERR_INVALID_VALUE = -1,
+ BGP_ERR_INVALID_FLAG = -2,
+ BGP_ERR_INVALID_AS = -3,
+ BGP_ERR_PEER_GROUP_MEMBER = -5,
+ BGP_ERR_PEER_GROUP_NO_REMOTE_AS = -7,
+ BGP_ERR_PEER_GROUP_CANT_CHANGE = -8,
+ BGP_ERR_PEER_GROUP_MISMATCH = -9,
+ BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT = -10,
+ BGP_ERR_AS_MISMATCH = -12,
+ BGP_ERR_PEER_FLAG_CONFLICT = -13,
+ BGP_ERR_PEER_GROUP_SHUTDOWN = -14,
+ BGP_ERR_PEER_FILTER_CONFLICT = -15,
+ BGP_ERR_NOT_INTERNAL_PEER = -16,
+ BGP_ERR_REMOVE_PRIVATE_AS = -17,
+ BGP_ERR_AF_UNCONFIGURED = -18,
+ BGP_ERR_SOFT_RECONFIG_UNCONFIGURED = -19,
+ BGP_ERR_INSTANCE_MISMATCH = -20,
+ BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP = -21,
+ BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS = -22,
+ BGP_ERR_TCPSIG_FAILED = -23,
+ BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK = -24,
+ BGP_ERR_NO_IBGP_WITH_TTLHACK = -25,
+ BGP_ERR_NO_INTERFACE_CONFIG = -26,
+ BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS = -27,
+ BGP_ERR_AS_OVERRIDE = -28,
+ BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT = -29,
+ BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS = -30,
+ BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND = -31,
+ BGP_ERR_INVALID_FOR_DYNAMIC_PEER = -32,
+ BGP_ERR_INVALID_FOR_DIRECT_PEER = -34,
+ BGP_ERR_PEER_SAFI_CONFLICT = -35,
+
+ /* BGP GR ERRORS */
+ BGP_ERR_GR_INVALID_CMD = -36,
+ BGP_ERR_GR_OPERATION_FAILED = -37,
+ BGP_GR_NO_OPERATION = -38,
+};
/*
* Enumeration of different policy kinds a peer can be configured with.