forked from Mirror/frr
*: rename ferr_ref -> log_ref
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
af4c27286d
commit
85cd2f9f9a
|
@ -24,7 +24,7 @@
|
|||
#include "babel_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_babel_err[] = {
|
||||
static struct log_ref ferr_babel_err[] = {
|
||||
{
|
||||
.code = BABEL_ERR_MEMORY,
|
||||
.title = "BABEL Memory Errors",
|
||||
|
@ -57,5 +57,5 @@ static struct ferr_ref ferr_babel_err[] = {
|
|||
|
||||
void babel_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_babel_err);
|
||||
log_ref_add(ferr_babel_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum babel_ferr_refs {
|
||||
enum babel_log_refs {
|
||||
BABEL_ERR_MEMORY = BABEL_FERR_START,
|
||||
BABEL_ERR_PACKET,
|
||||
BABEL_ERR_CONFIG,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "bgp_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_bgp_err[] = {
|
||||
static struct log_ref ferr_bgp_err[] = {
|
||||
{
|
||||
.code = BGP_ERR_ATTR_FLAG,
|
||||
.title = "BGP attribute flag is incorrect",
|
||||
|
@ -302,5 +302,5 @@ static struct ferr_ref ferr_bgp_err[] = {
|
|||
|
||||
void bgp_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_bgp_err);
|
||||
log_ref_add(ferr_bgp_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum bgp_ferr_refs {
|
||||
enum bgp_log_refs {
|
||||
|
||||
BGP_ERR_ATTR_FLAG = BGP_FERR_START,
|
||||
BGP_ERR_ATTR_LEN,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "eigrp_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_eigrp_err[] = {
|
||||
static struct log_ref ferr_eigrp_err[] = {
|
||||
{
|
||||
.code = EIGRP_ERR_PACKET,
|
||||
.title = "EIGRP Packet Error",
|
||||
|
@ -45,5 +45,5 @@ static struct ferr_ref ferr_eigrp_err[] = {
|
|||
|
||||
void eigrp_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_eigrp_err);
|
||||
log_ref_add(ferr_eigrp_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum eigrp_ferr_refs {
|
||||
enum eigrp_log_refs {
|
||||
EIGRP_ERR_PACKET = EIGRP_FERR_START,
|
||||
EIGRP_ERR_CONFIG,
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "isis_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_isis_err[] = {
|
||||
static struct log_ref ferr_isis_err[] = {
|
||||
{
|
||||
.code = ISIS_ERR_PACKET,
|
||||
.title = "ISIS Packet Error",
|
||||
|
@ -45,5 +45,5 @@ static struct ferr_ref ferr_isis_err[] = {
|
|||
|
||||
void isis_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_isis_err);
|
||||
log_ref_add(ferr_isis_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum isis_ferr_refs {
|
||||
enum isis_log_refs {
|
||||
ISIS_ERR_PACKET = ISIS_FERR_START,
|
||||
ISIS_ERR_CONFIG,
|
||||
};
|
||||
|
|
26
lib/ferr.c
26
lib/ferr.c
|
@ -62,20 +62,20 @@ struct hash *refs;
|
|||
|
||||
static int ferr_hash_cmp(const void *a, const void *b)
|
||||
{
|
||||
const struct ferr_ref *f_a = a;
|
||||
const struct ferr_ref *f_b = b;
|
||||
const struct log_ref *f_a = a;
|
||||
const struct log_ref *f_b = b;
|
||||
|
||||
return f_a->code == f_b->code;
|
||||
}
|
||||
|
||||
static inline unsigned int ferr_hash_key(void *a)
|
||||
{
|
||||
struct ferr_ref *f = a;
|
||||
struct log_ref *f = a;
|
||||
|
||||
return f->code;
|
||||
}
|
||||
|
||||
void ferr_ref_add(struct ferr_ref *ref)
|
||||
void log_ref_add(struct log_ref *ref)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
|
||||
|
@ -89,10 +89,10 @@ void ferr_ref_add(struct ferr_ref *ref)
|
|||
pthread_mutex_unlock(&refs_mtx);
|
||||
}
|
||||
|
||||
struct ferr_ref *ferr_ref_get(uint32_t code)
|
||||
struct log_ref *log_ref_get(uint32_t code)
|
||||
{
|
||||
struct ferr_ref holder;
|
||||
struct ferr_ref *ref;
|
||||
struct log_ref holder;
|
||||
struct log_ref *ref;
|
||||
|
||||
holder.code = code;
|
||||
pthread_mutex_lock(&refs_mtx);
|
||||
|
@ -104,9 +104,9 @@ struct ferr_ref *ferr_ref_get(uint32_t code)
|
|||
return ref;
|
||||
}
|
||||
|
||||
void ferr_ref_display(struct vty *vty, uint32_t code, bool json)
|
||||
void log_ref_display(struct vty *vty, uint32_t code, bool json)
|
||||
{
|
||||
struct ferr_ref *ref;
|
||||
struct log_ref *ref;
|
||||
struct json_object *top, *obj;
|
||||
struct list *errlist;
|
||||
struct listnode *ln;
|
||||
|
@ -121,7 +121,7 @@ void ferr_ref_display(struct vty *vty, uint32_t code, bool json)
|
|||
pthread_mutex_unlock(&refs_mtx);
|
||||
|
||||
if (code) {
|
||||
ref = ferr_ref_get(code);
|
||||
ref = log_ref_get(code);
|
||||
if (!ref) {
|
||||
vty_out(vty, "Code %"PRIu32" - Unknown\n", code);
|
||||
return;
|
||||
|
@ -181,11 +181,11 @@ DEFUN_NOSH(show_error_code,
|
|||
if (!strmatch(argv[2]->text, "all"))
|
||||
arg = strtoul(argv[2]->arg, NULL, 10);
|
||||
|
||||
ferr_ref_display(vty, arg, json);
|
||||
log_ref_display(vty, arg, json);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void ferr_ref_init(void)
|
||||
void log_ref_init(void)
|
||||
{
|
||||
pthread_mutex_lock(&refs_mtx);
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ void ferr_ref_init(void)
|
|||
install_element(VIEW_NODE, &show_error_code_cmd);
|
||||
}
|
||||
|
||||
void ferr_ref_fini(void)
|
||||
void log_ref_fini(void)
|
||||
{
|
||||
pthread_mutex_lock(&refs_mtx);
|
||||
{
|
||||
|
|
12
lib/ferr.h
12
lib/ferr.h
|
@ -132,7 +132,7 @@ struct ferr {
|
|||
#define ZEBRA_FERR_END 0xF1FFFFFF
|
||||
#define END_FERR 0xFFFFFFFF
|
||||
|
||||
struct ferr_ref {
|
||||
struct log_ref {
|
||||
/* Unique error code displayed to end user as a reference. -1 means
|
||||
* this is an uncoded error that does not have reference material. */
|
||||
uint32_t code;
|
||||
|
@ -144,16 +144,16 @@ struct ferr_ref {
|
|||
const char *suggestion;
|
||||
};
|
||||
|
||||
void ferr_ref_add(struct ferr_ref *ref);
|
||||
struct ferr_ref *ferr_ref_get(uint32_t code);
|
||||
void ferr_ref_display(struct vty *vty, uint32_t code, bool json);
|
||||
void log_ref_add(struct log_ref *ref);
|
||||
struct log_ref *log_ref_get(uint32_t code);
|
||||
void log_ref_display(struct vty *vty, uint32_t code, bool json);
|
||||
|
||||
/*
|
||||
* This function should be called by the
|
||||
* code in libfrr.c
|
||||
*/
|
||||
void ferr_ref_init(void);
|
||||
void ferr_ref_fini(void);
|
||||
void log_ref_init(void);
|
||||
void log_ref_fini(void);
|
||||
|
||||
/* get error details.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "lib_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_lib_err[] = {
|
||||
static struct log_ref ferr_lib_err[] = {
|
||||
{
|
||||
.code = LIB_ERR_PRIVILEGES,
|
||||
.title = "Failure to raise or lower privileges",
|
||||
|
@ -114,5 +114,5 @@ static struct ferr_ref ferr_lib_err[] = {
|
|||
|
||||
void lib_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_lib_err);
|
||||
log_ref_add(ferr_lib_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum lib_ferr_refs {
|
||||
enum lib_log_refs {
|
||||
LIB_ERR_PRIVILEGES = LIB_FERR_START,
|
||||
LIB_ERR_VRF_START,
|
||||
LIB_ERR_SOCKET,
|
||||
|
|
|
@ -599,7 +599,7 @@ struct thread_master *frr_init(void)
|
|||
vty_init(master);
|
||||
memory_init();
|
||||
|
||||
ferr_ref_init();
|
||||
log_ref_init();
|
||||
lib_error_init();
|
||||
|
||||
return master;
|
||||
|
@ -941,7 +941,7 @@ void frr_fini(void)
|
|||
/* memory_init -> nothing needed */
|
||||
vty_terminate();
|
||||
cmd_terminate();
|
||||
ferr_ref_fini();
|
||||
log_ref_fini();
|
||||
zprivs_terminate(di->privs);
|
||||
/* signal_init -> nothing needed */
|
||||
thread_master_free(master);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "nhrp_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_nhrp_err[] = {
|
||||
static struct log_ref ferr_nhrp_err[] = {
|
||||
{
|
||||
.code = NHRP_ERR_SWAN,
|
||||
.title = "NHRP Strong Swan Error",
|
||||
|
@ -45,5 +45,5 @@ static struct ferr_ref ferr_nhrp_err[] = {
|
|||
|
||||
void nhrp_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_nhrp_err);
|
||||
log_ref_add(ferr_nhrp_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum nhrp_ferr_refs {
|
||||
enum nhrp_log_refs {
|
||||
NHRP_ERR_SWAN = NHRP_FERR_START,
|
||||
NHRP_ERR_RESOLVER,
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "lib/ferr.h"
|
||||
#include "ospf_errors.h"
|
||||
|
||||
static struct ferr_ref ferr_ospf_err[] = {
|
||||
static struct log_ref ferr_ospf_err[] = {
|
||||
{
|
||||
.code = OSPF_ERR_PKT_PROCESS,
|
||||
.title = "Failure to process a packet",
|
||||
|
@ -80,5 +80,5 @@ static struct ferr_ref ferr_ospf_err[] = {
|
|||
|
||||
void ospf_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_ospf_err);
|
||||
log_ref_add(ferr_ospf_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum ospf_ferr_refs {
|
||||
enum ospf_log_refs {
|
||||
OSPF_ERR_PKT_PROCESS = OSPF_FERR_START,
|
||||
OSPF_ERR_ROUTER_LSA_MISMATCH,
|
||||
OSPF_ERR_DOMAIN_CORRUPT,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "pim_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_pim_err[] = {
|
||||
static struct log_ref ferr_pim_err[] = {
|
||||
{
|
||||
.code = PIM_ERR_MSDP_PACKET,
|
||||
.title = "PIM MSDP Packet Error",
|
||||
|
@ -45,5 +45,5 @@ static struct ferr_ref ferr_pim_err[] = {
|
|||
|
||||
void pim_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_pim_err);
|
||||
log_ref_add(ferr_pim_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum pim_ferr_refs {
|
||||
enum pim_log_refs {
|
||||
PIM_ERR_MSDP_PACKET = PIM_FERR_START,
|
||||
PIM_ERR_CONFIG,
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "lib/ferr.h"
|
||||
#include "rip_errors.h"
|
||||
|
||||
static struct ferr_ref ferr_rip_err[] = {
|
||||
static struct log_ref ferr_rip_err[] = {
|
||||
{
|
||||
.code = RIP_ERR_PACKET,
|
||||
.title = "RIP Packet Error",
|
||||
|
@ -37,5 +37,5 @@ static struct ferr_ref ferr_rip_err[] = {
|
|||
|
||||
void rip_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_rip_err);
|
||||
log_ref_add(ferr_rip_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum rip_ferr_refs {
|
||||
enum rip_log_refs {
|
||||
RIP_ERR_PACKET = RIP_FERR_START,
|
||||
RIP_ERR_CONFIG,
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "watchfrr_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_watchfrr_err[] = {
|
||||
static struct log_ref ferr_watchfrr_err[] = {
|
||||
{
|
||||
.code = WATCHFRR_ERR_CONNECTION,
|
||||
.title = "WATCHFRR Connection Error",
|
||||
|
@ -39,5 +39,5 @@ static struct ferr_ref ferr_watchfrr_err[] = {
|
|||
|
||||
void watchfrr_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_watchfrr_err);
|
||||
log_ref_add(ferr_watchfrr_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum watchfrr_ferr_refs {
|
||||
enum watchfrr_log_refs {
|
||||
WATCHFRR_ERR_CONNECTION = WATCHFRR_FERR_START,
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "zebra_errors.h"
|
||||
|
||||
/* clang-format off */
|
||||
static struct ferr_ref ferr_zebra_err[] = {
|
||||
static struct log_ref ferr_zebra_err[] = {
|
||||
{
|
||||
.code = ZEBRA_ERR_LM_RESPONSE,
|
||||
.title = "Error reading response from label manager",
|
||||
|
@ -274,5 +274,5 @@ static struct ferr_ref ferr_zebra_err[] = {
|
|||
|
||||
void zebra_error_init(void)
|
||||
{
|
||||
ferr_ref_add(ferr_zebra_err);
|
||||
log_ref_add(ferr_zebra_err);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/ferr.h"
|
||||
|
||||
enum zebra_ferr_refs {
|
||||
enum zebra_log_refs {
|
||||
ZEBRA_ERR_LM_RESPONSE = ZEBRA_FERR_START,
|
||||
ZEBRA_ERR_LM_NO_SUCH_CLIENT,
|
||||
ZEBRA_ERR_LM_RELAY_FAILED,
|
||||
|
|
Loading…
Reference in a new issue