1 /*
2  * OSPF-specific error messages.
3  * Copyright (C) 2018 Cumulus Networks, Inc.
4  *		Chirag Shah
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 <zebra.h>
22 
23 #include "lib/ferr.h"
24 #include "ospf_errors.h"
25 
26 /* clang-format off */
27 static struct log_ref ferr_ospf_warn[] = {
28 	{
29 		.code = EC_OSPF_SET_METRIC_PLUS,
30 		.title = "OSPF does not support `set metric +rtt/-rtt`",
31 		.description = "This implementation of OSPF does not currently support `set metric +rtt/-rtt`",
32 		.suggestion = "Do not use this particular set command for an ospf route-map",
33 	},
34 	{
35 		.code = EC_OSPF_MD5,
36 		.title = "OSPF has noticed a MD5 issue",
37 		.description = "Something has gone wrong with the calculation of the MD5 data",
38 		.suggestion = "Ensure your key is correct, gather log data from this side as well as peer and open an Issue",
39 	},
40 	{
41 		.code = EC_OSPF_PACKET,
42 		.title = "OSPF has detected packet information mismatch",
43 		.description = "OSPF has detected that packet information received is incorrect",
44 		.suggestion = "Ensure interface configuration is correct, gather log files from here and the peer and open an Issue",
45 	},
46 	{
47 		.code = EC_OSPF_LARGE_LSA,
48 		.title = "OSPF has determined that a LSA packet will be too large",
49 		.description = "OSPF has received data that is causing it to recalculate how large packets should be and has discovered that the packet size needed would be too large and we will need to fragment packets",
50 		.suggestion = "Further divide up your network with areas",
51 	},
52 	{
53 		.code = EC_OSPF_LSA_UNEXPECTED,
54 		.title = "OSPF has received a LSA-type that it was not expecting",
55 		.description = "OSPF has received a LSA-type that it was not expecting during processing",
56 		.suggestion = "Gather log data from this machine and it's peer and open an Issue",
57 	},
58 	{
59 		.code = EC_OSPF_LSA,
60 		.title = "OSPF has discovered inconsistent internal state for a LSA",
61 		.description = "During handling of a LSA, OSPF has discovered that the LSA's internal state is inconsistent",
62 		.suggestion = "Gather log data and open an Issue",
63 	},
64 	{
65 		.code = EC_OSPF_OPAQUE_REGISTRATION,
66 		.title = "OSPF has failed to properly register Opaque Handler",
67 		.description = "During initialization OSPF has detected a failure to install an opaque handler",
68 		.suggestion = "Gather log data and open an Issue",
69 	},
70 	{
71 		.code = EC_OSPF_TE_UNEXPECTED,
72 		.title = "OSPF has received TE information that it was not expecting",
73 		.description = "OSPF has received TE information that it was not expecting during normal processing of data",
74 		.suggestion = "Gather log data from this machine and it's peer and open an Issue",
75 	},
76 	{
77 		.code = EC_OSPF_LSA_INSTALL_FAILURE,
78 		.title = "OSPF was unable to save the LSA into it's database",
79 		.description = "During processing of a new lsa and attempting to save the lsa into the OSPF database, this process failed.",
80 		.suggestion = "Gather log data from this machine and open an Issue",
81 	},
82 	{
83 		.code = EC_OSPF_LSA_NULL,
84 		.title = "OSPF has received a NULL lsa pointer",
85 		.description = "When processing a LSA update we have found and noticed an internal error where we are passing around a NULL pointer",
86 		.suggestion = "Gather data from this machine and it's peer and open an Issue",
87 	},
88 	{
89 		.code = EC_OSPF_EXT_LSA_UNEXPECTED,
90 		.title = "OSPF has received EXT information that leaves it in an unexpected state",
91 		.description = "While processing EXT LSA information, OSPF has noticed that the internal state of OSPF has gotten inconsistent",
92 		.suggestion = "Gather data from this machine and it's peer and open an Issue",
93 	},
94 	{
95 		.code = EC_OSPF_LSA_MISSING,
96 		.title = "OSPF attempted to look up a LSA and it was not found",
97 		.description = "During processing of new LSA information, we attempted to look up an old LSA and it was not found",
98 		.suggestion = "Gather data from this machine and open an Issue",
99 	},
100 	{
101 		.code = EC_OSPF_PTP_NEIGHBOR,
102 		.title = "OSPF has detected more than 1 neighbor on a P2P interface",
103 		.description = "If you configure a ospf interface as P2P we should not detect more than one neighbor on the interface",
104 		.suggestion = "Fix your config",
105 	},
106 	{
107 		.code = EC_OSPF_LSA_SIZE,
108 		.title = "OSPF has detected an invalid LSA size",
109 		.description = "OSPF has detected a state where we are attempting to grow a LSA but the LSA has reached it's maximum size",
110 		.suggestion = "Gather data and open an Issue",
111 	},
112 	{
113 		.code = END_FERR,
114 	}
115 };
116 
117 static struct log_ref ferr_ospf_err[] = {
118 	{
119 		.code = EC_OSPF_PKT_PROCESS,
120 		.title = "Failure to process a packet",
121 		.description = "OSPF attempted to process a received packet but could not",
122 		.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
123 	},
124 	{
125 		.code = EC_OSPF_ROUTER_LSA_MISMATCH,
126 		.title = "Failure to process Router LSA",
127 		.description = "OSPF attempted to process a Router LSA but Advertising ID mismatch with link id",
128 		.suggestion = "Check OSPF network config for any config issue, If the problem persists, report the problem for troubleshooting"
129 	},
130 	{
131 		.code = EC_OSPF_DOMAIN_CORRUPT,
132 		.title = "OSPF Domain Corruption",
133 		.description = "OSPF attempted to process a Router LSA but Advertising ID mismatch with link id",
134 		.suggestion = "Check OSPF network Database for corrupted LSA, If the problem persists, shutdown OSPF domain and report the problem for troubleshooting"
135 	},
136 	{
137 		.code = EC_OSPF_INIT_FAIL,
138 		.title = "OSPF Initialization failure",
139 		.description = "OSPF failed to initialized OSPF default insance",
140 		.suggestion = "Ensure there is adequate memory on the device. If the problem persists, report the problem for troubleshooting"
141 	},
142 	{
143 		.code = EC_OSPF_SR_INVALID_DB,
144 		.title = "OSPF SR Invalid DB",
145 		.description = "OSPF Segment Routing Database is invalid",
146 		.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
147 	},
148 	{
149 		.code = EC_OSPF_SR_NODE_CREATE,
150 		.title = "OSPF SR hash node creation failed",
151 		.description = "OSPF Segment Routing node creation failed",
152 		.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
153 	},
154 	{
155 		.code = EC_OSPF_SR_INVALID_LSA_ID,
156 		.title = "OSPF SR Invalid LSA ID",
157 		.description = "OSPF Segment Routing invalid lsa id",
158 		.suggestion = "Restart OSPF instance, If the problem persists, report the problem for troubleshooting"
159 	},
160 	{
161 		.code = EC_OSPF_SR_SID_OVERFLOW,
162 		.title = "OSPF SR Segment-ID overflow",
163 		.description = "OSPF Segment Routing ID index or label exceed Global or Local Block Range",
164 		.suggestion = "Restart OSPF instance, If the problem persists, report the problem for troubleshooting"
165 	},
166 	{
167 		.code = EC_OSPF_INVALID_ALGORITHM,
168 		.title = "OSPF SR Invalid Algorithm",
169 		.description = "OSPF Segment Routing invalid Algorithm",
170 		.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
171 	},
172 	{
173 		.code = EC_OSPF_FSM_INVALID_STATE,
174 		.title = "OSPF FSM invalid state detected",
175 		.description = "OSPF has attempted to change states when it should not be able to",
176 		.suggestion = "Gather log files and open an issue",
177 	},
178 	{
179 		.code = EC_OSPF_LARGE_HELLO,
180 		.title = "OSPF Encountered a Large Hello",
181 		.description = "OSPF attempted to send a Hello larger than MTU but did not",
182 		.suggestion = "Too many neighbors configured on a single interface. Suggestion is to decrease the number of neighbors on a single interface/subnet"
183 	},
184 	{
185 		.code = END_FERR,
186 	}
187 };
188 /* clang-format on */
189 
ospf_error_init(void)190 void ospf_error_init(void)
191 {
192 	log_ref_add(ferr_ospf_warn);
193 	log_ref_add(ferr_ospf_err);
194 }
195