after log error, reset errno
This commit is contained in:
@@ -246,6 +246,8 @@ void __kni_event_cb(evutil_socket_t fd, short what, void * user)
|
|||||||
else if (rd < 0)
|
else if (rd < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at recving fds from KNI connection: %s. ", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at recving fds from KNI connection: %s. ", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __close_kni_connection;
|
goto __close_kni_connection;
|
||||||
}
|
}
|
||||||
else if (rd == 0)
|
else if (rd == 0)
|
||||||
@@ -418,6 +420,8 @@ struct acceptor_kni_v1 * acceptor_kni_v1_create(struct tfe_proxy * proxy, const
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at unlink undomain file %s: %s",
|
TFE_LOG_ERROR(__ctx->logger, "Failed at unlink undomain file %s: %s",
|
||||||
__ctx->str_unixdomain_file, strerror(errno));
|
__ctx->str_unixdomain_file, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,6 +451,8 @@ struct acceptor_kni_v1 * acceptor_kni_v1_create(struct tfe_proxy * proxy, const
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at creating listener thread: %s", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at creating listener thread: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ void acceptor_kni_v2_event(evutil_socket_t fd, short what, void * user)
|
|||||||
else if (rd <= 0)
|
else if (rd <= 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "failed at recvmsg from scm socket: %s. ", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "failed at recvmsg from scm socket: %s. ", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __die;
|
goto __die;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +202,8 @@ struct acceptor_kni_v2 * acceptor_kni_v2_create(struct tfe_proxy * proxy, const
|
|||||||
if (remove(__ctx->str_scm_socket) < 0 && errno != ENOENT)
|
if (remove(__ctx->str_scm_socket) < 0 && errno != ENOENT)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at remove(%s) : %s", __ctx->str_scm_socket, strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at remove(%s) : %s", __ctx->str_scm_socket, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,6 +219,8 @@ struct acceptor_kni_v2 * acceptor_kni_v2_create(struct tfe_proxy * proxy, const
|
|||||||
if (unlikely(__ctx->fd_scm_socket < 0))
|
if (unlikely(__ctx->fd_scm_socket < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at create scm socket fd: %s", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at create scm socket fd: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +230,8 @@ struct acceptor_kni_v2 * acceptor_kni_v2_create(struct tfe_proxy * proxy, const
|
|||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at binding to %s: %s", __sockaddr_un.sun_path, strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at binding to %s: %s", __sockaddr_un.sun_path, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +256,8 @@ struct acceptor_kni_v2 * acceptor_kni_v2_create(struct tfe_proxy * proxy, const
|
|||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at creating event thread: %s", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at creating event thread: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -486,6 +486,8 @@ static int health_check(struct key_keeper *keeper)
|
|||||||
if (sockfd == -1)
|
if (sockfd == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to create socket(), %s", strerror(errno));
|
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to create socket(), %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
@@ -495,16 +497,22 @@ static int health_check(struct key_keeper *keeper)
|
|||||||
if (connect(sockfd, (const struct sockaddr *)&addr, sizeof(addr)) == -1)
|
if (connect(sockfd, (const struct sockaddr *)&addr, sizeof(addr)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to connect(), %s", strerror(errno));
|
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to connect(), %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (write(sockfd, req_buff, strlen(req_buff)) == -1)
|
if (write(sockfd, req_buff, strlen(req_buff)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to write(), %s", strerror(errno));
|
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to write(), %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (read(sockfd, rsp_buff, sizeof(rsp_buff)) == -1)
|
if (read(sockfd, rsp_buff, sizeof(rsp_buff)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to read(), %s", strerror(errno));
|
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to read(), %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
@@ -606,6 +614,8 @@ struct key_keeper* key_keeper_init(const char * profile, const char* section, vo
|
|||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(keeper->logger, "Failed at creating certstore health check thread: %s", strerror(errno));
|
TFE_LOG_ERROR(keeper->logger, "Failed at creating certstore health check thread: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,6 +311,8 @@ int tfe_proxy_work_thread_run(struct tfe_proxy * proxy)
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(proxy->logger, "Failed at pthread_create() for thread %d, error %d: %s", i, errno,
|
TFE_LOG_ERROR(proxy->logger, "Failed at pthread_create() for thread %d, error %d: %s", i, errno,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -527,6 +529,8 @@ static bool tfe_breakpad_dump_and_report(const google_breakpad::MinidumpDescript
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Failed at exec the upload program %s: %s\n",
|
fprintf(stderr, "Failed at exec the upload program %s: %s\n",
|
||||||
instance->upload_tools_filename, strerror(errno));
|
instance->upload_tools_filename, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -540,6 +544,8 @@ static bool tfe_breakpad_dump_and_report(const google_breakpad::MinidumpDescript
|
|||||||
{
|
{
|
||||||
/* failed at fork, cannot upload the minidump */
|
/* failed at fork, cannot upload the minidump */
|
||||||
fprintf(stderr, "Failed at fork(), cannot upload minidump file. : %s\n", strerror(errno));
|
fprintf(stderr, "Failed at fork(), cannot upload minidump file. : %s\n", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
return succeeded;
|
return succeeded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,6 +598,8 @@ int breakpad_init_minidump_upload(struct breakpad_instance * instance, const cha
|
|||||||
if(unlikely(ret < 0))
|
if(unlikely(ret < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "Failed at readlink /proc/self/exec: %s", strerror(errno));
|
TFE_LOG_ERROR(g_default_logger, "Failed at readlink /proc/self/exec: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,6 +645,8 @@ struct breakpad_instance * breakpad_init(const char * profile)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "setrlimit(RLIMIT_CORE, 0) failed: %s", strerror(errno));
|
TFE_LOG_ERROR(g_default_logger, "setrlimit(RLIMIT_CORE, 0) failed: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,6 +682,8 @@ struct breakpad_instance * breakpad_init(const char * profile)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "setrlimit(RLIMIT_CORE, 0) failed: %s", strerror(errno));
|
TFE_LOG_ERROR(g_default_logger, "setrlimit(RLIMIT_CORE, 0) failed: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ struct sender_scm* sender_scm_init(const char *profile, const char *section, voi
|
|||||||
if(sockfd < 0)
|
if(sockfd < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "Failed at create udp socket, errno is %d, %s", errno, strerror(errno));
|
TFE_LOG_ERROR(logger, "Failed at create udp socket, errno is %d, %s", errno, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +103,8 @@ int sender_scm_cmsg_send(struct sender_scm *sender, struct tfe_cmsg *cmsg)
|
|||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "Failed at send udp data, errno is %d, %s", errno, strerror(errno));
|
TFE_LOG_ERROR(logger, "Failed at send udp data, errno is %d, %s", errno, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
FREE(&buff);
|
FREE(&buff);
|
||||||
|
|||||||
@@ -802,6 +802,8 @@ static void peek_client_hello_cb(evutil_socket_t fd, short what, void * arg)
|
|||||||
{
|
{
|
||||||
char* addr_string=tfe_string_addr_create_by_fd(fd, CONN_DIR_DOWNSTREAM);
|
char* addr_string=tfe_string_addr_create_by_fd(fd, CONN_DIR_DOWNSTREAM);
|
||||||
TFE_LOG_ERROR(ctx->logger, "Error peeking on fd, aborting connection, addr_string is %s, errno is %d, errmsg is %s\n", addr_string, errno, strerror(errno));
|
TFE_LOG_ERROR(ctx->logger, "Error peeking on fd, aborting connection, addr_string is %s, errno is %d, errmsg is %s\n", addr_string, errno, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
free(addr_string);
|
free(addr_string);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@@ -1134,6 +1136,8 @@ unsigned long ssl_stream_log_error(struct bufferevent * bev, enum tfe_conn_dir d
|
|||||||
ERR_GET_FUNC(sslerr),
|
ERR_GET_FUNC(sslerr),
|
||||||
sslerr ?
|
sslerr ?
|
||||||
ERR_func_error_string(sslerr) : "-");
|
ERR_func_error_string(sslerr) : "-");
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
while ((sslerr = bufferevent_get_openssl_error(bev)))
|
while ((sslerr = bufferevent_get_openssl_error(bev)))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger,"Additional SSL error: "
|
TFE_LOG_ERROR(logger,"Additional SSL error: "
|
||||||
@@ -1166,6 +1170,8 @@ unsigned long ssl_stream_log_error(struct bufferevent * bev, enum tfe_conn_dir d
|
|||||||
ERR_GET_FUNC(sslerr),
|
ERR_GET_FUNC(sslerr),
|
||||||
sslerr ?
|
sslerr ?
|
||||||
ERR_func_error_string(sslerr) : "-");
|
ERR_func_error_string(sslerr) : "-");
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
while ((sslerr = bufferevent_get_openssl_error(bev)))
|
while ((sslerr = bufferevent_get_openssl_error(bev)))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger,"Additional SSL error: "
|
TFE_LOG_ERROR(logger,"Additional SSL error: "
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ int ssl_init(void)
|
|||||||
if ((fd = open("/dev/urandom", O_RDONLY)) == -1)
|
if ((fd = open("/dev/urandom", O_RDONLY)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(NULL, "Error opening /dev/urandom for reading: %s", strerror(errno));
|
TFE_LOG_ERROR(NULL, "Error opening /dev/urandom for reading: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +191,8 @@ int ssl_init(void)
|
|||||||
if (read(fd, buf, sizeof(buf)) == -1)
|
if (read(fd, buf, sizeof(buf)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(NULL, "Error reading from /dev/urandom: %s", strerror(errno));
|
TFE_LOG_ERROR(NULL, "Error reading from /dev/urandom: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -536,6 +536,8 @@ static void __stream_bev_passthrough_eventcb(struct bufferevent * bev, short eve
|
|||||||
{
|
{
|
||||||
TFE_LOG_INFO(g_default_logger, "%s %s connection error, errno = %d, %s",
|
TFE_LOG_INFO(g_default_logger, "%s %s connection error, errno = %d, %s",
|
||||||
_stream->str_stream_addr, str_conn_dir, errno, strerror(errno));
|
_stream->str_stream_addr, str_conn_dir, errno, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,6 +832,8 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void *
|
|||||||
{
|
{
|
||||||
TFE_LOG_INFO(g_default_logger, "%s %s connection error, errno = %d, %s",
|
TFE_LOG_INFO(g_default_logger, "%s %s connection error, errno = %d, %s",
|
||||||
_stream->str_stream_addr, str_conn_dir, errno, strerror(errno));
|
_stream->str_stream_addr, str_conn_dir, errno, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (events & BEV_EVENT_EOF && rx_offset == 0 && _stream->session_type == STREAM_PROTO_SSL)
|
else if (events & BEV_EVENT_EOF && rx_offset == 0 && _stream->session_type == STREAM_PROTO_SSL)
|
||||||
@@ -1211,6 +1215,8 @@ int __fd_ttl_option_setup(struct tfe_stream_private * _stream, evutil_socket_t f
|
|||||||
if (getsockname(fd, (struct sockaddr *) &sk_storage, &sk_storage_len) < 0)
|
if (getsockname(fd, (struct sockaddr *) &sk_storage, &sk_storage_len) < 0)
|
||||||
{
|
{
|
||||||
TFE_STREAM_LOG_ERROR(_stream, "getsockname(fd = %d) failed: %s", fd, strerror(errno));
|
TFE_STREAM_LOG_ERROR(_stream, "getsockname(fd = %d) failed: %s", fd, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1234,7 +1240,9 @@ int __fd_ttl_option_setup(struct tfe_stream_private * _stream, evutil_socket_t f
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
TFE_STREAM_LOG_ERROR(_stream, "setsockopt(ttl = %u, fd = %d, family = %s) failed: %s",
|
TFE_STREAM_LOG_ERROR(_stream, "setsockopt(ttl = %u, fd = %d, family = %s) failed: %s",
|
||||||
__ttl, fd, __str_family, strerror(errno));
|
__ttl, fd, __str_family, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1257,6 +1265,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_RCVBUF, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_RCVBUF, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->sz_rcv_buffer, strerror(errno));
|
stream->str_stream_info, tcp_options->sz_rcv_buffer, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1267,6 +1277,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_SNDBUF, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_SNDBUF, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->sz_snd_buffer, strerror(errno));
|
stream->str_stream_info, tcp_options->sz_snd_buffer, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1277,6 +1289,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_KEEPALIVE, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(SO_KEEPALIVE, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->so_keepalive, strerror(errno));
|
stream->str_stream_info, tcp_options->so_keepalive, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,6 +1300,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPCNT, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPCNT, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->tcp_keepcnt, strerror(errno));
|
stream->str_stream_info, tcp_options->tcp_keepcnt, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,6 +1311,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPINTVL, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPINTVL, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->tcp_keepintvl, strerror(errno));
|
stream->str_stream_info, tcp_options->tcp_keepintvl, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1304,6 +1322,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPIDLE, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_KEEPIDLE, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->tcp_keepidle, strerror(errno));
|
stream->str_stream_info, tcp_options->tcp_keepidle, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,6 +1334,8 @@ void __stream_fd_option_setup(struct tfe_stream_private * _stream, evutil_socket
|
|||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_USER_TIMEOUT, %d) failed, ignored: %s",
|
TFE_LOG_ERROR(g_default_logger, "%s: setsockopt(TCP_USER_TIMEOUT, %d) failed, ignored: %s",
|
||||||
stream->str_stream_info, tcp_options->tcp_user_timeout, strerror(errno));
|
stream->str_stream_info, tcp_options->tcp_user_timeout, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,25 +50,37 @@ static int watchdog_kni_fd_make_keepalive(int fd)
|
|||||||
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *) &so_keepalive, sizeof(int)) == -1)
|
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *) &so_keepalive, sizeof(int)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(SO_KEEPALIVE, %d) failed : %s",
|
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(SO_KEEPALIVE, %d) failed : %s",
|
||||||
so_keepalive, strerror(errno)); goto errout;
|
so_keepalive, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, (const void *) &tcp_keepcnt, sizeof(int)) == -1)
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, (const void *) &tcp_keepcnt, sizeof(int)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPCNT, %d) failed: %s",
|
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPCNT, %d) failed: %s",
|
||||||
tcp_keepcnt, strerror(errno)); goto errout;
|
tcp_keepcnt, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (const void *) &tcp_keepintvl, sizeof(int)) == -1)
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (const void *) &tcp_keepintvl, sizeof(int)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPINTVL, %d) failed: %s",
|
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPINTVL, %d) failed: %s",
|
||||||
tcp_keepintvl, strerror(errno)); goto errout;
|
tcp_keepintvl, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, (const void *) &tcp_keepidle, sizeof(int)) == -1)
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, (const void *) &tcp_keepidle, sizeof(int)) == -1)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPIDLE, %d) failed: %s",
|
TFE_LOG_ERROR(g_default_logger, "watchdog fd setup setsockopt(TCP_KEEPIDLE, %d) failed: %s",
|
||||||
tcp_keepidle, strerror(errno)); goto errout;
|
tcp_keepidle, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -155,6 +167,8 @@ static void watchdog_kni_eventcb(struct bufferevent *bev, short what, void *ctx)
|
|||||||
if (what & BEV_EVENT_ERROR)
|
if (what & BEV_EVENT_ERROR)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "KNI watchdog connection broken: %s.", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "KNI watchdog connection broken: %s.", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,6 +246,8 @@ struct watchdog_kni * watchdog_kni_create(struct tfe_proxy * proxy, const char *
|
|||||||
if (!__ctx->ev_base)
|
if (!__ctx->ev_base)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "failed at watchdog event_base_new(): %s", strerror(errno));
|
TFE_LOG_ERROR(logger, "failed at watchdog event_base_new(): %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +259,8 @@ struct watchdog_kni * watchdog_kni_create(struct tfe_proxy * proxy, const char *
|
|||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0))
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(__ctx->logger, "Failed at creating watchdog thread: %s", strerror(errno));
|
TFE_LOG_ERROR(__ctx->logger, "Failed at creating watchdog thread: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto __errout;
|
goto __errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ struct traffic_mirror_ethdev * traffic_mirror_ethdev_pcap_create(const char * st
|
|||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "failed at create socket: %s", strerror(errno));
|
TFE_LOG_ERROR(logger, "failed at create socket: %s", strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +225,8 @@ struct traffic_mirror_ethdev * traffic_mirror_ethdev_pcap_create(const char * st
|
|||||||
if(ioctl(fd, SIOCGIFHWADDR, &if_req) < 0)
|
if(ioctl(fd, SIOCGIFHWADDR, &if_req) < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "failed at read hwaddr of device %s: %s", str_ethdev, strerror(errno));
|
TFE_LOG_ERROR(logger, "failed at read hwaddr of device %s: %s", str_ethdev, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +242,8 @@ struct traffic_mirror_ethdev * traffic_mirror_ethdev_pcap_create(const char * st
|
|||||||
if (ioctl(fd, SIOCGIFMTU, &if_req) < 0)
|
if (ioctl(fd, SIOCGIFMTU, &if_req) < 0)
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(logger, "failed at read mtu of device %s: %s", str_ethdev, strerror(errno));
|
TFE_LOG_ERROR(logger, "failed at read mtu of device %s: %s", str_ethdev, strerror(errno));
|
||||||
|
/* after log, reset errno */
|
||||||
|
errno = 0;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user