mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 20:13:53 +00:00
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>
This commit is contained in:
parent
4d43f68aeb
commit
674c3ca8a8
@ -82,6 +82,12 @@ static struct ferr_ref ferr_lib_err[] = {
|
||||
.description = "FRR has detected a problem with interface data from the kernel as it deviates\nfrom what we would expect to happen via normal netlink messaging",
|
||||
.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,
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user