#include "version.h"
#include "vrf.h"
#include "vty.h"
+#include "lib_errors.h"
#include "zebra/debug.h"
#include "zebra/interface.h"
ptm_cb.out_data = calloc(1, ZEBRA_PTM_SEND_MAX_SOCKBUF);
if (!ptm_cb.out_data) {
- zlog_warn("%s: Allocation of send data failed", __func__);
+ zlog_debug("%s: Allocation of send data failed", __func__);
return;
}
ptm_cb.in_data = calloc(1, ZEBRA_PTM_MAX_SOCKBUF);
if (!ptm_cb.in_data) {
- zlog_warn("%s: Allocation of recv data failed", __func__);
+ zlog_debug("%s: Allocation of recv data failed", __func__);
free(ptm_cb.out_data);
return;
}
switch (buffer_flush_available(ptm_cb.wb, ptm_cb.ptm_sock)) {
case BUFFER_ERROR:
- zlog_warn("%s ptm socket error: %s", __func__,
- safe_strerror(errno));
+ 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;
zebra_ptm_reset_status(0);
errno = 0;
switch (buffer_write(ptm_cb.wb, ptm_cb.ptm_sock, data, size)) {
case BUFFER_ERROR:
- zlog_warn("%s ptm socket error: %s", __func__,
- safe_strerror(errno));
+ 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;
zebra_ptm_reset_status(0);
dest_str, src_str);
if (str2prefix(dest_str, &dest_prefix) == 0) {
- flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR,
- "%s: Peer addr %s not found", __func__, dest_str);
+ flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR,
+ "%s: Peer addr %s not found", __func__, dest_str);
return -1;
}
memset(&src_prefix, 0, sizeof(struct prefix));
if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) {
if (str2prefix(src_str, &src_prefix) == 0) {
- flog_err(ZEBRA_ERR_PREFIX_PARSE_ERROR,
- "%s: Local addr %s not found", __func__,
- src_str);
+ flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR,
+ "%s: Local addr %s not found", __func__,
+ src_str);
return -1;
}
}
ifp = if_lookup_by_name_all_vrf(port_str);
if (!ifp) {
- zlog_warn("%s: %s not found in interface list",
+ flog_warn(EC_ZEBRA_UNKNOWN_INTERFACE,
+ "%s: %s not found in interface list",
__func__, port_str);
return -1;
}
if (((rc == 0) && !errno)
|| (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- zlog_warn("%s routing socket error: %s(%d) bytes %d",
- __func__, safe_strerror(errno), errno, rc);
+ flog_err_sys(EC_LIB_SOCKET,
+ "%s routing socket error: %s(%d) bytes %d",
+ __func__, safe_strerror(errno), errno, rc);
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
char tmp_buf[64];
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
- if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP
- && proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM)
+ if (!IS_BFD_ENABLED_PROTOCOL(proto))
return 0;
if (IS_ZEBRA_DEBUG_EVENT)
- zlog_warn("bfd_client_deregister msg for client %s",
- zebra_route_string(proto));
+ zlog_debug("bfd_client_deregister msg for client %s",
+ zebra_route_string(proto));
if (ptm_cb.ptm_sock == -1) {
ptm_cb.t_timer = NULL;
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
}
/* Create copy for replication. */
msgc = stream_dup(msg);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
/* Send message to all running client daemons. */
for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) {
- switch (client->proto) {
- case ZEBRA_ROUTE_BGP:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_PIM:
- break;
-
- default:
- /* NOTHING: skip this daemon. */
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
- }
zserv_send_message(client, msg);
/* Allocate more messages. */
msg = stream_dup(msgc);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
}
struct stream *msg;
struct ptm_process *pp;
- /* Filter daemons that must receive this treatment. */
- switch (zs->proto) {
- case ZEBRA_ROUTE_BGP:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_PIM:
- break;
-
- case ZEBRA_ROUTE_BFD:
- /* Don't try to send BFDd messages to itself. */
+ if (!IS_BFD_ENABLED_PROTOCOL(zs->proto))
return 0;
- default:
- /* Unsupported daemon. */
- return 0;
- }
-
/* Find daemon pid by zebra connection pointer. */
pp = pp_lookup_byzs(zs);
if (pp == NULL) {
/* Generate, send message and free() daemon related data. */
msg = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msg == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return 0;
}
*/
msgc = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}
*/
msgc = stream_new(ZEBRA_MAX_PACKET_SIZ);
if (msgc == NULL) {
- zlog_warn("%s: not enough memory", __func__);
+ zlog_debug("%s: not enough memory", __func__);
return;
}