diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-18 14:55:06 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | 674c3ca8a837bf732a6a6062bea23a3ec745d971 (patch) | |
tree | af6152774226c3c2ee8bd93fb15f7ecf0a92f1d1 | |
parent | lib, zebra: Add LIB_ERR_INTERFACE (diff) | |
download | frr-674c3ca8a837bf732a6a6062bea23a3ec745d971.tar.xz frr-674c3ca8a837bf732a6a6062bea23a3ec745d971.zip |
lib: Add LIB_ERR_NS to error subsystem
Add additional information about NameSpace errors that
may happen.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | lib/lib_errors.c | 6 | ||||
-rw-r--r-- | lib/lib_errors.h | 1 | ||||
-rw-r--r-- | lib/netns_linux.c | 16 |
3 files changed, 17 insertions, 6 deletions
diff --git a/lib/lib_errors.c b/lib/lib_errors.c index d1db7b777..71ff53053 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -83,6 +83,12 @@ static struct ferr_ref ferr_lib_err[] = { .suggestion = "Open an Issue with all relevant log files and restart FRR" }, { + .code = LIB_ERR_NS, + .title = "NameSpace Subsystem Error", + .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 = END_FERR, } }; diff --git a/lib/lib_errors.h b/lib/lib_errors.h index 67feb6882..e4ab88e99 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -34,6 +34,7 @@ enum lib_ferr_refs { LIB_ERR_VTY, LIB_ERR_SNMP, LIB_ERR_INTERFACE, + LIB_ERR_NS, }; extern void lib_error_init(void); diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 801264d1a..3a24e511a 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -227,8 +227,9 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *)) /* Non default NS. leave */ if (ns->ns_id == NS_UNKNOWN) { - zlog_err("Can not enable NS %s %u: Invalid NSID", - ns->name, ns->ns_id); + zlog_ferr(LIB_ERR_NS, + "Can not enable NS %s %u: Invalid NSID", + ns->name, ns->ns_id); return 0; } if (func) @@ -471,8 +472,9 @@ void ns_init(void) if (have_netns_enabled < 0) { ns_default_ns_fd = open(NS_DEFAULT_NAME, O_RDONLY); if (ns_default_ns_fd == -1) - zlog_err("NS initialization failure %d(%s)", - errno, safe_strerror(errno)); + zlog_ferr(LIB_ERR_NS, + "NS initialization failure %d(%s)", errno, + safe_strerror(errno)); } else { ns_default_ns_fd = -1; default_ns = NULL; @@ -493,7 +495,8 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) ns_init(); default_ns = ns_get_created_internal(NULL, NULL, default_ns_id); if (!default_ns) { - zlog_err("%s: failed to create the default NS!", __func__); + zlog_ferr(LIB_ERR_NS, "%s: failed to create the default NS!", + __func__); exit(1); } if (have_netns()) { @@ -510,7 +513,8 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) /* Enable the default NS. */ if (!ns_enable(default_ns, NULL)) { - zlog_err("%s: failed to enable the default NS!", __func__); + zlog_ferr(LIB_ERR_NS, "%s: failed to enable the default NS!", + __func__); exit(1); } } |