]> git.proxmox.com Git - mirror_frr.git/commitdiff
ripd: Add RIP_ERR_XXX to move from zlog_err to zlog_ferr
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 19 Jun 2018 20:13:45 +0000 (16:13 -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>
ripd/rip_errors.c [new file with mode: 0644]
ripd/rip_errors.h [new file with mode: 0644]
ripd/rip_main.c
ripd/ripd.c
ripd/subdir.am

diff --git a/ripd/rip_errors.c b/ripd/rip_errors.c
new file mode 100644 (file)
index 0000000..9fefec6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * rip_errors - code for error messages that may occur in the
+ *              rip 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 "rip_errors.h"
+
+static struct ferr_ref ferr_rip_err[] = {
+       {
+               .code = RIP_ERR_PACKET,
+               .title = "RIP Packet Error",
+               .description = "RIP has detected a packet encode/decode issue",
+               .suggestion = "Gather log files from both sides and open a Issue"
+       },
+       {
+               .code = END_FERR,
+       }
+};
+
+void rip_error_init(void)
+{
+       ferr_ref_init();
+
+       ferr_ref_add(ferr_rip_err);
+}
diff --git a/ripd/rip_errors.h b/ripd/rip_errors.h
new file mode 100644 (file)
index 0000000..6e2bdfc
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * rip_errors - header for error messages that may occur in the rip 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 __RIP_ERRORS_H__
+#define __RIP_ERRORS_H__
+
+#include "ferr.h"
+#include "rip_errors.h"
+
+enum rip_ferr_refs {
+       RIP_ERR_PACKET = RIP_FERR_START,
+       RIP_ERR_CONFIG,
+};
+
+extern void rip_error_init(void);
+
+#endif
index 0194e5312802d5a2a48226158352c41d4a9cb16e..e5a5c3e227ff8895b02d76dd7dc46b4324744bda 100644 (file)
@@ -37,6 +37,7 @@
 #include "libfrr.h"
 
 #include "ripd/ripd.h"
+#include "ripd/rip_errors.h"
 
 /* ripd options. */
 #if CONFDATE > 20190521
@@ -167,6 +168,7 @@ int main(int argc, char **argv)
        master = frr_init();
 
        /* Library initialization. */
+       rip_error_init();
        keychain_init();
        vrf_init(NULL, NULL, NULL, NULL);
 
index b91e7a4ceda6c7b681a7fc434a723d059454cc3b..a0e38a7cddc287df22c6cf1c8fadd996e80db7bc 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "ripd/ripd.h"
 #include "ripd/rip_debug.h"
+#include "ripd/rip_errors.h"
 
 DEFINE_QOBJ_TYPE(rip)
 
@@ -1057,9 +1058,9 @@ static void rip_auth_md5_set(struct stream *s, struct rip_interface *ri,
 
        /* Check packet length. */
        if (len < (RIP_HEADER_SIZE + RIP_RTE_SIZE)) {
-               zlog_err(
-                       "rip_auth_md5_set(): packet length %ld is less than minimum length.",
-                       len);
+               zlog_ferr(RIP_ERR_PACKET,
+                         "rip_auth_md5_set(): packet length %ld is less than minimum length.",
+                         len);
                return;
        }
 
index 1c5167ef4a12785288017d04c5d2b4763514ecc7..612db1a7abc5646f8d44800c91c53f587d02eee5 100644 (file)
@@ -13,6 +13,7 @@ endif
 
 ripd_librip_a_SOURCES = \
        ripd/rip_debug.c \
+       ripd/rip_errors.c \
        ripd/rip_interface.c \
        ripd/rip_memory.c \
        ripd/rip_offset.c \
@@ -24,6 +25,7 @@ ripd_librip_a_SOURCES = \
 
 noinst_HEADERS += \
        ripd/rip_debug.h \
+       ripd/rip_errors.h \
        ripd/rip_interface.h \
        ripd/rip_memory.h \
        ripd/ripd.h \