]> git.proxmox.com Git - mirror_frr.git/commitdiff
eigrpd: Add EIGRP_ERR_XXX for zlog_err to zlog_ferr
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 19 Jun 2018 19:39:45 +0000 (15:39 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 14 Aug 2018 20:02:05 +0000 (20:02 +0000)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_errors.c [new file with mode: 0644]
eigrpd/eigrp_errors.h [new file with mode: 0644]
eigrpd/eigrp_hello.c
eigrpd/eigrp_main.c
eigrpd/eigrp_neighbor.c
eigrpd/eigrp_network.c
eigrpd/eigrp_packet.c
eigrpd/eigrp_reply.c
eigrpd/eigrpd.c
eigrpd/subdir.am

diff --git a/eigrpd/eigrp_errors.c b/eigrpd/eigrp_errors.c
new file mode 100644 (file)
index 0000000..23a2af0
--- /dev/null
@@ -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 (file)
index 0000000..c314ddc
--- /dev/null
@@ -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
index 2e55d57c3154984698350c1b3afe5c7d3e257407..f3c3cdef03b2691ab5e6d119994771ed8c8840bd 100644 (file)
@@ -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);
 }
 
 /**
index c4ca07178c3a130f45a8a911b088f9a0b2a8c69a..31101a52d4f4d61dcf4dd72f6dedbd7350292991 100644 (file)
@@ -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*/
index 3bf75072a3c702b248fa9eefa64ede750883d606..9585fa01ebcee046220669dc18b0824d8db71c12 100644 (file)
@@ -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;
        }
 
index 6b716c1c031c9b3f14145c946110ae192a1c430b..baf634601423550d007d00c1e1f92dc96a3e21ca 100644 (file)
@@ -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);
index 09a3ad8dea6cf3adb9d30e6682469037f8e33136..8f83778e59d2935d785a94e97f4d1b972a6e5a7d 100644 (file)
@@ -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;
index b7490cd49206a6bb523a8f28d78a1b52d622ad25..226271d5f55274d1e0afb14751f397dfc5d5605d 100644 (file)
@@ -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;
                }
index a60d1a1b8da898f2ef83f551c643bedca46d88eb..735b319c1d38678ef4f5d4f1d3abcade6a967f73 100644 (file)
@@ -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);
        }
 
index 2c6b1e321bd99b91aa7e4861b56928168a7346d4..2635d555d9a202e4039b025b77a311c8f16bc4de 100644 (file)
@@ -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 \