summaryrefslogtreecommitdiffstats
path: root/eigrpd
diff options
context:
space:
mode:
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_errors.c48
-rw-r--r--eigrpd/eigrp_errors.h33
-rw-r--r--eigrpd/eigrp_hello.c6
-rw-r--r--eigrpd/eigrp_main.c2
-rw-r--r--eigrpd/eigrp_neighbor.c4
-rw-r--r--eigrpd/eigrp_network.c5
-rw-r--r--eigrpd/eigrp_packet.c9
-rw-r--r--eigrpd/eigrp_reply.c9
-rw-r--r--eigrpd/eigrpd.c6
-rw-r--r--eigrpd/subdir.am2
10 files changed, 109 insertions, 15 deletions
diff --git a/eigrpd/eigrp_errors.c b/eigrpd/eigrp_errors.c
new file mode 100644
index 000000000..23a2af005
--- /dev/null
+++ b/eigrpd/eigrp_errors.c
@@ -0,0 +1,48 @@
+/*
+ * eigrp_errors - code for error messages that may occur in the
+ * eigrp process
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * FRR is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * FRR is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <zebra.h>
+
+#include "eigrp_errors.h"
+
+static struct ferr_ref ferr_eigrp_err[] = {
+ {
+ .code = EIGRP_ERR_PACKET,
+ .title = "EIGRP Packet Error",
+ .description = "EIGRP has a packet that does not correctly decode or encode",
+ .suggestion = "Gather log files from both sides of the neighbor relationship and open an issue"
+ },
+ {
+ .code = EIGRP_ERR_CONFIG,
+ .title = "EIGRP Configuration Error",
+ .description = "EIGRP has detected a configuration error",
+ .suggestion = "Correct the configuration issue, if it still persists open an Issue"
+ },
+ {
+ .code = END_FERR,
+ }
+};
+
+void eigrp_error_init(void)
+{
+ ferr_ref_init();
+
+ ferr_ref_add(ferr_eigrp_err);
+}
diff --git a/eigrpd/eigrp_errors.h b/eigrpd/eigrp_errors.h
new file mode 100644
index 000000000..c314ddc46
--- /dev/null
+++ b/eigrpd/eigrp_errors.h
@@ -0,0 +1,33 @@
+/*
+ * eigrp_errors - header for error messages that may occur in the eigrp process
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * FRR is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * FRR is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef __EIGRP_ERRORS_H__
+#define __EIGRP_ERRORS_H__
+
+#include "ferr.h"
+#include "eigrp_errors.h"
+
+enum eigrp_ferr_refs {
+ EIGRP_ERR_PACKET = EIGRP_FERR_START,
+ EIGRP_ERR_CONFIG,
+};
+
+extern void eigrp_error_init(void);
+
+#endif
diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c
index 2e55d57c3..f3c3cdef0 100644
--- a/eigrpd/eigrp_hello.c
+++ b/eigrpd/eigrp_hello.c
@@ -54,6 +54,7 @@
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_macros.h"
+#include "eigrpd/eigrp_errors.h"
/* Packet Type String. */
static const struct message eigrp_general_tlv_type_str[] = {
@@ -420,8 +421,9 @@ void eigrp_sw_version_initialize(void)
ret = sscanf(ver_string, "%" SCNu32 ".%" SCNu32, &FRR_MAJOR,
&FRR_MINOR);
if (ret != 2)
- zlog_err("Did not Properly parse %s, please fix VERSION string",
- VERSION);
+ zlog_ferr(EIGRP_ERR_PACKET,
+ "Did not Properly parse %s, please fix VERSION string",
+ VERSION);
}
/**
diff --git a/eigrpd/eigrp_main.c b/eigrpd/eigrp_main.c
index c4ca07178..31101a52d 100644
--- a/eigrpd/eigrp_main.c
+++ b/eigrpd/eigrp_main.c
@@ -64,6 +64,7 @@
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_snmp.h"
#include "eigrpd/eigrp_filter.h"
+#include "eigrpd/eigrp_errors.h"
//#include "eigrpd/eigrp_routemap.h"
/* eigprd privileges */
@@ -168,6 +169,7 @@ int main(int argc, char **argv, char **envp)
eigrp_om->master = frr_init();
master = eigrp_om->master;
+ eigrp_error_init();
vrf_init(NULL, NULL, NULL, NULL);
/*EIGRPd init*/
diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c
index 3bf75072a..9585fa01e 100644
--- a/eigrpd/eigrp_neighbor.c
+++ b/eigrpd/eigrp_neighbor.c
@@ -53,6 +53,7 @@
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_memory.h"
+#include "eigrpd/eigrp_errors.h"
struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *ei)
{
@@ -335,7 +336,8 @@ int eigrp_nbr_count_get(void)
void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
{
if (nbr == NULL) {
- zlog_err("Nbr Hard restart: Neighbor not specified.");
+ zlog_ferr(EIGRP_ERR_CONFIG,
+ "Nbr Hard restart: Neighbor not specified.");
return;
}
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c
index 6b716c1c0..baf634601 100644
--- a/eigrpd/eigrp_network.c
+++ b/eigrpd/eigrp_network.c
@@ -70,8 +70,9 @@ int eigrp_sock_init(void)
if (eigrp_sock < 0) {
int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER))
- zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ zlog_ferr(LIB_ERR_PRIVILEGES,
+ "eigrp_sock_init: could not lower privs, %s",
+ safe_strerror(errno));
zlog_ferr(LIB_ERR_SOCKET, "eigrp_read_sock_init: socket: %s",
safe_strerror(save_errno));
exit(1);
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 09a3ad8de..8f83778e5 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -57,6 +57,7 @@
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h"
+#include "eigrpd/eigrp_errors.h"
/* Packet Type String. */
const struct message eigrp_packet_type_str[] = {
@@ -347,12 +348,14 @@ int eigrp_write(struct thread *thread)
/* Get one packet from queue. */
ep = eigrp_fifo_next(ei->obuf);
if (!ep) {
- zlog_err("%s: Interface %s no packet on queue?",
- __PRETTY_FUNCTION__, ei->ifp->name);
+ zlog_ferr(LIB_ERR_DEVELOPMENT,
+ "%s: Interface %s no packet on queue?",
+ __PRETTY_FUNCTION__, ei->ifp->name);
goto out;
}
if (ep->length < EIGRP_HEADER_LEN) {
- zlog_err("%s: Packet just has a header?", __PRETTY_FUNCTION__);
+ zlog_ferr(EIGRP_ERR_PACKET,
+ "%s: Packet just has a header?", __PRETTY_FUNCTION__);
eigrp_header_dump((struct eigrp_header *)ep->s->data);
eigrp_packet_delete(ei);
goto out;
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index b7490cd49..226271d5f 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -59,6 +59,7 @@
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h"
+#include "eigrpd/eigrp_errors.h"
void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
{
@@ -169,10 +170,10 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
if (!dest) {
char buf[PREFIX_STRLEN];
- zlog_err(
- "%s: Received prefix %s which we do not know about",
- __PRETTY_FUNCTION__,
- prefix2str(&dest_addr, buf, sizeof(buf)));
+ zlog_ferr(EIGRP_ERR_PACKET,
+ "%s: Received prefix %s which we do not know about",
+ __PRETTY_FUNCTION__,
+ prefix2str(&dest_addr, buf, sizeof(buf)));
eigrp_IPv4_InternalTLV_free(tlv);
continue;
}
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index a60d1a1b8..735b319c1 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -43,6 +43,7 @@
#include "sockopt.h"
#include "keychain.h"
#include "libfrr.h"
+#include "lib_errors.h"
#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
@@ -161,9 +162,8 @@ static struct eigrp *eigrp_new(const char *AS)
eigrp->networks = eigrp_topology_new();
if ((eigrp_socket = eigrp_sock_init()) < 0) {
- zlog_err(
- "eigrp_new: fatal error: eigrp_sock_init was unable to open "
- "a socket");
+ zlog_ferr(LIB_ERR_SOCKET,
+ "eigrp_new: fatal error: eigrp_sock_init was unable to open a socket");
exit(1);
}
diff --git a/eigrpd/subdir.am b/eigrpd/subdir.am
index 2c6b1e321..2635d555d 100644
--- a/eigrpd/subdir.am
+++ b/eigrpd/subdir.am
@@ -10,6 +10,7 @@ endif
eigrpd_libeigrp_a_SOURCES = \
eigrpd/eigrp_dump.c \
+ eigrpd/eigrp_errors.c \
eigrpd/eigrp_filter.c \
eigrpd/eigrp_fsm.c \
eigrpd/eigrp_hello.c \
@@ -39,6 +40,7 @@ eigrpdheader_HEADERS = \
noinst_HEADERS += \
eigrpd/eigrp_const.h \
+ eigrpd/eigrp_errors.h \
eigrpd/eigrp_filter.h \
eigrpd/eigrp_fsm.h \
eigrpd/eigrp_interface.h \