summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--babeld/babel_interface.c4
-rw-r--r--babeld/babel_main.c14
-rw-r--r--babeld/babeld.c4
-rw-r--r--bgpd/bgp_flowspec.c2
-rw-r--r--bgpd/bgp_flowspec_util.c2
-rw-r--r--bgpd/bgp_fsm.c6
-rw-r--r--bgpd/bgp_network.c24
-rw-r--r--bgpd/bgp_packet.c2
-rw-r--r--bgpd/bgp_route.c6
-rw-r--r--bgpd/rfapi/rfapi.c4
-rw-r--r--bgpd/rfapi/rfapi_import.c6
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c22
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c8
-rw-r--r--bgpd/rfapi/vnc_zebra.c8
-rw-r--r--eigrpd/eigrp_packet.c4
-rw-r--r--eigrpd/eigrp_topology.c2
-rw-r--r--eigrpd/eigrpd.c2
-rw-r--r--isisd/isis_lsp.c6
-rw-r--r--isisd/isis_pdu.c2
-rw-r--r--isisd/isis_spf_private.h2
-rw-r--r--ldpd/ldpd.c2
-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
-rw-r--r--ospf6d/ospf6_message.c4
-rw-r--r--ospf6d/ospf6_network.c2
-rw-r--r--ospf6d/ospf6_route.c4
-rw-r--r--ospf6d/ospf6_spf.c2
-rw-r--r--ospf6d/ospf6_zebra.c2
-rw-r--r--ospfd/ospf_network.c24
-rw-r--r--ospfd/ospf_packet.c4
-rw-r--r--ospfd/ospfd.c2
-rw-r--r--pimd/pim_igmp.c4
-rw-r--r--pimd/pim_igmpv3.c2
-rw-r--r--pimd/pim_msdp.c2
-rw-r--r--pimd/pim_msdp_packet.c2
-rw-r--r--pimd/pim_msdp_socket.c26
-rw-r--r--pimd/pim_neighbor.c2
-rw-r--r--pimd/pim_rp.c6
-rw-r--r--pimd/pim_sock.c4
-rw-r--r--pimd/pim_ssm.c2
-rw-r--r--pimd/pim_ssmpingd.c4
-rw-r--r--pimd/pim_time.c8
-rw-r--r--pimd/pim_zlookup.c16
-rw-r--r--pimd/pimd.c2
-rw-r--r--ripd/rip_interface.c2
-rw-r--r--ripd/ripd.c2
-rw-r--r--ripngd/ripng_interface.c2
-rw-r--r--ripngd/ripngd.c6
-rw-r--r--watchfrr/watchfrr.c18
-rw-r--r--zebra/if_ioctl.c10
-rw-r--r--zebra/if_ioctl_solaris.c12
-rw-r--r--zebra/if_netlink.c10
-rw-r--r--zebra/interface.c2
-rw-r--r--zebra/ioctl.c4
-rw-r--r--zebra/ioctl_solaris.c4
-rw-r--r--zebra/ipforward_solaris.c6
-rw-r--r--zebra/ipforward_sysctl.c12
-rw-r--r--zebra/irdp_interface.c2
-rw-r--r--zebra/irdp_main.c6
-rw-r--r--zebra/irdp_packet.c8
-rw-r--r--zebra/kernel_netlink.c18
-rw-r--r--zebra/kernel_socket.c6
-rw-r--r--zebra/rt_socket.c4
-rw-r--r--zebra/rtadv.c8
-rw-r--r--zebra/rtread_getmsg.c8
-rw-r--r--zebra/rule_socket.c4
-rw-r--r--zebra/zebra_mpls_openbsd.c14
-rw-r--r--zebra/zebra_netns_id.c10
-rw-r--r--zebra/zebra_netns_notify.c8
-rw-r--r--zebra/zebra_ptm.c6
-rw-r--r--zebra/zserv.c8
94 files changed, 434 insertions, 441 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 22bdf1fe1..7121ca28d 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -729,7 +729,7 @@ interface_recalculate(struct interface *ifp)
rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_JOIN_GROUP,
(char*)&mreq, sizeof(mreq));
if(rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"setsockopt(IPV6_JOIN_GROUP) on interface '%s': %s",
ifp->name, safe_strerror(errno));
/* This is probably due to a missing link-local address,
@@ -793,7 +793,7 @@ interface_reset(struct interface *ifp)
rc = setsockopt(protocol_socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
(char*)&mreq, sizeof(mreq));
if(rc < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"setsockopt(IPV6_LEAVE_GROUP) on interface '%s': %s",
ifp->name, safe_strerror(errno));
}
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index f07576720..d02d86f77 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -225,7 +225,7 @@ babel_init_random(void)
rc = read_random_bytes(&seed, sizeof(seed));
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "read(random): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "read(random): %s",
safe_strerror(errno));
seed = 42;
}
@@ -246,13 +246,13 @@ babel_replace_by_null(int fd)
fd_null = open("/dev/null", O_RDONLY);
if(fd_null < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "open(null): %s", safe_strerror(errno));
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "open(null): %s", safe_strerror(errno));
exit(1);
}
rc = dup2(fd_null, fd);
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "dup2(null, 0): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "dup2(null, 0): %s",
safe_strerror(errno));
exit(1);
}
@@ -272,11 +272,11 @@ babel_load_state_file(void)
fd = open(state_file, O_RDONLY);
if(fd < 0 && errno != ENOENT)
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "open(babel-state: %s)",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "open(babel-state: %s)",
safe_strerror(errno));
rc = unlink(state_file);
if(fd >= 0 && rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "unlink(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "unlink(babel-state): %s",
safe_strerror(errno));
/* If we couldn't unlink it, it's probably stale. */
goto fini;
@@ -288,7 +288,7 @@ babel_load_state_file(void)
long t;
rc = read(fd, buf, 99);
if(rc < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "read(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "read(babel-state): %s",
safe_strerror(errno));
} else {
buf[rc] = '\0';
@@ -353,7 +353,7 @@ babel_save_state_file(void)
debugf(BABEL_DEBUG_COMMON, "Save state file.");
fd = open(state_file, O_WRONLY | O_TRUNC | O_CREAT, 0644);
if(fd < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "creat(babel-state): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "creat(babel-state): %s",
safe_strerror(errno));
unlink(state_file);
} else {
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 18e5b479b..0517cbea6 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -145,7 +145,7 @@ babel_create_routing_process (void)
/* Make socket for Babel protocol. */
protocol_socket = babel_socket(protocol_port);
if (protocol_socket < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Couldn't create link local socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Couldn't create link local socket: %s",
safe_strerror(errno));
goto fail;
}
@@ -179,7 +179,7 @@ babel_read_protocol (struct thread *thread)
(struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0) {
if(errno != EAGAIN && errno != EINTR) {
- flog_err_sys(LIB_ERR_SOCKET, "recv: %s", safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "recv: %s", safe_strerror(errno));
}
} else {
FOR_ALL_INTERFACES(vrf, ifp) {
diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c
index 0560844ec..f0d034071 100644
--- a/bgpd/bgp_flowspec.c
+++ b/bgpd/bgp_flowspec.c
@@ -104,7 +104,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
safi = packet->safi;
if (afi == AFI_IP6) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"BGP flowspec IPv6 not supported");
return -1;
}
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 1ae2a8875..bf523b5e7 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -565,7 +565,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
offset += ret;
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: unknown type %d\n",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: unknown type %d\n",
__func__, type);
}
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f27ea8390..4c418d2c6 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -246,7 +246,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (bgp_getsockname(peer) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%%bgp_getsockname() failed for %s peer %s fd %d (from_peer fd %d)",
(CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)
? "accept"
@@ -259,7 +259,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (from_peer->status > Active) {
if (bgp_getsockname(from_peer) < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%%bgp_getsockname() failed for %s from_peer %s fd %d (peer fd %d)",
(CHECK_FLAG(from_peer->sflags,
@@ -1294,7 +1294,7 @@ static int bgp_connect_success(struct peer *peer)
}
if (bgp_getsockname(peer) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__FUNCTION__, peer->host, peer->fd);
bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index ae78a0064..37838d514 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -149,7 +149,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, peer->ttl);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -165,7 +165,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
ret = sockopt_ttl(peer->su.sa.sa_family, bgp_sock, MAXTTL);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -177,7 +177,7 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
MAXTTL + 1 - peer->gtsm_hops);
if (ret) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d",
__func__,
inet_ntop(AF_INET, &peer->remote_id, buf,
@@ -223,7 +223,7 @@ static int bgp_get_instance_for_inc_conn(int sock, struct bgp **bgp_inst)
if (rc != 0) {
#if defined(HAVE_CUMULUS)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d",
safe_strerror(errno), sock);
return -1;
@@ -280,7 +280,7 @@ static int bgp_accept(struct thread *thread)
/* Register accept thread. */
accept_sock = THREAD_FD(thread);
if (accept_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "accept_sock is nevative value %d",
+ flog_err_sys(EC_LIB_SOCKET, "accept_sock is nevative value %d",
accept_sock);
return -1;
}
@@ -292,7 +292,7 @@ static int bgp_accept(struct thread *thread)
/* Accept client connection. */
bgp_sock = sockunion_accept(accept_sock, &su);
if (bgp_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"[Error] BGP socket accept failed (%s)",
safe_strerror(errno));
return -1;
@@ -659,13 +659,13 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "bind: %s", safe_strerror(en));
+ flog_err_sys(EC_LIB_SOCKET, "bind: %s", safe_strerror(en));
return ret;
}
ret = listen(sock, SOMAXCONN);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "listen: %s",
+ flog_err_sys(EC_LIB_SOCKET, "listen: %s",
safe_strerror(errno));
return ret;
}
@@ -708,7 +708,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
bgp->vrf_id);
}
if (ret != 0) {
- flog_err_sys(LIB_ERR_SOCKET, "getaddrinfo: %s",
+ flog_err_sys(EC_LIB_SOCKET, "getaddrinfo: %s",
gai_strerror(ret));
return -1;
}
@@ -729,7 +729,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
? bgp->name : NULL));
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "socket: %s",
safe_strerror(errno));
continue;
}
@@ -748,10 +748,10 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
freeaddrinfo(ainfo_save);
if (count == 0 && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: no usable addresses please check other programs usage of specified port %d",
__func__, port);
- flog_err_sys(LIB_ERR_SOCKET, "%s: Program cannot continue",
+ flog_err_sys(EC_LIB_SOCKET, "%s: Program cannot continue",
__func__);
exit(-1);
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 4477ec8dc..2e0f3f11c 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1304,7 +1304,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
/* Get sockname. */
if ((ret = bgp_getsockname(peer)) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname() failed for peer: %s",
__FUNCTION__, peer->host);
return BGP_Stop;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 7402deff2..66428279f 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -355,7 +355,7 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri)
if (ri->peer->pcount[table->afi][table->safi])
ri->peer->pcount[table->afi][table->safi]--;
else
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Asked to decrement 0 prefix count for peer");
} else if (BGP_INFO_COUNTABLE(ri)
&& !CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
@@ -9890,11 +9890,11 @@ static int bgp_peer_count_walker(struct thread *t)
if (CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
pc->count[PCOUNT_COUNTED]++;
if (CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Attempting to count but flags say it is unusable");
} else {
if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Not counted but flags say we should");
}
}
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 18c3c6385..bde1c7977 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -3942,7 +3942,7 @@ void *rfapi_rfp_init_group_config_ptr_vty(void *rfp_start_val,
size);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unknown group type=%d",
__func__, type);
/* should never happen */
assert("Unknown type" == NULL);
@@ -4057,7 +4057,7 @@ void *rfapi_rfp_get_group_config_ptr_name(
criteria, search_cb);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Unknown group type=%d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unknown group type=%d",
__func__, type);
/* should never happen */
assert("Unknown type" == NULL);
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index f014f16fc..1c93a68db 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -3033,7 +3033,7 @@ static void rfapiBgpInfoFilteredImportEncap(
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -3492,7 +3492,7 @@ void rfapiBgpInfoFilteredImportVPN(
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -3897,7 +3897,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
default:
/* not expected */
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad safi %d", __func__,
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad safi %d", __func__,
safi);
return rfapiBgpInfoFilteredImportBadSafi;
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 628917564..8fff73e2e 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -188,7 +188,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: can't get afi of route node", __func__);
return;
}
@@ -335,7 +335,7 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
struct prefix ce_nexthop;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi", __func__);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi", __func__);
return;
}
@@ -700,7 +700,7 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp,
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: can't get afi of route node", __func__);
return;
}
@@ -810,7 +810,7 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
afi_t afi = family2afi(rn->p.family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node",
__func__);
return;
}
@@ -926,7 +926,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: can't get afi of nve vn addr", __func__);
return;
}
@@ -979,7 +979,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d",
__func__, afi);
return;
}
@@ -1073,7 +1073,7 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
afi_t afi = family2afi(rfd->vn_addr.addr_family);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: can't get afi of nve vn addr", __func__);
return;
}
@@ -1121,7 +1121,7 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d",
__func__, afi);
return;
}
@@ -1298,7 +1298,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
@@ -1642,7 +1642,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
struct attr *iattr;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: can't get afi of route node", __func__);
return;
}
@@ -1762,7 +1762,7 @@ void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
struct vnc_export_info *eti;
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi route node",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node",
__func__);
return;
}
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index dc37ff89b..e6faf54c1 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -603,7 +603,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
*/
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
__func__);
return;
}
@@ -720,7 +720,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
}
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
__func__);
return;
}
@@ -908,7 +908,7 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
assert(rfg);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
__func__);
return;
}
@@ -2634,7 +2634,7 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
VNC_RHNCK(enter);
if (!afi) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: can't get afi of prefix",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
__func__);
return;
}
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index a93fb6073..8bd680f79 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -571,7 +571,7 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp,
return;
if (rn->p.family != AF_INET && rn->p.family != AF_INET6) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: invalid route node addr family", __func__);
return;
}
@@ -644,7 +644,7 @@ static void vnc_zebra_add_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd,
return;
if (afi != AFI_IP && afi != AFI_IP6) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: invalid vn addr family",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: invalid vn addr family",
__func__);
return;
}
@@ -743,12 +743,12 @@ static void vnc_zebra_add_del_group_afi(struct bgp *bgp,
if (afi == AFI_IP || afi == AFI_IP6) {
rt = import_table->imported_vpn[afi];
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: bad afi %d", __func__, afi);
return;
}
if (!family) {
- flog_err(LIB_ERR_DEVELOPMENT, "%s: computed bad family: %d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: computed bad family: %d",
__func__, family);
return;
}
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 2ace1e2ea..355d9c1d4 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -348,7 +348,7 @@ int eigrp_write(struct thread *thread)
/* Get one packet from queue. */
ep = eigrp_fifo_next(ei->obuf);
if (!ep) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: Interface %s no packet on queue?",
__PRETTY_FUNCTION__, ei->ifp->name);
goto out;
@@ -1214,7 +1214,7 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
stream_putw(s, length);
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: Unexpected prefix length: %d",
__PRETTY_FUNCTION__, pe->destination->prefixlen);
return 0;
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 61eee99f6..8da46ad8f 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -412,7 +412,7 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
}
break;
default:
- flog_err(LIB_ERR_DEVELOPMENT, "%s: Please implement handler",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Please implement handler",
__PRETTY_FUNCTION__);
break;
}
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index 91c0046bb..b30f14f74 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -163,7 +163,7 @@ static struct eigrp *eigrp_new(const char *AS)
if ((eigrp_socket = eigrp_sock_init()) < 0) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"eigrp_new: fatal error: eigrp_sock_init was unable to open a socket");
exit(1);
}
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index e8777e9b5..5f995d024 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -473,7 +473,7 @@ void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
{
if (lsp->own_lsp) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"ISIS-Upd (%s): BUG updating LSP %s still marked as own LSP",
area->area_tag, rawlspid_print(lsp->hdr.lsp_id));
lsp_clear_data(lsp);
@@ -1277,7 +1277,7 @@ static int lsp_regenerate(struct isis_area *area, int level)
lsp = lsp_search(lspid, lspdb);
if (!lsp) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"ISIS-Upd (%s): lsp_regenerate: no L%d LSP found!",
area->area_tag, level);
return ISIS_ERROR;
@@ -1646,7 +1646,7 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level)
lsp = lsp_search(lsp_id, lspdb);
if (!lsp) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"lsp_regenerate_pseudo: no l%d LSP %s found!", level,
rawlspid_print(lsp_id));
return ISIS_ERROR;
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index b50080119..83c30ebbd 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -1423,7 +1423,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
uint8_t max_area_addrs = stream_getc(circuit->rcv_stream);
if (idrp == ISO9542_ESIS) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"No support for ES-IS packet IDRP=%" PRIx8, idrp);
return ISIS_ERROR;
}
diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h
index af552e0ed..109aafb4e 100644
--- a/isisd/isis_spf_private.h
+++ b/isisd/isis_spf_private.h
@@ -321,7 +321,7 @@ static void isis_vertex_id_init(struct isis_vertex *vertex, const void *id,
} else if (VTYPE_IP(vtype)) {
memcpy(&vertex->N.ip, id, sizeof(vertex->N.ip));
} else {
- flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
+ flog_err(EC_LIB_DEVELOPMENT, "Unknown Vertex Type");
}
}
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 935e95959..137d9622d 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -484,7 +484,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
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/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));
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 228a525e7..692de38ec 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1559,7 +1559,7 @@ int ospf6_receive(struct thread *thread)
/* receive message */
len = ospf6_recvmsg(&src, &dst, &ifindex, iovector);
if (len > iobuflen) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Excess message read");
return 0;
}
@@ -1708,7 +1708,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
/* send message */
len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector);
if (len != ntohs(oh->length))
- flog_err(LIB_ERR_DEVELOPMENT, "Could not send entire message");
+ flog_err(EC_LIB_DEVELOPMENT, "Could not send entire message");
}
static uint32_t ospf6_packet_max(struct ospf6_interface *oi)
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index 8988a53e5..8df5f1cc4 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -118,7 +118,7 @@ int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option)
sizeof(mreq6));
if (ret < 0) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"Network: setsockopt (%d) on ifindex %d failed: %s",
option, ifindex, safe_strerror(errno));
return ret;
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 021e825ae..3f064e16f 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -574,8 +574,8 @@ static void route_table_assert(struct ospf6_route_table *table)
if (link_error == 0 && num == table->count)
return;
- flog_err(LIB_ERR_DEVELOPMENT, "PANIC !!");
- flog_err(LIB_ERR_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table);
+ flog_err(EC_LIB_DEVELOPMENT, "PANIC !!");
+ flog_err(EC_LIB_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table);
zlog_debug("table count = %d, real number = %d", table->count, num);
zlog_debug("DUMP START");
for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) {
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 9c13c51b1..fcf3b32ca 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -273,7 +273,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
ifindex = (VERTEX_IS_TYPE(NETWORK, v) ? ospf6_spf_get_ifindex_from_nh(v)
: ROUTER_LSDESC_GET_IFID(lsdesc));
if (ifindex == 0) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"No nexthop ifindex at vertex %s", v->name);
return;
}
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 06a84dcb9..ee356d01c 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -363,7 +363,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
if (ret < 0)
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"zclient_route_send() %s failed: %s",
(type == REM ? "delete" : "add"),
safe_strerror(errno));
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index ed11f4535..d59c482e5 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -52,7 +52,7 @@ int ospf_if_add_allspfrouters(struct ospf *top, struct prefix *p,
ifindex);
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllSPFRouters): %s; perhaps a kernel limit "
"on # of multicast group memberships has been exceeded?",
@@ -77,7 +77,7 @@ int ospf_if_drop_allspfrouters(struct ospf *top, struct prefix *p,
p->u.prefix4, htonl(OSPF_ALLSPFROUTERS),
ifindex);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllSPFRouters): %s",
top->fd, inet_ntoa(p->u.prefix4), ifindex,
@@ -103,7 +103,7 @@ int ospf_if_add_alldrouters(struct ospf *top, struct prefix *p,
ifindex);
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllDRouters): %s; perhaps a kernel limit "
"on # of multicast group memberships has been exceeded?",
@@ -126,7 +126,7 @@ int ospf_if_drop_alldrouters(struct ospf *top, struct prefix *p,
p->u.prefix4, htonl(OSPF_ALLDROUTERS),
ifindex);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllDRouters): %s",
top->fd, inet_ntoa(p->u.prefix4), ifindex,
@@ -147,7 +147,7 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
/* Prevent receiving self-origined multicast packets. */
ret = setsockopt_ipv4_multicast_loop(top->fd, 0);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s",
top->fd, safe_strerror(errno));
@@ -157,7 +157,7 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
ret = setsockopt(top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val,
len);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s",
top->fd, safe_strerror(errno));
#ifndef GNU_LINUX
@@ -166,7 +166,7 @@ int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex)
*/
ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't setsockopt IP_MULTICAST_IF(fd %d, addr %s, "
"ifindex %u): %s",
top->fd, inet_ntoa(p->u.prefix4), ifindex,
@@ -194,7 +194,7 @@ int ospf_sock_init(struct ospf *ospf)
ospf_sock = vrf_socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP,
ospf->vrf_id, ospf->name);
if (ospf_sock < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"ospf_read_sock_init: socket: %s",
safe_strerror(errno));
exit(1);
@@ -205,7 +205,7 @@ int ospf_sock_init(struct ospf *ospf)
ret = setsockopt(ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl,
sizeof(hincl));
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set IP_HDRINCL option for fd %d: %s",
ospf_sock, safe_strerror(errno));
close(ospf_sock);
@@ -217,7 +217,7 @@ int ospf_sock_init(struct ospf *ospf)
ret = setsockopt_ipv4_tos(ospf_sock,
IPTOS_PREC_INTERNETCONTROL);
if (ret < 0) {
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"can't set sockopt IP_TOS %d to socket %d: %s",
tos, ospf_sock, safe_strerror(errno));
close(ospf_sock); /* Prevent sd leak. */
@@ -225,14 +225,14 @@ int ospf_sock_init(struct ospf *ospf)
}
#else /* !IPTOS_PREC_INTERNETCONTROL */
#warning "IP_HDRINCL not available, nor is IPTOS_PREC_INTERNETCONTROL"
- flog_err(LIB_ERR_UNAVAILABLE,
+ flog_err(EC_LIB_UNAVAILABLE,
"IP_HDRINCL option not available");
#endif /* IP_HDRINCL */
ret = setsockopt_ifindex(AF_INET, ospf_sock, 1);
if (ret < 0)
- flog_err(LIB_ERR_SOCKET,
+ flog_err(EC_LIB_SOCKET,
"Can't set pktinfo option for fd %d",
ospf_sock);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index d8c1bc1a9..672e71326 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -602,7 +602,7 @@ static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph,
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"*** ospf_write_frags: sendmsg failed to %s,"
" id %d, off %d, len %d, mtu %u failed with %s",
inet_ntoa(iph->ip_dst), iph->ip_id, iph->ip_off,
@@ -806,7 +806,7 @@ static int ospf_write(struct thread *thread)
if (ret < 0)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"*** sendmsg in ospf_write failed to %s, "
"id %d, off %d, len %d, interface %s, mtu %u: %s",
inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off,
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index b18c5a93a..d481e9e4c 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -325,7 +325,7 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
if ((ospf_sock_init(new)) < 0) {
if (new->vrf_id != VRF_UNKNOWN)
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: ospf_sock_init is unable to open a socket",
__func__);
return new;
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 270f1e3f2..64537cfa8 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -98,7 +98,7 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
if (!join) {
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"IGMP socket fd=%d could not join any group on interface address %s",
fd, inet_ntoa(ifaddr));
close(fd);
@@ -700,7 +700,7 @@ static void sock_close(struct igmp_sock *igmp)
if (close(igmp->fd)) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s",
inet_ntoa(igmp->ifaddr), igmp->fd,
igmp->interface->name, errno, safe_strerror(errno));
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 7b21376c9..430cba76b 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1585,7 +1585,7 @@ void igmp_v3_send_query(struct igmp_group *group, int fd, const char *ifname,
msg_size = IGMP_V3_SOURCES_OFFSET + (num_sources << 2);
if (msg_size > query_buf_size) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: unable to send: msg_size=%zd larger than query_buf_size=%d",
__FILE__, __PRETTY_FUNCTION__, msg_size,
query_buf_size);
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index 7fcf42e8c..8c6c43edf 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -519,7 +519,7 @@ static void pim_msdp_sa_local_del_on_up_del(struct pim_instance *pim,
* changes; perhaps
* address this in the next release? - XXX */
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"MSDP sa %s SPT teardown is causing the local entry to be removed",
sa->sg_str);
return;
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index 7875f05c9..6208eaef2 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -147,7 +147,7 @@ static void pim_msdp_connect_check(struct pim_msdp_peer *mp)
/* If getsockopt is fail, this is fatal error. */
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"can't get sockopt for nonblocking connect");
pim_msdp_peer_reset_tcp_conn(mp, "connect-failed");
return;
diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c
index 4271f5e61..a521ed568 100644
--- a/pimd/pim_msdp_socket.c
+++ b/pimd/pim_msdp_socket.c
@@ -43,7 +43,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd)
socklen_t optlen = sizeof(optval);
if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"getsockopt of SO_SNDBUF failed %s\n",
safe_strerror(errno));
return;
@@ -52,7 +52,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd)
if (optval < size) {
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size))
< 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Couldn't increase send buffer: %s\n",
safe_strerror(errno));
}
@@ -74,7 +74,7 @@ static int pim_msdp_sock_accept(struct thread *thread)
/* re-register accept thread */
accept_sock = THREAD_FD(thread);
if (accept_sock < 0) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"accept_sock is negative value %d", accept_sock);
return -1;
}
@@ -85,7 +85,7 @@ static int pim_msdp_sock_accept(struct thread *thread)
/* accept client connection. */
msdp_sock = sockunion_accept(accept_sock, &su);
if (msdp_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "pim_msdp_sock_accept failed (%s)",
+ flog_err_sys(EC_LIB_SOCKET, "pim_msdp_sock_accept failed (%s)",
safe_strerror(errno));
return -1;
}
@@ -141,7 +141,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "socket: %s",
safe_strerror(errno));
return sock;
}
@@ -161,14 +161,14 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
struct interface *ifp =
if_lookup_by_name(pim->vrf->name, pim->vrf_id);
if (!ifp) {
- flog_err(LIB_ERR_INTERFACE,
+ flog_err(EC_LIB_INTERFACE,
"%s: Unable to lookup vrf interface: %s",
__PRETTY_FUNCTION__, pim->vrf->name);
close(sock);
return -1;
}
if (pim_socket_bind(sock, ifp)) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Unable to bind to socket: %s",
__PRETTY_FUNCTION__, safe_strerror(errno));
close(sock);
@@ -182,7 +182,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
}
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket bind to port %d: %s",
ntohs(sin.sin_port), safe_strerror(errno));
close(sock);
@@ -191,7 +191,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
rc = listen(sock, 3 /* backlog */);
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "pim_msdp_socket listen: %s",
+ flog_err_sys(EC_LIB_SOCKET, "pim_msdp_socket listen: %s",
safe_strerror(errno));
close(sock);
return rc;
@@ -232,7 +232,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
/* Make socket for the peer. */
mp->fd = sockunion_socket(&mp->su_peer);
if (mp->fd < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket socket failure: %s",
safe_strerror(errno));
return -1;
@@ -242,13 +242,13 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
struct interface *ifp =
if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf_id);
if (!ifp) {
- flog_err(LIB_ERR_INTERFACE,
+ flog_err(EC_LIB_INTERFACE,
"%s: Unable to lookup vrf interface: %s",
__PRETTY_FUNCTION__, mp->pim->vrf->name);
return -1;
}
if (pim_socket_bind(mp->fd, ifp)) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: Unable to bind to socket: %s",
__PRETTY_FUNCTION__, safe_strerror(errno));
close(mp->fd);
@@ -267,7 +267,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
/* source bind */
rc = sockunion_bind(mp->fd, &mp->su_local, 0, &mp->su_local);
if (rc < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"pim_msdp_socket connect bind failure: %s",
safe_strerror(errno));
close(mp->fd);
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 11d847636..bff1e7ff1 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -801,7 +801,7 @@ void pim_neighbor_update(struct pim_neighbor *neigh,
if (neigh->prefix_list == addr_list) {
if (addr_list) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: internal error: trying to replace same prefix list=%p",
__PRETTY_FUNCTION__, (void *)addr_list);
}
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index 031e527eb..07b5e32c9 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -113,7 +113,7 @@ void pim_rp_init(struct pim_instance *pim)
rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info));
if (!str2prefix("224.0.0.0/4", &rp_info->group)) {
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"Unable to convert 224.0.0.0/4 to prefix");
list_delete_and_null(&pim->rp_list);
route_table_finish(pim->rp_table);
@@ -236,7 +236,7 @@ static struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
rn = route_node_match(pim->rp_table, group);
if (!rn) {
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s: BUG We should have found default group information\n",
__PRETTY_FUNCTION__);
return best;
@@ -625,7 +625,7 @@ int pim_rp_del(struct pim_instance *pim, const char *rp,
if (rn) {
if (rn->info != rp_info)
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"Expected rn->info to be equal to rp_info");
if (PIM_DEBUG_TRACE) {
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 1f584a2f9..c4538a4ac 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -151,7 +151,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp,
}
#else
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: Missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()",
__FILE__, __PRETTY_FUNCTION__);
close(fd);
@@ -289,7 +289,7 @@ int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr,
sprintf(ifaddr_str, "<ifaddr?>");
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"Failure socket joining fd=%d group %s on interface address %s: errno=%d: %s",
fd, group_str, ifaddr_str, errno, safe_strerror(errno));
return ret;
diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c
index 8347878d3..d04d90ac8 100644
--- a/pimd/pim_ssm.c
+++ b/pimd/pim_ssm.c
@@ -73,7 +73,7 @@ static int pim_is_grp_standard_ssm(struct prefix *group)
if (first) {
if (!str2prefix(PIM_SSM_STANDARD_RANGE, &group_ssm))
- flog_err(LIB_ERR_DEVELOPMENT,
+ flog_err(EC_LIB_DEVELOPMENT,
"%s: Failure to Read Group Address: %s",
__PRETTY_FUNCTION__, PIM_SSM_STANDARD_RANGE);
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index be30d9c73..a5082608b 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -83,7 +83,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: could not create socket: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -127,7 +127,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
}
#else
flog_err(
- LIB_ERR_DEVELOPMENT,
+ EC_LIB_DEVELOPMENT,
"%s %s: missing IP_PKTINFO and IP_RECVDSTADDR: unable to get dst addr from recvmsg()",
__FILE__, __PRETTY_FUNCTION__);
close(fd);
diff --git a/pimd/pim_time.c b/pimd/pim_time.c
index 029e55116..23c85c2fa 100644
--- a/pimd/pim_time.c
+++ b/pimd/pim_time.c
@@ -35,7 +35,7 @@ static int gettime_monotonic(struct timeval *tv)
result = gettimeofday(tv, 0);
if (result) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettimeofday() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
}
@@ -52,7 +52,7 @@ int64_t pim_time_monotonic_sec()
struct timeval now_tv;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -71,7 +71,7 @@ int64_t pim_time_monotonic_dsec()
int64_t now_dsec;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
@@ -89,7 +89,7 @@ int64_t pim_time_monotonic_usec(void)
int64_t now_dsec;
if (gettime_monotonic(&now_tv)) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: gettime_monotonic() failure: errno=%d: %s",
__PRETTY_FUNCTION__, errno, safe_strerror(errno));
return -1;
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index baa07a8ec..5f0b82792 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -123,7 +123,7 @@ void zclient_lookup_new(void)
{
zlookup = zclient_new_notify(master, &zclient_options_default);
if (!zlookup) {
- flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient_new() failure",
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
__PRETTY_FUNCTION__);
return;
}
@@ -170,7 +170,7 @@ static int zclient_read_nexthop(struct pim_instance *pim,
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: zclient_read_header() failed",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
@@ -315,7 +315,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
/* Check socket. */
if (zlookup->sock < 0) {
- flog_err(LIB_ERR_ZAPI_SOCKET,
+ flog_err(EC_LIB_ZAPI_SOCKET,
"%s: zclient lookup socket is not connected",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
@@ -338,14 +338,14 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
ret = writen(zlookup->sock, s->data, stream_get_endp(s));
if (ret < 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
zclient_lookup_failed(zlookup);
return -2;
}
if (ret == 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s: connection closed on zclient lookup socket",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
@@ -516,7 +516,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
ret = writen(zlookup->sock, s->data, count);
if (ret <= 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
return -1;
@@ -535,7 +535,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- flog_err(LIB_ERR_ZAPI_MISSMATCH,
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: zclient_read_header() failed",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
@@ -553,7 +553,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
more.src = c_oil->oil.mfcc_origin;
more.grp = c_oil->oil.mfcc_mcastgrp;
flog_err(
- LIB_ERR_ZAPI_MISSMATCH,
+ EC_LIB_ZAPI_MISSMATCH,
"%s: Received wrong %s(%s) information requested",
__PRETTY_FUNCTION__, pim_str_sg_dump(&more),
c_oil->pim->vrf->name);
diff --git a/pimd/pimd.c b/pimd/pimd.c
index dd0c7e3c2..5d3018b2f 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -86,7 +86,7 @@ void pim_init()
{
if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s %s: could not solve %s to group address: errno=%d: %s",
__FILE__, __PRETTY_FUNCTION__, PIM_ALL_PIM_ROUTERS,
errno, safe_strerror(errno));
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 5b50c031a..bbac1a0a0 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -865,7 +865,7 @@ static int rip_interface_wakeup(struct thread *t)
/* Join to multicast group. */
if (rip_multicast_join(ifp, rip->sock) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"multicast join failed, interface %s not running",
ifp->name);
return 0;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 8d3a0798f..8cad421c5 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1339,7 +1339,7 @@ static int rip_create_socket(void)
/* Make datagram socket. */
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Cannot create UDP socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Cannot create UDP socket: %s",
safe_strerror(errno));
exit(1);
}
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index d7d3d245d..a1d25f296 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -643,7 +643,7 @@ static int ripng_interface_wakeup(struct thread *t)
/* Join to multicast group. */
if (ripng_multicast_join(ifp) < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"multicast join failed, interface %s not running",
ifp->name);
return 0;
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 850216b44..5a2008de6 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -95,7 +95,7 @@ static int ripng_make_socket(void)
sock = socket(AF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't make ripng socket");
+ flog_err_sys(EC_LIB_SOCKET, "Can't make ripng socket");
return sock;
}
@@ -199,12 +199,12 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
if (ret < 0) {
if (to)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"RIPng send fail on %s to %s: %s",
ifp->name, inet6_ntoa(to->sin6_addr),
safe_strerror(errno));
else
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"RIPng send fail on %s: %s", ifp->name,
safe_strerror(errno));
}
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index 326de1fc4..43cf37079 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -249,7 +249,7 @@ static pid_t run_background(char *shell_cmd)
switch (child = fork()) {
case -1:
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"fork failed, cannot run command [%s]: %s",
shell_cmd, safe_strerror(errno));
return -1;
@@ -265,14 +265,14 @@ static pid_t run_background(char *shell_cmd)
char dashc[] = "-c";
char *const argv[4] = {shell, dashc, shell_cmd, NULL};
execv("/bin/sh", argv);
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"execv(/bin/sh -c '%s') failed: %s",
shell_cmd, safe_strerror(errno));
_exit(127);
}
default:
/* Parent process: we will reap the child later. */
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Forked background command [pid %d]: %s",
(int)child, shell_cmd);
return child;
@@ -334,7 +334,7 @@ static void sigchild(void)
switch (child = waitpid(-1, &status, WNOHANG)) {
case -1:
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "waitpid failed: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "waitpid failed: %s",
safe_strerror(errno));
return;
case 0:
@@ -359,7 +359,7 @@ static void sigchild(void)
gettimeofday(&restart->time, NULL);
} else {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"waitpid returned status for an unknown child process %d",
(int)child);
name = "(unknown)";
@@ -381,7 +381,7 @@ static void sigchild(void)
name, (int)child);
} else
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"cannot interpret %s %s process %d wait status 0x%x",
what, name, (int)child, status);
phase_check();
@@ -698,7 +698,7 @@ static int try_connect(struct daemon *dmn)
of creating a socket. */
if (access(addr.sun_path, W_OK) < 0) {
if (errno != ENOENT)
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s: access to socket %s denied: %s",
dmn->name, addr.sun_path,
safe_strerror(errno));
@@ -706,13 +706,13 @@ static int try_connect(struct daemon *dmn)
}
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s(%s): cannot make socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "%s(%s): cannot make socket: %s",
__func__, addr.sun_path, safe_strerror(errno));
return -1;
}
if (set_nonblocking(sock) < 0 || set_cloexec(sock) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"%s(%s): set_nonblocking/cloexec(%d) failed",
__func__, addr.sun_path, sock);
close(sock);
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 6155e8c4e..f02cc4627 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -58,7 +58,7 @@ static int interface_list_ioctl(void)
/* Normally SIOCGIFCONF works with AF_INET socket. */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't make AF_INET socket stream: %s",
safe_strerror(errno));
return -1;
@@ -88,7 +88,7 @@ static int interface_list_ioctl(void)
ret = ioctl(sock, SIOCGIFCONF, &ifconf);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGIFCONF: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGIFCONF: %s",
safe_strerror(errno));
goto end;
}
@@ -180,7 +180,7 @@ static int if_getaddrs(void)
ret = getifaddrs(&ifap);
if (ret != 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "getifaddrs(): %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "getifaddrs(): %s",
safe_strerror(errno));
return -1;
}
@@ -188,7 +188,7 @@ static int if_getaddrs(void)
for (ifapfree = ifap; ifap; ifap = ifap->ifa_next) {
if (ifap->ifa_addr == NULL) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"%s: nonsensical ifaddr with NULL ifa_addr, ifname %s",
__func__,
(ifap->ifa_name ? ifap->ifa_name : "(null)"));
@@ -197,7 +197,7 @@ static int if_getaddrs(void)
ifp = if_lookup_by_name(ifap->ifa_name, VRF_DEFAULT);
if (ifp == NULL) {
- flog_err(LIB_ERR_INTERFACE,
+ flog_err(EC_LIB_INTERFACE,
"if_getaddrs(): Can't lookup interface %s\n",
ifap->ifa_name);
continue;
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 1f12d4c02..1955881f2 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -65,7 +65,7 @@ static int interface_list_ioctl(int af)
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't make %s socket stream: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't make %s socket stream: %s",
(af == AF_INET ? "AF_INET" : "AF_INET6"),
safe_strerror(errno));
return -1;
@@ -80,7 +80,7 @@ calculate_lifc_len:
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"interface_list_ioctl: SIOCGLIFNUM failed %s",
safe_strerror(errno));
close(sock);
@@ -115,7 +115,7 @@ calculate_lifc_len:
if (errno == EINVAL)
goto calculate_lifc_len;
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFCONF: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFCONF: %s",
safe_strerror(errno));
goto end;
}
@@ -207,7 +207,7 @@ static int if_get_index(struct interface *ifp)
ret = -1;
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
ifp->name);
return ret;
}
@@ -270,7 +270,7 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ret < 0) {
if (errno != EADDRNOTAVAIL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFNETMASK (%s) fail: %s",
ifp->name, safe_strerror(errno));
return ret;
@@ -291,7 +291,7 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
if (ifp->flags & IFF_POINTOPOINT)
prefixlen = IPV6_MAX_BITLEN;
else
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFSUBNET (%s) fail: %s",
ifp->name, safe_strerror(errno));
} else {
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 7953c503f..286931b96 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -82,7 +82,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index,
&& (oifp != ifp)) {
if (ifi_index == IFINDEX_INTERNAL)
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"Netlink is setting interface %s ifindex to reserved internal value %u",
ifp->name, ifi_index);
else {
@@ -92,7 +92,7 @@ static void set_ifindex(struct interface *ifp, ifindex_t ifi_index,
ifi_index, oifp->name, ifp->name);
if (if_is_up(oifp))
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"interface rename detected on up interface: index %d was renamed from %s to %s, results are uncertain!",
ifi_index, oifp->name, ifp->name);
if_delete_update(oifp);
@@ -313,7 +313,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
vrf = vrf_get((vrf_id_t)ifi->ifi_index,
name); // It would create vrf
if (!vrf) {
- flog_err(LIB_ERR_INTERFACE, "VRF %s id %u not created",
+ flog_err(EC_LIB_INTERFACE, "VRF %s id %u not created",
name, ifi->ifi_index);
return;
}
@@ -335,7 +335,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
/* Enable the created VRF. */
if (!vrf_enable(vrf)) {
- flog_err(LIB_ERR_INTERFACE,
+ flog_err(EC_LIB_INTERFACE,
"Failed to enable VRF %s id %u", name,
ifi->ifi_index);
return;
@@ -924,7 +924,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index);
if (ifp == NULL) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"netlink_interface_addr can't find interface by index %d",
ifa->ifa_index);
return -1;
diff --git a/zebra/interface.c b/zebra/interface.c
index 812e36659..ba76674c9 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -699,7 +699,7 @@ void if_delete_update(struct interface *ifp)
if (if_is_up(ifp)) {
flog_err(
- LIB_ERR_INTERFACE,
+ EC_LIB_INTERFACE,
"interface %s vrf %u index %d is still up while being deleted.",
ifp->name, ifp->vrf_id, ifp->ifindex);
return;
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 5c2380cdd..87e98032a 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -397,7 +397,7 @@ void if_get_flags(struct interface *ifp)
ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"vrf_if_ioctl(SIOCGIFFLAGS) failed: %s",
safe_strerror(errno));
return;
@@ -416,7 +416,7 @@ void if_get_flags(struct interface *ifp)
/* Seems not all interfaces implement this ioctl */
if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"if_ioctl(SIOCGIFMEDIA) failed: %s",
safe_strerror(errno));
else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 2f92cf256..fc554219b 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -381,7 +381,7 @@ int if_prefix_add_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- flog_warn(LIB_ERR_DEVELOPMENT, "Can't set %s on interface %s",
+ flog_warn(EC_LIB_DEVELOPMENT, "Can't set %s on interface %s",
prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
@@ -392,7 +392,7 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
{
char addrbuf[PREFIX_STRLEN];
- flog_warn(LIB_ERR_DEVELOPMENT, "Can't delete %s on interface %s",
+ flog_warn(EC_LIB_DEVELOPMENT, "Can't delete %s on interface %s",
prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c
index 7f372e32f..1bb743059 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -71,7 +71,7 @@ static int solaris_nd(const int cmd, const char *parameter, const int value)
else if (cmd == ND_GET)
snprintf(nd_buf, ND_BUFFER_SIZE, "%s", parameter);
else {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"internal error - inappropriate command given to "
"solaris_nd()%s:%d",
__FILE__, __LINE__);
@@ -85,14 +85,14 @@ static int solaris_nd(const int cmd, const char *parameter, const int value)
frr_elevate_privs(&zserv_privs) {
if ((fd = open(device, O_RDWR)) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"failed to open device %s - %s", device,
safe_strerror(errno));
return -1;
}
if (ioctl(fd, I_STR, &strioctl) < 0) {
close(fd);
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"ioctl I_STR failed on device %s - %s",
device, safe_strerror(errno));
return -1;
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 24ebf0a28..fcf86afef 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -43,7 +43,7 @@ int ipforward(void)
len = sizeof ipforwarding;
if (sysctl(mib, MIB_SIZ, &ipforwarding, &len, 0, 0) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "Can't get ipforwarding value");
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "Can't get ipforwarding value");
return -1;
}
return ipforwarding;
@@ -57,7 +57,7 @@ int ipforward_on(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't set ipforwarding on");
return -1;
}
@@ -73,7 +73,7 @@ int ipforward_off(void)
len = sizeof ipforwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"Can't set ipforwarding on");
return -1;
}
@@ -98,7 +98,7 @@ int ipforward_ipv6(void)
len = sizeof ip6forwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, &ip6forwarding, &len, 0, 0) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
@@ -115,7 +115,7 @@ int ipforward_ipv6_on(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
@@ -132,7 +132,7 @@ int ipforward_ipv6_off(void)
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"can't get ip6forwarding value");
return -1;
}
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index f9afe9e65..5fdaae4fe 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -136,7 +136,7 @@ static int if_group(struct interface *ifp, int sock, uint32_t group,
ret = setsockopt(sock, IPPROTO_IP, add_leave, (char *)&m,
sizeof(struct ip_mreq));
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: %s can't setsockopt %s: %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: %s can't setsockopt %s: %s",
add_leave == IP_ADD_MEMBERSHIP ? "join group"
: "leave group",
inet_2a(group, b1), safe_strerror(errno));
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index fe7e58e1a..ce1bfdf50 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -90,7 +90,7 @@ int irdp_sock_init(void)
}
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"IRDP: can't create irdp socket %s",
safe_strerror(save_errno));
return sock;
@@ -99,7 +99,7 @@ int irdp_sock_init(void)
i = 1;
ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&i, sizeof(i));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: can't do irdp sockopt %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
safe_strerror(errno));
close(sock);
return ret;
@@ -107,7 +107,7 @@ int irdp_sock_init(void)
ret = setsockopt_ifindex(AF_INET, sock, 1);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "IRDP: can't do irdp sockopt %s",
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
safe_strerror(errno));
close(sock);
return ret;
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 60fe3dc63..15235f0e4 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -200,17 +200,17 @@ static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex)
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: read error %s",
+ flog_warn(EC_LIB_SOCKET, "IRDP: recvmsg: read error %s",
safe_strerror(errno));
return ret;
}
if (msg.msg_flags & MSG_TRUNC) {
- flog_warn(LIB_ERR_SOCKET, "IRDP: recvmsg: truncated message");
+ flog_warn(EC_LIB_SOCKET, "IRDP: recvmsg: truncated message");
return ret;
}
if (msg.msg_flags & MSG_CTRUNC) {
- flog_warn(LIB_ERR_SOCKET,
+ flog_warn(EC_LIB_SOCKET,
"IRDP: recvmsg: truncated control message");
return ret;
}
@@ -236,7 +236,7 @@ int irdp_read_raw(struct thread *r)
ret = irdp_recvmsg(irdp_sock, (uint8_t *)buf, IRDP_RX_BUF, &ifindex);
if (ret < 0)
- flog_warn(LIB_ERR_SOCKET, "IRDP: RX Error length = %d", ret);
+ flog_warn(EC_LIB_SOCKET, "IRDP: RX Error length = %d", ret);
ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
if (!ifp)
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index cfc369dbc..bcdc35784 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -163,7 +163,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &oldsize, &oldlen);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't get %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -179,7 +179,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = setsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF,
&nl_rcvbufsize, sizeof(nl_rcvbufsize));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't set %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -187,7 +187,7 @@ static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize)
ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &newsize, &newlen);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't get %s receive buffer size: %s", nl->name,
safe_strerror(errno));
return -1;
@@ -234,7 +234,7 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups,
namelen = sizeof snl;
ret = getsockname(sock, (struct sockaddr *)&snl, (socklen_t *)&namelen);
if (ret < 0 || namelen != sizeof snl) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't get %s socket name: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't get %s socket name: %s",
nl->name, safe_strerror(errno));
close(sock);
return -1;
@@ -453,7 +453,7 @@ static void netlink_install_filter(int sock, __u32 pid)
if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog))
< 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't install socket filter: %s\n",
safe_strerror(errno));
}
@@ -723,7 +723,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
}
if (status == 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s EOF", nl->name);
+ flog_err_sys(EC_LIB_SOCKET, "%s EOF", nl->name);
return -1;
}
@@ -972,7 +972,7 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
}
if (status < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink_talk sendmsg() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink_talk sendmsg() error: %s",
safe_strerror(save_errno));
return -1;
}
@@ -995,7 +995,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n)
/* Check netlink socket. */
if (nl->sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "%s socket isn't active.",
+ flog_err_sys(EC_LIB_SOCKET, "%s socket isn't active.",
nl->name);
return -1;
}
@@ -1090,7 +1090,7 @@ void kernel_init(struct zebra_ns *zns)
/* Register kernel socket. */
if (fcntl(zns->netlink.sock, F_SETFL, O_NONBLOCK) < 0)
- flog_err_sys(LIB_ERR_SOCKET, "Can't set %s socket flags: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't set %s socket flags: %s",
zns->netlink.name, safe_strerror(errno));
if (fcntl(zns->netlink_cmd.sock, F_SETFL, O_NONBLOCK) < 0)
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 380b0ade1..a0624413e 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -1252,7 +1252,7 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
if (errno == ESRCH)
return ZEBRA_ERR_RTNOEXIST;
- flog_err_sys(LIB_ERR_SOCKET, "%s: write : %s (%d)", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: write : %s (%d)", __func__,
safe_strerror(errno), errno);
return ZEBRA_ERR_KERNEL;
}
@@ -1335,7 +1335,7 @@ static int kernel_read(struct thread *thread)
if (nbytes <= 0) {
if (nbytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN)
- flog_err_sys(LIB_ERR_SOCKET, "routing socket error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "routing socket error: %s",
safe_strerror(errno));
return 0;
}
@@ -1392,7 +1392,7 @@ static void routing_socket(struct zebra_ns *zns)
}
if (routing_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't init kernel routing socket");
return;
}
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index 18328d380..a6de84d56 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -214,7 +214,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p,
case ZEBRA_ERR_RTEXIST:
if (cmd != RTM_ADD)
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: rtm_write() returned %d for command %d",
__func__, error, cmd);
continue;
@@ -228,7 +228,7 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p,
case ZEBRA_ERR_RTUNREACH:
default:
flog_err(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"%s: %s: rtm_write() unexpectedly returned %d for command %s",
__func__,
prefix2str(p, prefix_buf,
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 08770176e..f9bd5ad1b 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -375,7 +375,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp)
ret = sendmsg(sock, &msg, 0);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s(%u): Tx RA failed, socket %u error %d (%s)",
ifp->name, ifp->ifindex, sock, errno,
safe_strerror(errno));
@@ -621,7 +621,7 @@ static int rtadv_read(struct thread *thread)
&hoplimit);
if (len < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"RA/RS recv failed, socket %u error %s", sock,
safe_strerror(errno));
return len;
@@ -1767,7 +1767,7 @@ static int if_join_all_router(int sock, struct interface *ifp)
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char *)&mreq,
sizeof mreq);
if (ret < 0)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s(%u): Failed to join group, socket %u error %s",
ifp->name, ifp->ifindex, sock,
safe_strerror(errno));
@@ -1794,7 +1794,7 @@ static int if_leave_all_router(int sock, struct interface *ifp)
sizeof mreq);
if (ret < 0)
flog_err_sys(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"%s(%u): Failed to leave group, socket %u error %s",
ifp->name, ifp->ifindex, sock, safe_strerror(errno));
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 40982639c..c1bd68f9d 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -121,7 +121,7 @@ void route_read(struct zebra_ns *zns)
int flags, dev, retval, process;
if ((dev = open(_PATH_GETMSG_ROUTE, O_RDWR)) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "can't open %s: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "can't open %s: %s",
_PATH_GETMSG_ROUTE, safe_strerror(errno));
return;
}
@@ -143,7 +143,7 @@ void route_read(struct zebra_ns *zns)
flags = 0;
if (putmsg(dev, &msgdata, NULL, flags) == -1) {
- flog_err_sys(LIB_ERR_SOCKET, "putmsg failed: %s",
+ flog_err_sys(EC_LIB_SOCKET, "putmsg failed: %s",
safe_strerror(errno));
goto exit;
}
@@ -156,7 +156,7 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, &msgdata, NULL, &flags);
if (retval == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(ctl) failed: %s",
safe_strerror(errno));
goto exit;
@@ -215,7 +215,7 @@ void route_read(struct zebra_ns *zns)
retval = getmsg(dev, NULL, &msgdata, &flags);
if (retval == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(data) failed: %s",
safe_strerror(errno));
goto exit;
diff --git a/zebra/rule_socket.c b/zebra/rule_socket.c
index 8faca1bbc..42fb6346e 100644
--- a/zebra/rule_socket.c
+++ b/zebra/rule_socket.c
@@ -45,14 +45,14 @@
enum dp_req_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule)
{
- flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
+ flog_err(EC_LIB_UNAVAILABLE, "%s not Implemented for this platform",
__PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
enum dp_req_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule)
{
- flog_err(LIB_ERR_UNAVAILABLE, "%s not Implemented for this platform",
+ flog_err(EC_LIB_UNAVAILABLE, "%s not Implemented for this platform",
__PRETTY_FUNCTION__);
return DP_REQUEST_FAILURE;
}
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c
index e11e8a373..71679f26d 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -123,7 +123,7 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
}
if (ret == -1)
- flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: %s", __func__,
safe_strerror(errno));
return ret;
@@ -230,7 +230,7 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
}
if (ret == -1)
- flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__,
+ flog_err_sys(EC_LIB_SOCKET, "%s: %s", __func__,
safe_strerror(errno));
return ret;
@@ -398,7 +398,7 @@ static int kmpw_install(struct zebra_pw *pw)
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
safe_strerror(errno));
return -1;
}
@@ -416,7 +416,7 @@ static int kmpw_uninstall(struct zebra_pw *pw)
strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&imr;
if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
+ flog_err_sys(EC_LIB_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s",
safe_strerror(errno));
return -1;
}
@@ -431,13 +431,13 @@ int mpls_kernel_init(void)
socklen_t optlen;
if ((kr_state.fd = socket(AF_ROUTE, SOCK_RAW, 0)) == -1) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: socket", __func__);
+ flog_err_sys(EC_LIB_SOCKET, "%s: socket", __func__);
return -1;
}
if ((kr_state.ioctl_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0))
== -1) {
- flog_err_sys(LIB_ERR_SOCKET, "%s: ioctl socket", __func__);
+ flog_err_sys(EC_LIB_SOCKET, "%s: ioctl socket", __func__);
return -1;
}
@@ -446,7 +446,7 @@ int mpls_kernel_init(void)
if (getsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF, &default_rcvbuf,
&optlen)
== -1)
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"kr_init getsockopt SOL_SOCKET SO_RCVBUF");
else
for (rcvbuf = MAX_RTSOCK_BUF;
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index 14848f61a..b8ed0e558 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -88,7 +88,7 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq,
ret = sendto(sock, (const void *)nlh, (size_t)nlh->nlmsg_len, 0,
(struct sockaddr *)&snl, (socklen_t)sizeof(snl));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink( %u) sendmsg() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink( %u) sendmsg() error: %s",
sock, safe_strerror(errno));
return -1;
}
@@ -109,7 +109,7 @@ static int send_receive(int sock, struct nlmsghdr *nlh, unsigned int seq,
};
ret = recvmsg(sock, &msg, 0);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"netlink recvmsg: error %d (errno %u)", ret,
errno);
return -1;
@@ -176,7 +176,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
/* netlink socket */
sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "netlink( %u) socket() error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "netlink( %u) socket() error: %s",
sock, safe_strerror(errno));
close(fd);
return NS_UNKNOWN;
@@ -187,7 +187,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
snl.nl_pid = 0; /* AUTO PID */
ret = bind(sock, (struct sockaddr *)&snl, sizeof(snl));
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"netlink( %u) socket() bind error: %s", sock,
safe_strerror(errno));
close(sock);
@@ -263,7 +263,7 @@ ns_id_t zebra_ns_id_get(const char *netnspath)
if (ret <= 0) {
if (errno != EEXIST && ret != 0) {
flog_err(
- LIB_ERR_SOCKET,
+ EC_LIB_SOCKET,
"netlink( %u) recvfrom() error 2 when reading: %s",
fd, safe_strerror(errno));
close(sock);
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index 29defa715..2608ffd7a 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -288,7 +288,7 @@ void zebra_ns_notify_parse(void)
DIR *srcdir = opendir(NS_RUN_DIR);
if (srcdir == NULL) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"NS parsing init: failed to parse %s", NS_RUN_DIR);
return;
}
@@ -300,7 +300,7 @@ void zebra_ns_notify_parse(void)
continue;
if (fstatat(dirfd(srcdir), dent->d_name, &st, 0) < 0) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"NS parsing init: failed to parse entry %s",
dent->d_name);
continue;
@@ -330,13 +330,13 @@ void zebra_ns_notify_init(void)
fd_monitor = inotify_init();
if (fd_monitor < 0) {
flog_err_sys(
- LIB_ERR_SYSTEM_CALL,
+ EC_LIB_SYSTEM_CALL,
"NS notify init: failed to initialize inotify (%s)",
safe_strerror(errno));
}
if (inotify_add_watch(fd_monitor, NS_RUN_DIR,
IN_CREATE | IN_DELETE) < 0) {
- flog_err_sys(LIB_ERR_SYSTEM_CALL,
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
"NS notify watch: failed to add watch (%s)",
safe_strerror(errno));
}
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index f1fa8cc67..1d7a59e06 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -181,7 +181,7 @@ static int zebra_ptm_flush_messages(struct thread *thread)
switch (buffer_flush_available(ptm_cb.wb, ptm_cb.ptm_sock)) {
case BUFFER_ERROR:
- flog_err_sys(LIB_ERR_SOCKET, "%s ptm socket error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "%s ptm socket error: %s",
__func__, safe_strerror(errno));
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
@@ -207,7 +207,7 @@ static int zebra_ptm_send_message(char *data, int size)
errno = 0;
switch (buffer_write(ptm_cb.wb, ptm_cb.ptm_sock, data, size)) {
case BUFFER_ERROR:
- flog_err_sys(LIB_ERR_SOCKET, "%s ptm socket error: %s",
+ flog_err_sys(EC_LIB_SOCKET, "%s ptm socket error: %s",
__func__, safe_strerror(errno));
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
@@ -649,7 +649,7 @@ int zebra_ptm_sock_read(struct thread *thread)
if (((rc == 0) && !errno)
|| (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"%s routing socket error: %s(%d) bytes %d",
__func__, safe_strerror(errno), errno, rc);
diff --git a/zebra/zserv.c b/zebra/zserv.c
index a013d8dd5..97fc43f8a 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -744,7 +744,7 @@ static int zserv_accept(struct thread *thread)
client_sock = accept(accept_sock, (struct sockaddr *)&client, &len);
if (client_sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't accept zebra socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't accept zebra socket: %s",
safe_strerror(errno));
return -1;
}
@@ -775,7 +775,7 @@ void zserv_start(char *path)
/* Make UNIX domain socket. */
zebrad.sock = socket(sa.ss_family, SOCK_STREAM, 0);
if (zebrad.sock < 0) {
- flog_err_sys(LIB_ERR_SOCKET, "Can't create zserv socket: %s",
+ flog_err_sys(EC_LIB_SOCKET, "Can't create zserv socket: %s",
safe_strerror(errno));
return;
}
@@ -798,7 +798,7 @@ void zserv_start(char *path)
ret = bind(zebrad.sock, (struct sockaddr *)&sa, sa_len);
}
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't bind zserv socket on %s: %s", path,
safe_strerror(errno));
close(zebrad.sock);
@@ -808,7 +808,7 @@ void zserv_start(char *path)
ret = listen(zebrad.sock, 5);
if (ret < 0) {
- flog_err_sys(LIB_ERR_SOCKET,
+ flog_err_sys(EC_LIB_SOCKET,
"Can't listen to zserv socket %s: %s", path,
safe_strerror(errno));
close(zebrad.sock);