]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Add LIB_ERR_DEVELOPMENT
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 18 Jun 2018 13:13:37 +0000 (09:13 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 14 Aug 2018 20:02:05 +0000 (20:02 +0000)
Sometimes a error state is detected when we have added
new code to FRR, but not updated all the places that
we should have.  Consider this a developmental escape
that needs to be fixed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/buffer.c
lib/lib_errors.c
lib/lib_errors.h
lib/log.c
lib/prefix.c
lib/skiplist.c
lib/vty.c

index 207f2320ff58558e946527d87b7acc34dae2c82b..acdaf07bbc1a148afb4c771438831e05f876a757 100644 (file)
@@ -458,9 +458,9 @@ in one shot. */
        while (written > 0) {
                struct buffer_data *d;
                if (!(d = b->head)) {
-                       zlog_err(
-                               "%s: corruption detected: buffer queue empty, "
-                               "but written is %lu",
+                       zlog_ferr(
+                               LIB_ERR_DEVELOPMENT,
+                               "%s: corruption detected: buffer queue empty, but written is %lu",
                                __func__, (unsigned long)written);
                        break;
                }
index 71ff53053eee7af220ba42bc9ab88352e7e1daa9..ae4635673f26c81a2012df0abc70aa8ea603f2de 100644 (file)
@@ -88,6 +88,12 @@ static struct ferr_ref ferr_lib_err[] = {
                .description = "FRR has detected a problem with NameSpace data from the kernel as it deviates\nfrom what we would expect to happen via normal kernel messaging",
                .suggestion = "Open an Issue with all relevant log files and restart FRR"
        },
+       {
+               .code = LIB_ERR_DEVELOPMENT,
+               .title = "Developmental Escape Error",
+               .description = "FRR has detected an issue where new development has not properly\nupdated all code paths.",
+               .suggestion = "Open an Issue with all relevant log files"
+       },
        {
                .code = END_FERR,
        }
index e4ab88e994e57a49a9f3d6788a6684e1cf860d18..bb83c45e67d7abf8630622edb3c95b9857feb4f9 100644 (file)
@@ -21,7 +21,6 @@
 #define __LIB_ERRORS_H__
 
 #include "ferr.h"
-#include "lib_errors.h"
 
 enum lib_ferr_refs {
        LIB_ERR_PRIVILEGES = LIB_FERR_START,
@@ -35,6 +34,7 @@ enum lib_ferr_refs {
        LIB_ERR_SNMP,
        LIB_ERR_INTERFACE,
        LIB_ERR_NS,
+       LIB_ERR_DEVELOPMENT,
 };
 
 extern void lib_error_init(void);
index afecbef19cd69624046824637a39f21958f125ea..6aa718c953a54d3732a44acd4982b482fc9dd90b 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -987,7 +987,8 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
        unsigned int i;
 
        if (zroute >= array_size(route_types)) {
-               zlog_err("unknown zebra route type: %u", zroute);
+               zlog_ferr(LIB_ERR_DEVELOPMENT, "unknown zebra route type: %u",
+                         zroute);
                return &unknown;
        }
        if (zroute == route_types[zroute].type)
@@ -1001,7 +1002,9 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
                        return &route_types[i];
                }
        }
-       zlog_err("internal error: cannot find route type %u in table!", zroute);
+       zlog_ferr(LIB_ERR_DEVELOPMENT,
+                 "internal error: cannot find route type %u in table!",
+                 zroute);
        return &unknown;
 }
 
@@ -1018,7 +1021,8 @@ char zebra_route_char(unsigned int zroute)
 const char *zserv_command_string(unsigned int command)
 {
        if (command >= array_size(command_types)) {
-               zlog_err("unknown zserv command type: %u", command);
+               zlog_ferr(LIB_ERR_DEVELOPMENT, "unknown zserv command type: %u",
+                         command);
                return unknown.string;
        }
        return command_types[command].string;
index 751f20cb83ebfa89e9da2d13d8f2d73ebf98bb84..fe4f360fb27918610b7c78c1f5950d5e0176b4b6 100644 (file)
@@ -27,6 +27,7 @@
 #include "memory.h"
 #include "log.h"
 #include "jhash.h"
+#include "lib_errors.h"
 
 DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix")
 
@@ -656,8 +657,9 @@ void prefix_copy(struct prefix *dest, const struct prefix *src)
                memcpy((void *)dest->u.prefix_flowspec.ptr,
                       (void *)src->u.prefix_flowspec.ptr, len);
        } else {
-               zlog_err("prefix_copy(): Unknown address family %d",
-                        src->family);
+               zlog_ferr(LIB_ERR_DEVELOPMENT,
+                         "prefix_copy(): Unknown address family %d",
+                         src->family);
                assert(0);
        }
 }
index a546bb44c0250ead36af58b7a104b6745d1ce126..d2b3acc971e38e2322653f3f5891ccf3feddaf93 100644 (file)
@@ -60,6 +60,7 @@
 #include "log.h"
 #include "vty.h"
 #include "skiplist.h"
+#include "lib_errors.h"
 
 DEFINE_MTYPE_STATIC(LIB, SKIP_LIST, "Skip List")
 DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_NODE, "Skip Node")
@@ -182,7 +183,8 @@ int skiplist_insert(register struct skiplist *l, register void *key,
 
        /* DEBUG */
        if (!key) {
-               zlog_err("%s: key is 0, value is %p", __func__, value);
+               zlog_ferr(LIB_ERR_DEVELOPMENT, "%s: key is 0, value is %p",
+                         __func__, value);
        }
 
        p = l->header;
index d591ef4b5bfe344b7fa670939296bce54b4d0af4..30db2d09308d2e694795d5b0e7e9e5eaa829606a 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1330,9 +1330,9 @@ static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes)
                                        TELNET_NAWS_SB_LEN,
                                        (unsigned long)vty->sb_len);
                        else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN)
-                               zlog_err(
-                                       "Bug detected: sizeof(vty->sb_buf) %lu < %d, "
-                                       "too small to handle the telnet NAWS option",
+                               zlog_ferr(
+                                       LIB_ERR_DEVELOPMENT,
+                                       "Bug detected: sizeof(vty->sb_buf) %lu < %d, too small to handle the telnet NAWS option",
                                        (unsigned long)sizeof(vty->sb_buf),
                                        TELNET_NAWS_SB_LEN);
                        else {