]> git.proxmox.com Git - mirror_frr.git/blob - lib/lib_errors.c
lib: Convert stream.c to use new error code subsystem
[mirror_frr.git] / lib / lib_errors.c
1 /*
2 * Library-specific error messages.
3 * Copyright (C) 2018 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "lib_errors.h"
22
23 /* clang-format off */
24 static struct log_ref ferr_lib_warn[] = {
25 {
26 .code = LIB_WARN_SNMP,
27 .title = "SNMP has discovered a warning",
28 .description = "The SNMP AgentX library has returned a warning that we should report to the end user",
29 .suggestion = "Gather Log data and open an Issue.",
30 },
31 {
32 .code = LIB_WARN_STREAM,
33 .title = "The stream subsystem has encountered an error",
34 .description = "During sanity checking stream.c has detected an error in the data associated with a particular stream",
35 .suggestion = "Gather log data and open an Issue, restart FRR",
36 },
37 {
38 .code = END_FERR,
39 },
40 };
41
42 static struct log_ref ferr_lib_err[] = {
43 {
44 .code = LIB_ERR_PRIVILEGES,
45 .title = "Failure to raise or lower privileges",
46 .description = "FRR attempted to raise or lower its privileges and was unable to do so",
47 .suggestion = "Ensure that you are running FRR as the frr user and that the user has sufficient privileges to properly access root privileges"
48 },
49 {
50 .code = LIB_ERR_VRF_START,
51 .title = "VRF Failure on Start",
52 .description = "Upon startup FRR failed to properly initialize and startup the VRF subsystem",
53 .suggestion = "Ensure that there is sufficient memory to start processes and restart FRR",
54 },
55 {
56 .code = LIB_ERR_SOCKET,
57 .title = "Socket Error",
58 .description = "When attempting to access a socket a system error has occured and we were unable to properly complete the request",
59 .suggestion = "Ensure that there are sufficient system resources available and ensure that the frr user has sufficient permisions to work. If necessary open an Issue",
60 },
61 {
62 .code = LIB_ERR_ZAPI_MISSMATCH,
63 .title = "ZAPI Error",
64 .description = "A version miss-match has been detected between zebra and client protocol",
65 .suggestion = "Two different versions of FRR have been installed and the install is not properly setup. Completely stop FRR, remove it from the system and reinstall. Typically only developers should see this issue."
66 },
67 {
68 .code = LIB_ERR_ZAPI_ENCODE,
69 .title = "ZAPI Error",
70 .description = "The ZAPI subsystem has detected an encoding issue, between zebra and a client protocol",
71 .suggestion = "Gather data and open an Issue, also Restart FRR"
72 },
73 {
74 .code = LIB_ERR_ZAPI_SOCKET,
75 .title = "ZAPI Error",
76 .description = "The ZAPI subsystem has detected a socket error between zebra and a client",
77 .suggestion = "Restart FRR"
78 },
79 {
80 .code = LIB_ERR_SYSTEM_CALL,
81 .title = "System Call Error",
82 .description = "FRR has detected a error from using a vital system call and has probably already exited",
83 .suggestion = "Ensure permissions are correct for FRR files, users and groups are correct. Additionally check that sufficient system resources are available."
84 },
85 {
86 .code = LIB_ERR_VTY,
87 .title = "VTY Subsystem Error",
88 .description = "FRR has detected a problem with the specified configuration file",
89 .suggestion = "Ensure configuration file exists and has correct permissions for operations Additionally ensure that all config lines are correct as well",
90 },
91 {
92 .code = LIB_ERR_SNMP,
93 .title = "SNMP Subsystem Error",
94 .description = "FRR has detected a problem with the snmp library it uses A callback from this subsystem has indicated some error",
95 .suggestion = "Examine callback message and ensure snmp is properly setup and working"
96 },
97 {
98 .code = LIB_ERR_INTERFACE,
99 .title = "Interface Subsystem Error",
100 .description = "FRR has detected a problem with interface data from the kernel as it deviates from what we would expect to happen via normal netlink messaging",
101 .suggestion = "Open an Issue with all relevant log files and restart FRR"
102 },
103 {
104 .code = LIB_ERR_NS,
105 .title = "NameSpace Subsystem Error",
106 .description = "FRR has detected a problem with NameSpace data from the kernel as it deviates from what we would expect to happen via normal kernel messaging",
107 .suggestion = "Open an Issue with all relevant log files and restart FRR"
108 },
109 {
110 .code = LIB_ERR_DEVELOPMENT,
111 .title = "Developmental Escape Error",
112 .description = "FRR has detected an issue where new development has not properly updated all code paths.",
113 .suggestion = "Open an Issue with all relevant log files"
114 },
115 {
116 .code = LIB_ERR_ZMQ,
117 .title = "ZMQ Subsystem Error",
118 .description = "FRR has detected an issue with the Zero MQ subsystem and ZeroMQ is not working properly now",
119 .suggestion = "Open an Issue with all relevant log files and restart FRR"
120 },
121 {
122 .code = LIB_ERR_UNAVAILABLE,
123 .title = "Feature or system unavailable",
124 .description = "FRR was not compiled with support for a particular feature, or it is not available on the current platform",
125 .suggestion = "Recompile FRR with the feature enabled, or find out what platforms support the feature"
126 },
127 {
128 .code = END_FERR,
129 }
130 };
131 /* clang-format on */
132
133 void lib_error_init(void)
134 {
135 log_ref_add(ferr_lib_warn);
136 log_ref_add(ferr_lib_err);
137 }