diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-18 15:13:37 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | 472878dc0fdd5e17500e8a6ba8a65d13e36d9467 (patch) | |
tree | e92ddabd91c15d6b465e577d09216c3207ed907e /lib | |
parent | lib: Add LIB_ERR_NS to error subsystem (diff) | |
download | frr-472878dc0fdd5e17500e8a6ba8a65d13e36d9467.tar.xz frr-472878dc0fdd5e17500e8a6ba8a65d13e36d9467.zip |
lib: Add LIB_ERR_DEVELOPMENT
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buffer.c | 6 | ||||
-rw-r--r-- | lib/lib_errors.c | 6 | ||||
-rw-r--r-- | lib/lib_errors.h | 2 | ||||
-rw-r--r-- | lib/log.c | 10 | ||||
-rw-r--r-- | lib/prefix.c | 6 | ||||
-rw-r--r-- | lib/skiplist.c | 4 | ||||
-rw-r--r-- | lib/vty.c | 6 |
7 files changed, 27 insertions, 13 deletions
diff --git a/lib/buffer.c b/lib/buffer.c index 207f2320f..acdaf07bb 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -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; } diff --git a/lib/lib_errors.c b/lib/lib_errors.c index 71ff53053..ae4635673 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -89,6 +89,12 @@ static struct ferr_ref ferr_lib_err[] = { .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, } }; diff --git a/lib/lib_errors.h b/lib/lib_errors.h index e4ab88e99..bb83c45e6 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -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); @@ -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; diff --git a/lib/prefix.c b/lib/prefix.c index 751f20cb8..fe4f360fb 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -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); } } diff --git a/lib/skiplist.c b/lib/skiplist.c index a546bb44c..d2b3acc97 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -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; @@ -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 { |