summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-09-13 21:34:28 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-09-13 21:34:28 +0200
commit450971aa994e68f7c62c4d45065223d5cfc4a22f (patch)
tree0128a1e596823272333d8a6616dd2575e8d7c46b /lib
parentzebra: ZEBRA_[ERR|WARN] -> EC_ZEBRA (diff)
downloadfrr-450971aa994e68f7c62c4d45065223d5cfc4a22f.tar.xz
frr-450971aa994e68f7c62c4d45065223d5cfc4a22f.zip
*: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/agentx.c10
-rw-r--r--lib/buffer.c12
-rw-r--r--lib/command.c2
-rw-r--r--lib/frr_zmq.c4
-rw-r--r--lib/if.c2
-rw-r--r--lib/if.h8
-rw-r--r--lib/lib_errors.c46
-rw-r--r--lib/lib_errors.h41
-rw-r--r--lib/libfrr.c12
-rw-r--r--lib/log.c14
-rw-r--r--lib/netns_linux.c12
-rw-r--r--lib/network.c4
-rw-r--r--lib/pid_output.c8
-rw-r--r--lib/prefix.c2
-rw-r--r--lib/privs.c2
-rw-r--r--lib/routemap.c2
-rw-r--r--lib/sigevent.c4
-rw-r--r--lib/skiplist.c2
-rw-r--r--lib/sockopt.c38
-rw-r--r--lib/sockunion.c24
-rw-r--r--lib/stream.c12
-rw-r--r--lib/thread.c4
-rw-r--r--lib/vrf.c22
-rw-r--r--lib/vty.c50
-rw-r--r--lib/zclient.c82
25 files changed, 206 insertions, 213 deletions
diff --git a/lib/agentx.c b/lib/agentx.c
index c319649e3..9fb9138c6 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -142,23 +142,23 @@ static int agentx_log_callback(int major, int minor, void *serverarg,
msg[strlen(msg) - 1] = '\0';
switch (slm->priority) {
case LOG_EMERG:
- flog_err(LIB_ERR_SNMP,
+ flog_err(EC_LIB_SNMP,
"snmp[emerg]: %s", msg ? msg : slm->msg);
break;
case LOG_ALERT:
- flog_err(LIB_ERR_SNMP,
+ flog_err(EC_LIB_SNMP,
"snmp[alert]: %s", msg ? msg : slm->msg);
break;
case LOG_CRIT:
- flog_err(LIB_ERR_SNMP,
+ flog_err(EC_LIB_SNMP,
"snmp[crit]: %s", msg ? msg : slm->msg);
break;
case LOG_ERR:
- flog_err(LIB_ERR_SNMP,
+ flog_err(EC_LIB_SNMP,
"snmp[err]: %s", msg ? msg : slm->msg);
break;
case LOG_WARNING:
- flog_warn(LIB_WARN_SNMP, "snmp[warning]: %s",
+ flog_warn(EC_LIB_SNMP, "snmp[warning]: %s",
msg ? msg : slm->msg);
break;
case LOG_NOTICE:
diff --git a/lib/buffer.c b/lib/buffer.c
index 11bacf83b..bb2cdb7e5 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -332,7 +332,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
} else {
/* This should absolutely never occur. */
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: corruption detected: iov_small overflowed; "
"head %p, tail %p, head->next %p",
__func__, (void *)b->head,
@@ -365,7 +365,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
iov_size =
((iov_index > IOV_MAX) ? IOV_MAX : iov_index);
if ((nbytes = writev(fd, c_iov, iov_size)) < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: writev to fd %d failed: %s",
__func__, fd, safe_strerror(errno));
break;
@@ -378,7 +378,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width,
}
#else /* IOV_MAX */
if ((nbytes = writev(fd, iov, iov_index)) < 0)
- flog_err(LIB_ERR_SOCKET, "%s: writev to fd %d failed: %s",
+ flog_err(EC_LIB_SOCKET, "%s: writev to fd %d failed: %s",
__func__, fd, safe_strerror(errno));
#endif /* IOV_MAX */
@@ -439,7 +439,7 @@ in one shot. */
if (ERRNO_IO_RETRY(errno))
/* Calling code should try again later. */
return BUFFER_PENDING;
- flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s",
+ flog_err(EC_LIB_SOCKET, "%s: write error on fd %d: %s",
__func__, fd, safe_strerror(errno));
return BUFFER_ERROR;
}
@@ -448,7 +448,7 @@ in one shot. */
while (written > 0) {
if (!(d = b->head)) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: corruption detected: buffer queue empty, but written is %lu",
__func__, (unsigned long)written);
break;
@@ -493,7 +493,7 @@ buffer_status_t buffer_write(struct buffer *b, int fd, const void *p,
if (ERRNO_IO_RETRY(errno))
nbytes = 0;
else {
- flog_err(LIB_ERR_SOCKET, "%s: write error on fd %d: %s",
+ flog_err(EC_LIB_SOCKET, "%s: write error on fd %d: %s",
__func__, fd, safe_strerror(errno));
return BUFFER_ERROR;
}
diff --git a/lib/command.c b/lib/command.c
index 26afc762f..f3c8b1ed0 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2421,7 +2421,7 @@ static int set_log_file(struct vty *vty, const char *fname, int loglevel)
cwd[MAXPATHLEN] = '\0';
if (getcwd(cwd, MAXPATHLEN) == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"config_log_file: Unable to alloc mem!");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c
index 02d9b68bc..ef85504a7 100644
--- a/lib/frr_zmq.c
+++ b/lib/frr_zmq.c
@@ -141,7 +141,7 @@ static int frrzmq_read_msg(struct thread *t)
return 0;
out_err:
- flog_err(LIB_ERR_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
+ flog_err(EC_LIB_ZMQ, "ZeroMQ read error: %s(%d)", strerror(errno),
errno);
if (cb->read.cb_error)
cb->read.cb_error(cb->read.arg, cb->zmqsock);
@@ -255,7 +255,7 @@ static int frrzmq_write_msg(struct thread *t)
return 0;
out_err:
- flog_err(LIB_ERR_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
+ flog_err(EC_LIB_ZMQ, "ZeroMQ write error: %s(%d)", strerror(errno),
errno);
if (cb->write.cb_error)
cb->write.cb_error(cb->write.arg, cb->zmqsock);
diff --git a/lib/if.c b/lib/if.c
index 2f2073c0a..6fbedde75 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1159,7 +1159,7 @@ const char *if_link_type_str(enum zebra_link_type llt)
llts(ZEBRA_LLT_IEEE802154, "IEEE 802.15.4");
llts(ZEBRA_LLT_IEEE802154_PHY, "IEEE 802.15.4 Phy");
default:
- flog_err(LIB_ERR_DEVELOPMENT, "Unknown value %d", llt);
+ flog_err(EC_LIB_DEVELOPMENT, "Unknown value %d", llt);
return "Unknown type!";
#undef llts
}
diff --git a/lib/if.h b/lib/if.h
index a861cf2d8..22deffb34 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -298,7 +298,7 @@ DECLARE_QOBJ_TYPE(interface)
#define IFNAME_RB_INSERT(vrf, ifp) \
if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \
flog_err( \
- LIB_ERR_INTERFACE, \
+ EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name exists already in VRF %u!", \
__func__, (ifp)->name, (ifp)->vrf_id);
@@ -306,7 +306,7 @@ DECLARE_QOBJ_TYPE(interface)
#define IFNAME_RB_REMOVE(vrf, ifp) \
if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \
flog_err( \
- LIB_ERR_INTERFACE, \
+ EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name doesn't exist in VRF %u!", \
__func__, (ifp)->name, (ifp)->vrf_id);
@@ -314,7 +314,7 @@ DECLARE_QOBJ_TYPE(interface)
#define IFINDEX_RB_INSERT(vrf, ifp) \
if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \
flog_err( \
- LIB_ERR_INTERFACE, \
+ EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex exists already in VRF %u!", \
__func__, (ifp)->ifindex, (ifp)->vrf_id);
@@ -322,7 +322,7 @@ DECLARE_QOBJ_TYPE(interface)
#define IFINDEX_RB_REMOVE(vrf, ifp) \
if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \
flog_err( \
- LIB_ERR_INTERFACE, \
+ EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex doesn't exist in VRF %u!", \
__func__, (ifp)->ifindex, (ifp)->vrf_id);
diff --git a/lib/lib_errors.c b/lib/lib_errors.c
index a608aa9e6..03ad974da 100644
--- a/lib/lib_errors.c
+++ b/lib/lib_errors.c
@@ -27,43 +27,43 @@
/* clang-format off */
static struct log_ref ferr_lib_warn[] = {
{
- .code = LIB_WARN_SNMP,
+ .code = EC_LIB_SNMP,
.title = "SNMP has discovered a warning",
.description = "The SNMP AgentX library has returned a warning that we should report to the end user",
.suggestion = "Gather Log data and open an Issue.",
},
{
- .code = LIB_WARN_STREAM,
+ .code = EC_LIB_STREAM,
.title = "The stream subsystem has encountered an error",
.description = "During sanity checking stream.c has detected an error in the data associated with a particular stream",
.suggestion = "Gather log data and open an Issue, restart FRR",
},
{
- .code = LIB_WARN_LINUX_NS,
+ .code = EC_LIB_LINUX_NS,
.title = "The Linux namespace subsystem has encountered a parsing error",
.description = "During system startup an invalid parameter for the namesapce was give to FRR",
.suggestion = "Gather log data and open an Issue. restart FRR",
},
{
- .code = LIB_WARN_SLOW_THREAD,
+ .code = EC_LIB_SLOW_THREAD,
.title = "The Event subsystem has detected a slow process",
.description = "The Event subsystem has detected a slow process, this typically indicates that FRR is having trouble completing work in a timely manner. This can be either a misconfiguration, bug, or some combination therof.",
.suggestion = "Gather log data and open an Issue",
},
{
- .code = LIB_WARN_RMAP_RECURSION_LIMIT,
+ .code = EC_LIB_RMAP_RECURSION_LIMIT,
.title = "Reached the Route-Map Recursion Limit",
.description = "The Route-Map subsystem has detected a route-map depth of RMAP_RECURSION_LIMIT and has stopped processing",
.suggestion = "Re-work the Route-Map in question to not have so many route-map statements, or recompile FRR with a higher limit",
},
{
- .code = LIB_WARN_BACKUP_CONFIG,
+ .code = EC_LIB_BACKUP_CONFIG,
.title = "Unable to open configuration file",
.description = "The config subsystem attempted to read in it's configuration file which failed, so we are falling back to the backup config file to see if it is available",
.suggestion = "Create configuration file",
},
{
- .code = LIB_WARN_VRF_LENGTH,
+ .code = EC_LIB_VRF_LENGTH,
.title = "The VRF subsystem has encountered a parsing error",
.description = "The VRF subsystem, during initialization, has found a parsing error with input it has received",
.suggestion = "Check the length of the vrf name and adjust accordingly",
@@ -75,85 +75,79 @@ static struct log_ref ferr_lib_warn[] = {
static struct log_ref ferr_lib_err[] = {
{
- .code = LIB_ERR_PRIVILEGES,
+ .code = EC_LIB_PRIVILEGES,
.title = "Failure to raise or lower privileges",
.description = "FRR attempted to raise or lower its privileges and was unable to do so",
.suggestion = "Ensure that you are running FRR as the frr user and that the user has sufficient privileges to properly access root privileges"
},
{
- .code = LIB_ERR_VRF_START,
+ .code = EC_LIB_VRF_START,
.title = "VRF Failure on Start",
.description = "Upon startup FRR failed to properly initialize and startup the VRF subsystem",
.suggestion = "Ensure that there is sufficient memory to start processes and restart FRR",
},
{
- .code = LIB_ERR_SOCKET,
+ .code = EC_LIB_SOCKET,
.title = "Socket Error",
.description = "When attempting to access a socket a system error has occured and we were unable to properly complete the request",
.suggestion = "Ensure that there are sufficient system resources available and ensure that the frr user has sufficient permisions to work. If necessary open an Issue",
},
{
- .code = LIB_ERR_ZAPI_MISSMATCH,
+ .code = EC_LIB_ZAPI_MISSMATCH,
.title = "ZAPI Error",
.description = "A version miss-match has been detected between zebra and client protocol",
.suggestion = "Two different versions of FRR have been installed and the install is not properly setup. Completely stop FRR, remove it from the system and reinstall. Typically only developers should see this issue."
},
{
- .code = LIB_ERR_ZAPI_ENCODE,
+ .code = EC_LIB_ZAPI_ENCODE,
.title = "ZAPI Error",
.description = "The ZAPI subsystem has detected an encoding issue, between zebra and a client protocol",
.suggestion = "Gather data and open an Issue, also Restart FRR"
},
{
- .code = LIB_ERR_ZAPI_SOCKET,
+ .code = EC_LIB_ZAPI_SOCKET,
.title = "ZAPI Error",
.description = "The ZAPI subsystem has detected a socket error between zebra and a client",
.suggestion = "Restart FRR"
},
{
- .code = LIB_ERR_SYSTEM_CALL,
+ .code = EC_LIB_SYSTEM_CALL,
.title = "System Call Error",
.description = "FRR has detected a error from using a vital system call and has probably already exited",
.suggestion = "Ensure permissions are correct for FRR files, users and groups are correct. Additionally check that sufficient system resources are available."
},
{
- .code = LIB_ERR_VTY,
+ .code = EC_LIB_VTY,
.title = "VTY Subsystem Error",
.description = "FRR has detected a problem with the specified configuration file",
.suggestion = "Ensure configuration file exists and has correct permissions for operations Additionally ensure that all config lines are correct as well",
},
{
- .code = LIB_ERR_SNMP,
- .title = "SNMP Subsystem Error",
- .description = "FRR has detected a problem with the snmp library it uses A callback from this subsystem has indicated some error",
- .suggestion = "Examine callback message and ensure snmp is properly setup and working"
- },
- {
- .code = LIB_ERR_INTERFACE,
+ .code = EC_LIB_INTERFACE,
.title = "Interface Subsystem Error",
.description = "FRR has detected a problem with interface data from the kernel as it deviates from 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,
+ .code = EC_LIB_NS,
.title = "NameSpace Subsystem Error",
.description = "FRR has detected a problem with NameSpace data from the kernel as it deviates from 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,
+ .code = EC_LIB_DEVELOPMENT,
.title = "Developmental Escape Error",
.description = "FRR has detected an issue where new development has not properly updated all code paths.",
.suggestion = "Open an Issue with all relevant log files"
},
{
- .code = LIB_ERR_ZMQ,
+ .code = EC_LIB_ZMQ,
.title = "ZMQ Subsystem Error",
.description = "FRR has detected an issue with the Zero MQ subsystem and ZeroMQ is not working properly now",
.suggestion = "Open an Issue with all relevant log files and restart FRR"
},
{
- .code = LIB_ERR_UNAVAILABLE,
+ .code = EC_LIB_UNAVAILABLE,
.title = "Feature or system unavailable",
.description = "FRR was not compiled with support for a particular feature, or it is not available on the current platform",
.suggestion = "Recompile FRR with the feature enabled, or find out what platforms support the feature"
diff --git a/lib/lib_errors.h b/lib/lib_errors.h
index dcaf888e1..e0f698a07 100644
--- a/lib/lib_errors.h
+++ b/lib/lib_errors.h
@@ -24,27 +24,26 @@
#include "lib/ferr.h"
enum lib_log_refs {
- LIB_ERR_PRIVILEGES = LIB_FERR_START,
- LIB_ERR_VRF_START,
- LIB_ERR_SOCKET,
- LIB_ERR_ZAPI_MISSMATCH,
- LIB_ERR_ZAPI_ENCODE,
- LIB_ERR_ZAPI_SOCKET,
- LIB_ERR_SYSTEM_CALL,
- LIB_ERR_VTY,
- LIB_ERR_SNMP,
- LIB_ERR_INTERFACE,
- LIB_ERR_NS,
- LIB_ERR_DEVELOPMENT,
- LIB_ERR_ZMQ,
- LIB_ERR_UNAVAILABLE,
- LIB_WARN_SNMP,
- LIB_WARN_STREAM,
- LIB_WARN_LINUX_NS,
- LIB_WARN_SLOW_THREAD,
- LIB_WARN_RMAP_RECURSION_LIMIT,
- LIB_WARN_BACKUP_CONFIG,
- LIB_WARN_VRF_LENGTH,
+ EC_LIB_PRIVILEGES = LIB_FERR_START,
+ EC_LIB_VRF_START,
+ EC_LIB_SOCKET,
+ EC_LIB_ZAPI_MISSMATCH,
+ EC_LIB_ZAPI_ENCODE,
+ EC_LIB_ZAPI_SOCKET,
+ EC_LIB_SYSTEM_CALL,
+ EC_LIB_VTY,
+ EC_LIB_INTERFACE,
+ EC_LIB_NS,
+ EC_LIB_DEVELOPMENT,
+ EC_LIB_ZMQ,
+ EC_LIB_UNAVAILABLE,
+ EC_LIB_SNMP,
+ EC_LIB_STREAM,
+ EC_LIB_LINUX_NS,
+ EC_LIB_SLOW_THREAD,
+ EC_LIB_RMAP_RECURSION_LIMIT,
+ EC_LIB_BACKUP_CONFIG,
+ EC_LIB_VRF_LENGTH,
};
extern void lib_error_init(void);
diff --git a/lib/libfrr.c b/lib/libfrr.c
index ecdc27757..2ec9f66fe 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -274,12 +274,12 @@ static void frr_guard_daemon(void)
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_GETLK, &lock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Could not do F_GETLK pid_file %s (%s), exiting",
path, safe_strerror(errno));
exit(1);
} else if (lock.l_type == F_WRLCK) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Process %d has a write lock on file %s already! Error: (%s)",
lock.l_pid, path, safe_strerror(errno));
exit(1);
@@ -543,14 +543,14 @@ static void frr_mkdir(const char *path, bool strip)
if (errno == EEXIST)
return;
- flog_err(LIB_ERR_SYSTEM_CALL, "failed to mkdir \"%s\": %s",
+ flog_err(EC_LIB_SYSTEM_CALL, "failed to mkdir \"%s\": %s",
path, strerror(errno));
return;
}
zprivs_get_ids(&ids);
if (chown(path, ids.uid_normal, ids.gid_normal))
- flog_err(LIB_ERR_SYSTEM_CALL, "failed to chown \"%s\": %s",
+ flog_err(EC_LIB_SYSTEM_CALL, "failed to chown \"%s\": %s",
path, strerror(errno));
}
@@ -860,7 +860,7 @@ static void frr_terminal_close(int isexit)
nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
if (nullfd == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: failed to open /dev/null: %s", __func__,
safe_strerror(errno));
} else {
@@ -933,7 +933,7 @@ void frr_run(struct thread_master *master)
} else if (di->daemon_mode) {
int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
if (nullfd == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: failed to open /dev/null: %s",
__func__, safe_strerror(errno));
} else {
diff --git a/lib/log.c b/lib/log.c
index 521783e4b..c45c26cb7 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -634,7 +634,7 @@ void zlog_backtrace(int priority)
size = backtrace(array, array_size(array));
if (size <= 0 || (size_t)size > array_size(array)) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Cannot get backtrace, returned invalid # of frames %d "
"(valid range is between 1 and %lu)",
size, (unsigned long)(array_size(array)));
@@ -642,7 +642,7 @@ void zlog_backtrace(int priority)
}
zlog(priority, "Backtrace for %d stack frames:", size);
if (!(strings = backtrace_symbols(array, size))) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Cannot get backtrace symbols (out of memory?)");
for (i = 0; i < size; i++)
zlog(priority, "[bt %d] %p", i, array[i]);
@@ -716,7 +716,7 @@ void _zlog_assert_failed(const char *assertion, const char *file,
void memory_oom(size_t size, const char *name)
{
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"out of memory: failed to allocate %zu bytes for %s"
"object",
size, name);
@@ -872,7 +872,7 @@ int zlog_rotate(void)
pthread_mutex_unlock(&loglock);
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Log rotate failed: cannot open file %s for append: %s",
zl->filename, safe_strerror(save_errno));
ret = -1;
@@ -989,7 +989,7 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
unsigned int i;
if (zroute >= array_size(route_types)) {
- flog_err(LIB_ERR_DEVELOPMENT, "unknown zebra route type: %u",
+ flog_err(EC_LIB_DEVELOPMENT, "unknown zebra route type: %u",
zroute);
return &unknown;
}
@@ -1004,7 +1004,7 @@ static const struct zebra_desc_table *zroute_lookup(unsigned int zroute)
return &route_types[i];
}
}
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"internal error: cannot find route type %u in table!",
zroute);
return &unknown;
@@ -1023,7 +1023,7 @@ char zebra_route_char(unsigned int zroute)
const char *zserv_command_string(unsigned int command)
{
if (command >= array_size(command_types)) {
- flog_err(LIB_ERR_DEVELOPMENT, "unknown zserv command type: %u",
+ flog_err(EC_LIB_DEVELOPMENT, "unknown zserv command type: %u",
command);
return unknown.string;
}
diff --git a/lib/netns_linux.c b/lib/netns_linux.c
index e3170fee1..d113426be 100644
--- a/lib/netns_linux.c
+++ b/lib/netns_linux.c
@@ -219,7 +219,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *))
}
if (!ns_is_enabled(ns)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can not enable NS %u: %s!", ns->ns_id,
safe_strerror(errno));
return 0;
@@ -227,7 +227,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *))
/* Non default NS. leave */
if (ns->ns_id == NS_UNKNOWN) {
- flog_err(LIB_ERR_NS,
+ flog_err(EC_LIB_NS,
"Can not enable NS %s %u: Invalid NSID",
ns->name, ns->ns_id);
return 0;
@@ -441,7 +441,7 @@ char *ns_netns_pathname(struct vty *vty, const char *name)
pathname,
safe_strerror(errno));
else
- flog_warn(LIB_WARN_LINUX_NS,
+ flog_warn(EC_LIB_LINUX_NS,
"Invalid pathname for %s: %s", pathname,
safe_strerror(errno));
return NULL;
@@ -452,7 +452,7 @@ char *ns_netns_pathname(struct vty *vty, const char *name)
vty_out(vty, "NS name (%s) invalid: too long (>%d)\n",
check_base, NS_NAMSIZ - 1);
else
- flog_warn(LIB_WARN_LINUX_NS,
+ flog_warn(EC_LIB_LINUX_NS,
"NS name (%s) invalid: too long (>%d)",
check_base, NS_NAMSIZ - 1);
return NULL;
@@ -487,7 +487,7 @@ 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) {
- flog_err(LIB_ERR_NS, "%s: failed to create the default NS!",
+ flog_err(EC_LIB_NS, "%s: failed to create the default NS!",
__func__);
exit(1);
}
@@ -505,7 +505,7 @@ 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)) {
- flog_err(LIB_ERR_NS, "%s: failed to enable the default NS!",
+ flog_err(EC_LIB_NS, "%s: failed to enable the default NS!",
__func__);
exit(1);
}
diff --git a/lib/network.c b/lib/network.c
index 41bd321bc..411661a5e 100644
--- a/lib/network.c
+++ b/lib/network.c
@@ -79,13 +79,13 @@ int set_nonblocking(int fd)
should
never be negative. */
if ((flags = fcntl(fd, F_GETFL)) < 0) {
- flog_err(LIB_ERR_SYSTEM_CALL,
+ flog_err(EC_LIB_SYSTEM_CALL,
"fcntl(F_GETFL) failed for fd %d: %s", fd,
safe_strerror(errno));
return -1;
}
if (fcntl(fd, F_SETFL, (flags | O_NONBLOCK)) < 0) {
- flog_err(LIB_ERR_SYSTEM_CALL,
+ flog_err(EC_LIB_SYSTEM_CALL,
"fcntl failed setting fd %d non-blocking: %s", fd,
safe_strerror(errno));
return -1;
diff --git a/lib/pid_output.c b/lib/pid_output.c
index c6120de86..b0643c4fe 100644
--- a/lib/pid_output.c
+++ b/lib/pid_output.c
@@ -42,7 +42,7 @@ pid_t pid_output(const char *path)
oldumask = umask(0777 & ~PIDFILE_MASK);
fd = open(path, O_RDWR | O_CREAT, PIDFILE_MASK);
if (fd < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't create pid lock file %s (%s), exiting",
path, safe_strerror(errno));
umask(oldumask);
@@ -59,7 +59,7 @@ pid_t pid_output(const char *path)
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &lock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Could not lock pid_file %s (%s), exiting",
path, safe_strerror(errno));
exit(1);
@@ -69,12 +69,12 @@ pid_t pid_output(const char *path)
pidsize = strlen(buf);
if ((tmp = write(fd, buf, pidsize)) != (int)pidsize)
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Could not write pid %d to pid_file %s, rc was %d: %s",
(int)pid, path, tmp, safe_strerror(errno));
else if (ftruncate(fd, pidsize) < 0)
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Could not truncate pid_file %s to %u bytes: %s",
path, (unsigned int)pidsize,
safe_strerror(errno));
diff --git a/lib/prefix.c b/lib/prefix.c
index a7f4fda1b..f5d40d8c0 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -657,7 +657,7 @@ 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 {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"prefix_copy(): Unknown address family %d",
src->family);
assert(0);
diff --git a/lib/privs.c b/lib/privs.c
index d77a63a2d..838ff8fc9 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -290,7 +290,7 @@ zebra_privs_current_t zprivs_state_caps(void)
zprivs_state.syscaps_p->caps[i], CAP_EFFECTIVE,
&val)) {
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"zprivs_state_caps: could not cap_get_flag, %s",
safe_strerror(errno));
return ZPRIVS_UNKNOWN;
diff --git a/lib/routemap.c b/lib/routemap.c
index 9e3dd3c0a..66c15b9f2 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1447,7 +1447,7 @@ route_map_result_t route_map_apply(struct route_map *map,
if (recursion > RMAP_RECURSION_LIMIT) {
flog_warn(
- LIB_WARN_RMAP_RECURSION_LIMIT,
+ EC_LIB_RMAP_RECURSION_LIMIT,
"route-map recursion limit (%d) reached, discarding route",
RMAP_RECURSION_LIMIT);
recursion = 0;
diff --git a/lib/sigevent.c b/lib/sigevent.c
index 115781af5..57b41503e 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -84,7 +84,7 @@ int quagga_sigevent_process(void)
sigdelset(&newmask, SIGKILL);
if ((sigprocmask(SIG_BLOCK, &newmask, &oldmask)) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"quagga_signal_timer: couldnt block signals!");
return -1;
}
@@ -330,7 +330,7 @@ static void trap_default_signals(void)
if (sigaction(sigmap[i].sigs[j], &act, NULL)
< 0)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Unable to set signal handler for signal %d: %s",
sigmap[i].sigs[j],
safe_strerror(errno));
diff --git a/lib/skiplist.c b/lib/skiplist.c
index 585cf859e..baef7a381 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -183,7 +183,7 @@ int skiplist_insert(register struct skiplist *l, register void *key,
/* DEBUG */
if (!key) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: key is 0, value is %p",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: key is 0, value is %p",
__func__, value);
}
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 25e9973e5..e878ae1dd 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -38,7 +38,7 @@ void setsockopt_so_recvbuf(int sock, int size)
size /= 2;
if (size != orig_req)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: fd %d: SO_RCVBUF set to %d (requested %d)",
__func__, sock, size, orig_req);
}
@@ -52,7 +52,7 @@ void setsockopt_so_sendbuf(const int sock, int size)
size /= 2;
if (size != orig_req)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: fd %d: SO_SNDBUF set to %d (requested %d)",
__func__, sock, size, orig_req);
}
@@ -64,7 +64,7 @@ int getsockopt_so_sendbuf(const int sock)
int ret = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optval,
&optlen);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"fd %d: can't getsockopt SO_SNDBUF: %d (%s)", sock,
errno, safe_strerror(errno));
return ret;
@@ -94,13 +94,13 @@ int setsockopt_ipv6_pktinfo(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IPV6_RECVPKTINFO : %s",
safe_strerror(errno));
#else /*RFC2292*/
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &val, sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_PKTINFO : %s",
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_PKTINFO : %s",
safe_strerror(errno));
#endif /* INIA_IPV6 */
return ret;
@@ -117,7 +117,7 @@ int setsockopt_ipv6_checksum(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_CHECKSUM, &val, sizeof(val));
#endif /* GNU_LINUX */
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_CHECKSUM");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_CHECKSUM");
return ret;
}
@@ -129,7 +129,7 @@ int setsockopt_ipv6_multicast_hops(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IPV6_MULTICAST_HOPS");
return ret;
}
@@ -142,7 +142,7 @@ int setsockopt_ipv6_unicast_hops(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_UNICAST_HOPS");
return ret;
}
@@ -154,11 +154,11 @@ int setsockopt_ipv6_hoplimit(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_RECVHOPLIMIT");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_RECVHOPLIMIT");
#else /*RFC2292*/
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_HOPLIMIT, &val, sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IPV6_HOPLIMIT");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IPV6_HOPLIMIT");
#endif
return ret;
}
@@ -171,7 +171,7 @@ int setsockopt_ipv6_multicast_loop(int sock, int val)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IPV6_MULTICAST_LOOP");
return ret;
}
@@ -193,7 +193,7 @@ int setsockopt_ipv6_tclass(int sock, int tclass)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, &tclass,
sizeof(tclass));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IPV6_TCLASS option for fd %d to %#x: %s",
sock, tclass, safe_strerror(errno));
#endif
@@ -397,7 +397,7 @@ int setsockopt_ipv4_multicast_loop(int sock, uint8_t val)
ret = setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val,
sizeof(val));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET, "can't setsockopt IP_MULTICAST_LOOP");
+ flog_err(EC_LIB_SOCKET, "can't setsockopt IP_MULTICAST_LOOP");
return ret;
}
@@ -409,13 +409,13 @@ static int setsockopt_ipv4_ifindex(int sock, ifindex_t val)
#if defined(IP_PKTINFO)
if ((ret = setsockopt(sock, IPPROTO_IP, IP_PKTINFO, &val, sizeof(val)))
< 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_PKTINFO option for fd %d to %d: %s",
sock, val, safe_strerror(errno));
#elif defined(IP_RECVIF)
if ((ret = setsockopt(sock, IPPROTO_IP, IP_RECVIF, &val, sizeof(val)))
< 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_RECVIF option for fd %d to %d: %s", sock,
val, safe_strerror(errno));
#else
@@ -435,7 +435,7 @@ int setsockopt_ipv4_tos(int sock, int tos)
ret = setsockopt(sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_TOS option for fd %d to %#x: %s", sock,
tos, safe_strerror(errno));
return ret;
@@ -454,7 +454,7 @@ int setsockopt_ifindex(int af, int sock, ifindex_t val)
ret = setsockopt_ipv6_pktinfo(sock, val);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"setsockopt_ifindex: unknown address family %d", af);
}
return ret;
@@ -544,7 +544,7 @@ ifindex_t getsockopt_ifindex(int af, struct msghdr *msgh)
return (getsockopt_ipv6_ifindex(msgh));
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"getsockopt_ifindex: unknown address family %d", af);
return 0;
}
@@ -660,7 +660,7 @@ int sockopt_tcp_signature(int sock, union sockunion *su, const char *password)
ret = 0;
else
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"sockopt_tcp_signature: setsockopt(%d): %s",
sock, safe_strerror(errno));
}
diff --git a/lib/sockunion.c b/lib/sockunion.c
index f4e806e92..d76c407f5 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -140,7 +140,7 @@ int sockunion_socket(const union sockunion *su)
sock = socket(su->sa.sa_family, SOCK_STREAM, 0);
if (sock < 0) {
char buf[SU_ADDRSTRLEN];
- flog_err(LIB_ERR_SOCKET, "Can't make socket for %s : %s",
+ flog_err(EC_LIB_SOCKET, "Can't make socket for %s : %s",
sockunion_log(su, buf, SU_ADDRSTRLEN),
safe_strerror(errno));
return -1;
@@ -235,7 +235,7 @@ int sockunion_stream_socket(union sockunion *su)
sock = socket(su->sa.sa_family, SOCK_STREAM, 0);
if (sock < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't make socket sockunion_stream_socket");
return sock;
@@ -274,7 +274,7 @@ int sockunion_bind(int sock, union sockunion *su, unsigned short port,
ret = bind(sock, (struct sockaddr *)su, size);
if (ret < 0) {
char buf[SU_ADDRSTRLEN];
- flog_err(LIB_ERR_SOCKET, "can't bind socket for %s : %s",
+ flog_err(EC_LIB_SOCKET, "can't bind socket for %s : %s",
sockunion_log(su, buf, SU_ADDRSTRLEN),
safe_strerror(errno));
}
@@ -290,7 +290,7 @@ int sockopt_reuseaddr(int sock)
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt SO_REUSEADDR to socket %d", sock);
return -1;
}
@@ -306,7 +306,7 @@ int sockopt_reuseport(int sock)
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void *)&on,
sizeof(on));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt SO_REUSEPORT to socket %d", sock);
return -1;
}
@@ -328,7 +328,7 @@ int sockopt_ttl(int family, int sock, int ttl)
ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&ttl,
sizeof(int));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt IP_TTL %d to socket %d",
ttl, sock);
return -1;
@@ -341,7 +341,7 @@ int sockopt_ttl(int family, int sock, int ttl)
(void *)&ttl, sizeof(int));
if (ret < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IPV6_UNICAST_HOPS %d to socket %d",
ttl, sock);
return -1;
@@ -389,7 +389,7 @@ int sockopt_minttl(int family, int sock, int minttl)
sizeof(minttl));
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IP_MINTTL to %d on socket %d: %s",
minttl, sock, safe_strerror(errno));
return ret;
@@ -401,7 +401,7 @@ int sockopt_minttl(int family, int sock, int minttl)
&minttl, sizeof(minttl));
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s",
minttl, sock, safe_strerror(errno));
return ret;
@@ -421,7 +421,7 @@ int sockopt_v6only(int family, int sock)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on,
sizeof(int));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt IPV6_V6ONLY "
"to socket %d",
sock);
@@ -539,7 +539,7 @@ union sockunion *sockunion_getsockname(int fd)
ret = getsockname(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't get local address and port by getsockname: %s",
safe_strerror(errno));
return NULL;
@@ -576,7 +576,7 @@ union sockunion *sockunion_getpeername(int fd)
len = sizeof name;
ret = getpeername(fd, (struct sockaddr *)&name, &len);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't get remote address and port: %s",
safe_strerror(errno));
return NULL;
diff --git a/lib/stream.c b/lib/stream.c
index 8424a941d..21c02a5f5 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -54,7 +54,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
* using stream_put..._at() functions.
*/
#define STREAM_WARN_OFFSETS(S) \
- flog_warn(LIB_WARN_STREAM, \
+ flog_warn(EC_LIB_STREAM, \
"&(struct stream): %p, size: %lu, getp: %lu, endp: %lu\n", \
(void *)(S), (unsigned long)(S)->size, \
(unsigned long)(S)->getp, (unsigned long)(S)->endp)
@@ -69,7 +69,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
#define STREAM_BOUND_WARN(S, WHAT) \
do { \
- flog_warn(LIB_WARN_STREAM, "%s: Attempt to %s out of bounds", \
+ flog_warn(EC_LIB_STREAM, "%s: Attempt to %s out of bounds", \
__func__, (WHAT)); \
STREAM_WARN_OFFSETS(S); \
assert(0); \
@@ -77,7 +77,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
#define STREAM_BOUND_WARN2(S, WHAT) \
do { \
- flog_warn(LIB_WARN_STREAM, "%s: Attempt to %s out of bounds", \
+ flog_warn(EC_LIB_STREAM, "%s: Attempt to %s out of bounds", \
__func__, (WHAT)); \
STREAM_WARN_OFFSETS(S); \
} while (0)
@@ -87,7 +87,7 @@ DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
do { \
if (((S)->endp + (Z)) > (S)->size) { \
flog_warn( \
- LIB_WARN_STREAM, \
+ EC_LIB_STREAM, \
"CHECK_SIZE: truncating requested size %lu\n", \
(unsigned long)(Z)); \
STREAM_WARN_OFFSETS(S); \
@@ -968,7 +968,7 @@ ssize_t stream_read_try(struct stream *s, int fd, size_t size)
/* Error: was it transient (return -2) or fatal (return -1)? */
if (ERRNO_IO_RETRY(errno))
return -2;
- flog_err(LIB_ERR_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
+ flog_err(EC_LIB_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
safe_strerror(errno));
return -1;
}
@@ -999,7 +999,7 @@ ssize_t stream_recvfrom(struct stream *s, int fd, size_t size, int flags,
/* Error: was it transient (return -2) or fatal (return -1)? */
if (ERRNO_IO_RETRY(errno))
return -2;
- flog_err(LIB_ERR_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
+ flog_err(EC_LIB_SOCKET, "%s: read failed on fd %d: %s", __func__, fd,
safe_strerror(errno));
return -1;
}
diff --git a/lib/thread.c b/lib/thread.c
index b2740baf5..2c3db27c7 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1481,7 +1481,7 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch)
}
/* else die */
- flog_err(LIB_ERR_SYSTEM_CALL, "poll() error: %s",
+ flog_err(EC_LIB_SYSTEM_CALL, "poll() error: %s",
safe_strerror(errno));
pthread_mutex_unlock(&m->mtx);
fetch = NULL;
@@ -1620,7 +1620,7 @@ void thread_call(struct thread *thread)
* to fix.
*/
flog_warn(
- LIB_WARN_SLOW_THREAD,
+ EC_LIB_SLOW_THREAD,
"SLOW THREAD: task %s (%lx) ran for %lums (cpu time %lums)",
thread->funcname, (unsigned long)thread->func,
realtime / 1000, cputime / 1000);
diff --git a/lib/vrf.c b/lib/vrf.c
index 4b7e84275..f4fdd5342 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -489,7 +489,7 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
/* The default VRF always exists. */
default_vrf = vrf_get(VRF_DEFAULT, VRF_DEFAULT_NAME);
if (!default_vrf) {
- flog_err(LIB_ERR_VRF_START,
+ flog_err(EC_LIB_VRF_START,
"vrf_init: failed to create the default VRF!");
exit(1);
}
@@ -505,7 +505,7 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
/* Enable the default VRF. */
if (!vrf_enable(default_vrf)) {
- flog_err(LIB_ERR_VRF_START,
+ flog_err(EC_LIB_VRF_START,
"vrf_init: failed to enable the default VRF!");
exit(1);
}
@@ -576,7 +576,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
if (ret > 0 && interfacename && vrf_default_accepts_vrf(type)) {
@@ -590,7 +590,7 @@ int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
@@ -631,7 +631,7 @@ int vrf_handler_create(struct vty *vty, const char *vrfname,
vrfname, VRF_NAMSIZ);
else
flog_warn(
- LIB_WARN_VRF_LENGTH,
+ EC_LIB_VRF_LENGTH,
"%% VRF name %s invalid: length exceeds %d bytes\n",
vrfname, VRF_NAMSIZ);
return CMD_WARNING_CONFIG_FAILED;
@@ -961,13 +961,13 @@ int vrf_getaddrinfo(const char *node, const char *service,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
ret = getaddrinfo(node, service, hints, res);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
@@ -980,7 +980,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params)
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
return 0;
}
@@ -988,7 +988,7 @@ int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *params)
saved_errno = errno;
ret = vrf_switchback_to_initial();
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = saved_errno;
@@ -1002,13 +1002,13 @@ int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id,
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "%s: Can't switch to VRF %u (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Can't switch to VRF %u (%s)",
__func__, vrf_id, safe_strerror(errno));
ret = sockunion_socket(su);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Can't switchback from VRF %u (%s)", __func__,
vrf_id, safe_strerror(errno));
errno = save_errno;
diff --git a/lib/vty.c b/lib/vty.c
index 921f92df1..1831c117e 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -314,7 +314,7 @@ static int vty_log_out(struct vty *vty, const char *level,
/* Fatal I/O error. */
vty->monitor =
0; /* disable monitoring to avoid infinite recursion */
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"%s: write failed to vty client fd %d, closing: %s",
__func__, vty->fd, safe_strerror(errno));
buffer_reset(vty->obuf);
@@ -536,7 +536,7 @@ static int vty_command(struct vty *vty, char *buf)
> CONSUMED_TIME_CHECK)
/* Warn about CPU hog that must be fixed. */
flog_warn(
- LIB_WARN_SLOW_THREAD,
+ EC_LIB_SLOW_THREAD,
"SLOW COMMAND: command took %lums (cpu time %lums): %s",
realtime / 1000, cputime / 1000, buf);
}
@@ -1329,14 +1329,14 @@ static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes)
case TELOPT_NAWS:
if (vty->sb_len != TELNET_NAWS_SB_LEN)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"RFC 1073 violation detected: telnet NAWS option "
"should send %d characters, but we received %lu",
TELNET_NAWS_SB_LEN,
(unsigned long)vty->sb_len);
else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN)
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_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);
@@ -1452,7 +1452,7 @@ static int vty_read(struct thread *thread)
vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: read error on vty client fd %d, closing: %s",
__func__, vty->fd, safe_strerror(errno));
buffer_reset(vty->obuf);
@@ -1906,7 +1906,7 @@ static int vty_accept(struct thread *thread)
/* We can handle IPv4 or IPv6 socket. */
vty_sock = sockunion_accept(accept_sock, &su);
if (vty_sock < 0) {
- flog_err(LIB_ERR_SOCKET, "can't accept vty socket : %s",
+ flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno));
return -1;
}
@@ -1980,7 +1980,7 @@ static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port)
ret = getaddrinfo(hostname, port_str, &req, &ainfo);
if (ret != 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "getaddrinfo failed: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "getaddrinfo failed: %s",
gai_strerror(ret));
exit(1);
}
@@ -2041,7 +2041,7 @@ static void vty_serv_un(const char *path)
/* Make UNIX domain socket. */
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Cannot create unix stream socket: %s",
safe_strerror(errno));
return;
@@ -2061,7 +2061,7 @@ static void vty_serv_un(const char *path)
ret = bind(sock, (struct sockaddr *)&serv, len);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Cannot bind path %s: %s", path,
+ flog_err_sys(EC_LIB_SOCKET, "Cannot bind path %s: %s", path,
safe_strerror(errno));
close(sock); /* Avoid sd leak. */
return;
@@ -2069,7 +2069,7 @@ static void vty_serv_un(const char *path)
ret = listen(sock, 5);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "listen(fd %d) failed: %s", sock,
+ flog_err_sys(EC_LIB_SOCKET, "listen(fd %d) failed: %s", sock,
safe_strerror(errno));
close(sock); /* Avoid sd leak. */
return;
@@ -2085,7 +2085,7 @@ static void vty_serv_un(const char *path)
if ((int)ids.gid_vty > 0) {
/* set group of socket */
if (chown(path, -1, ids.gid_vty)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"vty_serv_un: could chown socket, %s",
safe_strerror(errno));
}
@@ -2115,14 +2115,14 @@ static int vtysh_accept(struct thread *thread)
(socklen_t *)&client_len);
if (sock < 0) {
- flog_err(LIB_ERR_SOCKET, "can't accept vty socket : %s",
+ flog_err(EC_LIB_SOCKET, "can't accept vty socket : %s",
safe_strerror(errno));
return -1;
}
if (set_nonblocking(sock) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"vtysh_accept: could not set vty socket %d to non-blocking, %s, closing",
sock, safe_strerror(errno));
close(sock);
@@ -2154,7 +2154,7 @@ static int vtysh_flush(struct vty *vty)
case BUFFER_ERROR:
vty->monitor =
0; /* disable monitoring to avoid infinite recursion */
- flog_err(LIB_ERR_SOCKET, "%s: write error to fd %d, closing",
+ flog_err(EC_LIB_SOCKET, "%s: write error to fd %d, closing",
__func__, vty->fd);
buffer_reset(vty->lbuf);
buffer_reset(vty->obuf);
@@ -2190,7 +2190,7 @@ static int vtysh_read(struct thread *thread)
vty->monitor = 0; /* disable monitoring to avoid
infinite recursion */
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: read failed on vtysh client fd %d, closing: %s",
__func__, sock, safe_strerror(errno));
}
@@ -2420,7 +2420,7 @@ static void vty_read_file(FILE *confp)
nl = strchr(vty->error_buf, '\n');
if (nl)
*nl = '\0';
- flog_err(LIB_ERR_VTY,
+ flog_err(EC_LIB_VTY,
"ERROR: %s on config line %u: %s", message, line_num,
vty->error_buf);
}
@@ -2496,7 +2496,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
if (!IS_DIRECTORY_SEP(config_file[0])) {
if (getcwd(cwd, MAXPATHLEN) == NULL) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"Failure to determine Current Working Directory %d!",
errno);
exit(1);
@@ -2512,17 +2512,17 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
if (confp == NULL) {
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"%s: failed to open configuration file %s: %s, checking backup",
__func__, fullpath, safe_strerror(errno));
confp = vty_use_backup_config(fullpath);
if (confp)
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"WARNING: using backup configuration file!");
else {
- flog_err(LIB_ERR_VTY,
+ flog_err(EC_LIB_VTY,
"can't open configuration file [%s]",
config_file);
exit(1);
@@ -2561,7 +2561,7 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
confp = fopen(config_default_dir, "r");
if (confp == NULL) {
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: failed to open configuration file %s: %s, checking backup",
__func__, config_default_dir,
safe_strerror(errno));
@@ -2569,11 +2569,11 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
confp = vty_use_backup_config(config_default_dir);
if (confp) {
flog_warn(
- LIB_WARN_BACKUP_CONFIG,
+ EC_LIB_BACKUP_CONFIG,
"WARNING: using backup configuration file!");
fullpath = config_default_dir;
} else {
- flog_err(LIB_ERR_VTY,
+ flog_err(EC_LIB_VTY,
"can't open configuration file [%s]",
config_default_dir);
goto tmp_free_and_out;
@@ -3088,13 +3088,13 @@ static void vty_save_cwd(void)
* Hence not worrying about it too much.
*/
if (!chdir(SYSCONFDIR)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Failure to chdir to %s, errno: %d",
SYSCONFDIR, errno);
exit(-1);
}
if (getcwd(cwd, MAXPATHLEN) == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Failure to getcwd, errno: %d", errno);
exit(-1);
}
diff --git a/lib/zclient.c b/lib/zclient.c
index 340eb0db3..56c47d2b1 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -250,7 +250,7 @@ static int zclient_flush_data(struct thread *thread)
switch (buffer_flush_available(zclient->wb, zclient->sock)) {
case BUFFER_ERROR:
flog_err(
- LIB_ERR_ZAPI_SOCKET,
+ EC_LIB_ZAPI_SOCKET,
"%s: buffer_flush_available failed on zclient fd %d, closing",
__func__, zclient->sock);
return zclient_failed(zclient);
@@ -274,7 +274,7 @@ int zclient_send_message(struct zclient *zclient)
STREAM_DATA(zclient->obuf),
stream_get_endp(zclient->obuf))) {
case BUFFER_ERROR:
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"%s: buffer_write failed to zclient fd %d, closing",
__func__, zclient->sock);
return zclient_failed(zclient);
@@ -315,7 +315,7 @@ int zclient_read_header(struct stream *s, int sock, uint16_t *size,
STREAM_GETW(s, *cmd);
if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: socket %d version mismatch, marker %d, version %d",
__func__, sock, *marker, *version);
return -1;
@@ -577,7 +577,7 @@ int zclient_start(struct zclient *zclient)
}
if (set_nonblocking(zclient->sock) < 0)
- flog_err(LIB_ERR_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed",
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed",
__func__, zclient->sock);
/* Clear fail count. */
@@ -774,7 +774,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: prefix %s: can't encode %u nexthops (maximum is %u)",
__func__, buf, api->nexthop_num, MULTIPATH_NUM);
return -1;
@@ -818,7 +818,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
char buf[PREFIX2STR_BUFFER];
prefix2str(&api->prefix, buf,
sizeof(buf));
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: prefix %s: can't encode "
"%u labels (maximum is %u)",
__func__, buf,
@@ -868,7 +868,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
/* Type, flags, message. */
STREAM_GETC(s, api->type);
if (api->type > ZEBRA_ROUTE_MAX) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified route type: %d is not a legal value\n",
__PRETTY_FUNCTION__, api->type);
return -1;
@@ -886,7 +886,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
case AF_INET:
if (api->prefix.prefixlen > IPV4_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: V4 prefixlen is %d which should not be more than 32",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
return -1;
@@ -895,14 +895,14 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
case AF_INET6:
if (api->prefix.prefixlen > IPV6_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: v6 prefixlen is %d which should not be more than 128",
__PRETTY_FUNCTION__, api->prefix.prefixlen);
return -1;
}
break;
default:
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Specified family %d is not v4 or v6",
__PRETTY_FUNCTION__, api->prefix.family);
return -1;
@@ -914,7 +914,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
STREAM_GETC(s, api->src_prefix.prefixlen);
if (api->src_prefix.prefixlen > IPV6_MAX_PREFIXLEN) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: SRC Prefix prefixlen received: %d is too large",
__PRETTY_FUNCTION__, api->src_prefix.prefixlen);
return -1;
@@ -925,7 +925,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api->prefix.family != AF_INET6
|| api->src_prefix.prefixlen == 0) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: SRC prefix specified in some manner that makes no sense",
__PRETTY_FUNCTION__);
return -1;
@@ -936,7 +936,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
STREAM_GETW(s, api->nexthop_num);
if (api->nexthop_num > MULTIPATH_NUM) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: invalid number of nexthops (%u)",
__func__, api->nexthop_num);
return -1;
@@ -978,7 +978,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (api_nh->label_num > MPLS_MAX_LABELS) {
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: invalid number of MPLS labels (%u)",
__func__, api_nh->label_num);
return -1;
@@ -1238,7 +1238,7 @@ bool zapi_nexthop_update_decode(struct stream *s, struct zapi_route *nhr)
}
STREAM_GETC(s, nhr->nexthops[i].label_num);
if (nhr->nexthops[i].label_num > MPLS_MAX_LABELS) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: invalid number of MPLS labels (%u)",
__func__, nhr->nexthops[i].label_num);
return false;
@@ -1424,7 +1424,7 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
/* Lookup this by interface index. */
ifp = if_lookup_by_name(ifname_tmp, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_STATE: Cannot find IF %s in VRF %d",
ifname_tmp, vrf_id);
return NULL;
@@ -1451,7 +1451,7 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp)
for (i = 0; i < bwclassnum && i < MAX_CLASS_TYPE; i++)
iflp->unrsv_bw[i] = stream_getf(s);
if (i < bwclassnum)
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: received %d > %d (MAX_CLASS_TYPE) bw entries"
" - outdated library?",
__func__, bwclassnum, MAX_CLASS_TYPE);
@@ -1483,7 +1483,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s)
struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: unknown ifindex %u, shouldn't happen", __func__,
ifindex);
return NULL;
@@ -1634,7 +1634,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
/* Lookup index. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_ADDRESS_%s: Cannot find IF %u in VRF %d",
(type == ZEBRA_INTERFACE_ADDRESS_ADD) ? "ADD" : "DEL",
ifindex, vrf_id);
@@ -1673,7 +1673,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
* "peer" */
char buf[PREFIX_STRLEN];
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"warning: interface %s address %s with peer flag set, but no peer address!",
ifp->name,
prefix2str(ifc->address, buf,
@@ -1727,7 +1727,7 @@ zebra_interface_nbr_address_read(int type, struct stream *s, vrf_id_t vrf_id)
/* Lookup index. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_NBR_%s: Cannot find IF %u in VRF %d",
(type == ZEBRA_INTERFACE_NBR_ADDRESS_ADD) ? "ADD"
: "DELETE",
@@ -1777,7 +1777,7 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
/* Lookup interface. */
ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_VRF_UPDATE: Cannot find IF %u in VRF %d",
ifindex, vrf_id);
return NULL;
@@ -1823,7 +1823,7 @@ static int zclient_read_sync_response(struct zclient *zclient,
size);
}
if (ret != 0) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: Invalid Sync Message Reply", __func__);
return -1;
}
@@ -1866,13 +1866,13 @@ int lm_label_manager_connect(struct zclient *zclient)
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -1893,11 +1893,11 @@ int lm_label_manager_connect(struct zclient *zclient)
/* sanity */
if (proto != zclient->redist_default)
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Wrong proto (%u) in LM connect response. Should be %u",
proto, zclient->redist_default);
if (instance != zclient->instance)
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Wrong instId (%u) in LM connect response. Should be %u",
instance, zclient->instance);
@@ -1988,14 +1988,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"Zclient sock closed");
close(zclient->sock);
zclient->sock = -1;
@@ -2017,11 +2017,11 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* sanities */
if (proto != zclient->redist_default)
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Wrong proto (%u) in get chunk response. Should be %u",
proto, zclient->redist_default);
if (instance != zclient->instance)
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Wrong instId (%u) in get chunk response Should be %u",
instance, zclient->instance);
@@ -2033,14 +2033,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* not owning this response */
if (keep != response_keep) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Invalid Label chunk: %u - %u, keeps mismatch %u != %u",
*start, *end, keep, response_keep);
}
/* sanity */
if (*start > *end || *start < MPLS_LABEL_UNRESERVED_MIN
|| *end > MPLS_LABEL_UNRESERVED_MAX) {
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"Invalid Label chunk: %u - %u", *start, *end);
return -1;
}
@@ -2091,13 +2091,13 @@ int lm_release_label_chunk(struct zclient *zclient, uint32_t start,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock");
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"Zclient sock connection closed");
close(zclient->sock);
zclient->sock = -1;
@@ -2201,14 +2201,14 @@ int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size,
ret = writen(zclient->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"%s: can't write to zclient->sock", __func__);
close(zclient->sock);
zclient->sock = -1;
return -1;
}
if (ret == 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"%s: zclient->sock connection closed", __func__);
close(zclient->sock);
zclient->sock = -1;
@@ -2295,7 +2295,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw)
stream_write(s, (uint8_t *)&pw->nexthop.ipv6, 16);
break;
default:
- flog_err(LIB_ERR_ZAPI_ENCODE,
+ flog_err(EC_LIB_ZAPI_ENCODE,
"%s: unknown af", __func__);
return -1;
}
@@ -2398,14 +2398,14 @@ static int zclient_read(struct thread *thread)
command = stream_getw(zclient->ibuf);
if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: socket %d version mismatch, marker %d, version %d",
__func__, zclient->sock, marker, version);
return zclient_failed(zclient);
}
if (length < ZEBRA_HEADER_SIZE) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: socket %d message length %u is less than %d ",
__func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
return zclient_failed(zclient);
@@ -2415,7 +2415,7 @@ static int zclient_read(struct thread *thread)
if (length > STREAM_SIZE(zclient->ibuf)) {
struct stream *ns;
flog_err(
- LIB_ERR_ZAPI_ENCODE,
+ EC_LIB_ZAPI_ENCODE,
"%s: message size %u exceeds buffer size %lu, expanding...",
__func__, length,
(unsigned long)STREAM_SIZE(zclient->ibuf));