mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 06:34:44 +00:00
Merge pull request #15070 from LabNConsulting/chopps/fix-coverity-errors
chopps/fix coverity errors
This commit is contained in:
commit
de01b61b32
@ -1060,7 +1060,7 @@ struct mgmt_be_client *mgmt_be_client_create(const char *client_name,
|
||||
mgmt_be_client_notify_conenct,
|
||||
mgmt_be_client_notify_disconenct,
|
||||
mgmt_be_client_process_msg, MGMTD_BE_MAX_NUM_MSG_PROC,
|
||||
MGMTD_BE_MAX_NUM_MSG_WRITE, MGMTD_BE_MSG_MAX_LEN, false,
|
||||
MGMTD_BE_MAX_NUM_MSG_WRITE, MGMTD_BE_MAX_MSG_LEN, false,
|
||||
"BE-client", MGMTD_DBG_BE_CLIENT_CHECK());
|
||||
|
||||
MGMTD_BE_CLIENT_DBG("Initialized client '%s'", client_name);
|
||||
|
@ -20,25 +20,12 @@ extern "C" {
|
||||
* Constants
|
||||
***************************************************************/
|
||||
|
||||
#define MGMTD_BE_CLIENT_ERROR_STRING_MAX_LEN 32
|
||||
|
||||
#define MGMTD_BE_DEFAULT_CONN_RETRY_INTVL_SEC 5
|
||||
|
||||
#define MGMTD_BE_MSG_PROC_DELAY_USEC 10
|
||||
#define MGMTD_BE_MAX_NUM_MSG_PROC 500
|
||||
|
||||
#define MGMTD_BE_MSG_WRITE_DELAY_MSEC 1
|
||||
#define MGMTD_BE_MAX_NUM_MSG_PROC 500
|
||||
#define MGMTD_BE_MAX_NUM_MSG_WRITE 1000
|
||||
#define MGMTD_BE_MAX_MSG_LEN (64 * 1024)
|
||||
|
||||
#define GMGD_BE_MAX_NUM_REQ_ITEMS 64
|
||||
|
||||
#define MGMTD_BE_MSG_MAX_LEN 16384
|
||||
|
||||
#define MGMTD_SOCKET_BE_SEND_BUF_SIZE 65535
|
||||
#define MGMTD_SOCKET_BE_RECV_BUF_SIZE MGMTD_SOCKET_BE_SEND_BUF_SIZE
|
||||
|
||||
#define MGMTD_MAX_CFG_CHANGES_IN_BATCH \
|
||||
((10 * MGMTD_BE_MSG_MAX_LEN) / \
|
||||
#define MGMTD_MAX_CFG_CHANGES_IN_BATCH \
|
||||
((10 * MGMTD_BE_MAX_MSG_LEN) / \
|
||||
(MGMTD_MAX_XPATH_LEN + MGMTD_MAX_YANG_VALUE_LEN))
|
||||
|
||||
/*
|
||||
@ -47,11 +34,11 @@ extern "C" {
|
||||
* that gets added to sent message
|
||||
*/
|
||||
#define MGMTD_BE_CFGDATA_PACKING_EFFICIENCY 0.8
|
||||
#define MGMTD_BE_CFGDATA_MAX_MSG_LEN \
|
||||
(MGMTD_BE_MSG_MAX_LEN * MGMTD_BE_CFGDATA_PACKING_EFFICIENCY)
|
||||
#define MGMTD_BE_CFGDATA_MAX_MSG_LEN \
|
||||
(MGMTD_BE_MAX_MSG_LEN * MGMTD_BE_CFGDATA_PACKING_EFFICIENCY)
|
||||
|
||||
#define MGMTD_BE_MAX_BATCH_IDS_IN_REQ \
|
||||
(MGMTD_BE_MSG_MAX_LEN - 128) / sizeof(uint64_t)
|
||||
#define MGMTD_BE_MAX_BATCH_IDS_IN_REQ \
|
||||
(MGMTD_BE_MAX_MSG_LEN - 128) / sizeof(uint64_t)
|
||||
|
||||
#define MGMTD_BE_CONTAINER_NODE_VAL "<<container>>"
|
||||
|
||||
|
@ -729,7 +729,7 @@ struct mgmt_fe_client *mgmt_fe_client_create(const char *client_name,
|
||||
mgmt_fe_client_notify_connect,
|
||||
mgmt_fe_client_notify_disconnect,
|
||||
mgmt_fe_client_process_msg, MGMTD_FE_MAX_NUM_MSG_PROC,
|
||||
MGMTD_FE_MAX_NUM_MSG_WRITE, MGMTD_FE_MSG_MAX_LEN, true,
|
||||
MGMTD_FE_MAX_NUM_MSG_WRITE, MGMTD_FE_MAX_MSG_LEN, true,
|
||||
"FE-client", MGMTD_DBG_FE_CLIENT_CHECK());
|
||||
|
||||
MGMTD_FE_CLIENT_DBG("Initialized client '%s'", client_name);
|
||||
|
@ -25,22 +25,11 @@ extern "C" {
|
||||
* connections.
|
||||
*/
|
||||
|
||||
#define MGMTD_FE_CLIENT_ERROR_STRING_MAX_LEN 32
|
||||
|
||||
#define MGMTD_FE_DEFAULT_CONN_RETRY_INTVL_SEC 5
|
||||
|
||||
#define MGMTD_FE_MSG_PROC_DELAY_USEC 10
|
||||
#define MGMTD_FE_MAX_NUM_MSG_PROC 500
|
||||
|
||||
#define MGMTD_FE_MSG_WRITE_DELAY_MSEC 1
|
||||
#define MGMTD_FE_MAX_NUM_MSG_PROC 500
|
||||
#define MGMTD_FE_MAX_NUM_MSG_WRITE 100
|
||||
|
||||
#define GMGD_FE_MAX_NUM_REQ_ITEMS 64
|
||||
|
||||
#define MGMTD_FE_MSG_MAX_LEN 9000
|
||||
|
||||
#define MGMTD_SOCKET_FE_SEND_BUF_SIZE 65535
|
||||
#define MGMTD_SOCKET_FE_RECV_BUF_SIZE MGMTD_SOCKET_FE_SEND_BUF_SIZE
|
||||
#define MGMTD_FE_MAX_MSG_LEN (64 * 1024)
|
||||
|
||||
/***************************************************************
|
||||
* Data-structures
|
||||
|
@ -111,6 +111,11 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd,
|
||||
* therefor the stream is too small to fit the message..
|
||||
* Resize the stream to fit.
|
||||
*/
|
||||
if (mhdr->len > MGMT_MSG_MAX_MSG_ALLOC_LEN) {
|
||||
MGMT_MSG_ERR(ms, "corrupt msg len rcvd %u",
|
||||
mhdr->len);
|
||||
return MSR_DISCONNECT;
|
||||
}
|
||||
news = stream_new(mhdr->len);
|
||||
stream_put(news, mhdr, left);
|
||||
stream_set_endp(news, left);
|
||||
|
@ -24,6 +24,8 @@ DECLARE_MTYPE(MSG_CONN);
|
||||
#define MGMT_MSG_VERSION_PROTOBUF 0
|
||||
#define MGMT_MSG_VERSION_NATIVE 1
|
||||
|
||||
/* The absolute maximum message size (16MB) */
|
||||
#define MGMT_MSG_MAX_MSG_ALLOC_LEN (16 * 1024 * 1024)
|
||||
|
||||
struct mgmt_msg_state {
|
||||
struct stream *ins;
|
||||
|
@ -2250,7 +2250,7 @@ int nb_oper_data_iterate(const char *xpath, struct yang_translator *translator,
|
||||
__func__, xpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
assert(dnode);
|
||||
|
||||
/*
|
||||
* Create a linked list to sort the data nodes starting from the root.
|
||||
@ -2331,17 +2331,15 @@ int nb_oper_data_iterate(const char *xpath, struct yang_translator *translator,
|
||||
flags, cb, arg, dnode);
|
||||
|
||||
list_delete(&list_dnodes);
|
||||
if (dnode) {
|
||||
while (lyd_parent(dnode))
|
||||
dnode = lyd_parent(dnode);
|
||||
while (lyd_parent(dnode))
|
||||
dnode = lyd_parent(dnode);
|
||||
|
||||
if (tree && ret == NB_OK)
|
||||
*tree = dnode;
|
||||
else {
|
||||
lyd_free_all(dnode);
|
||||
if (tree)
|
||||
*tree = NULL;
|
||||
}
|
||||
if (tree && ret == NB_OK)
|
||||
*tree = dnode;
|
||||
else {
|
||||
lyd_free_all(dnode);
|
||||
if (tree)
|
||||
*tree = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -3657,8 +3657,7 @@ static int vty_mgmt_get_data_result_notified(
|
||||
}
|
||||
if (next_key < 0) {
|
||||
vty_out(vty, "]\n");
|
||||
vty_mgmt_resume_response(vty,
|
||||
success ? CMD_SUCCESS : CMD_WARNING);
|
||||
vty_mgmt_resume_response(vty, CMD_SUCCESS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -735,7 +735,7 @@ struct msg_conn *mgmt_be_create_adapter(int conn_fd, union sockunion *from)
|
||||
mgmt_be_adapter_process_msg,
|
||||
MGMTD_BE_MAX_NUM_MSG_PROC,
|
||||
MGMTD_BE_MAX_NUM_MSG_WRITE,
|
||||
MGMTD_BE_MSG_MAX_LEN, adapter,
|
||||
MGMTD_BE_MAX_MSG_LEN, adapter,
|
||||
"BE-adapter");
|
||||
|
||||
adapter->conn->debug = DEBUG_MODE_CHECK(&mgmt_debug_be, DEBUG_MODE_ALL);
|
||||
|
@ -1344,7 +1344,7 @@ struct msg_conn *mgmt_fe_create_adapter(int conn_fd, union sockunion *from)
|
||||
adapter->conn = msg_server_conn_create(
|
||||
mgmt_loop, conn_fd, mgmt_fe_adapter_notify_disconnect,
|
||||
mgmt_fe_adapter_process_msg, MGMTD_FE_MAX_NUM_MSG_PROC,
|
||||
MGMTD_FE_MAX_NUM_MSG_WRITE, MGMTD_FE_MSG_MAX_LEN,
|
||||
MGMTD_FE_MAX_NUM_MSG_WRITE, MGMTD_FE_MAX_MSG_LEN,
|
||||
adapter, "FE-adapter");
|
||||
|
||||
adapter->conn->debug = DEBUG_MODE_CHECK(&mgmt_debug_fe,
|
||||
|
@ -426,7 +426,6 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
|
||||
{
|
||||
int indx;
|
||||
struct mgmt_txn_reqs_head *req_list = NULL;
|
||||
struct mgmt_txn_reqs_head *pending_list = NULL;
|
||||
enum mgmt_be_client_id id;
|
||||
struct mgmt_be_client_adapter *adapter;
|
||||
struct mgmt_commit_cfg_req *ccreq;
|
||||
@ -527,13 +526,7 @@ static void mgmt_txn_req_free(struct mgmt_txn_req **txn_req)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((*txn_req)->pending_be_proc && pending_list) {
|
||||
mgmt_txn_reqs_del(pending_list, *txn_req);
|
||||
MGMTD_TXN_DBG("Removed req-id: %" PRIu64
|
||||
" from pending-list (left:%zu)",
|
||||
(*txn_req)->req_id,
|
||||
mgmt_txn_reqs_count(pending_list));
|
||||
} else if (req_list) {
|
||||
if (req_list) {
|
||||
mgmt_txn_reqs_del(req_list, *txn_req);
|
||||
MGMTD_TXN_DBG("Removed req-id: %" PRIu64
|
||||
" from request-list (left:%zu)",
|
||||
@ -1274,6 +1267,7 @@ static int txn_get_tree_data_done(struct mgmt_txn_ctx *txn,
|
||||
struct mgmt_txn_req *txn_req)
|
||||
{
|
||||
struct txn_req_get_tree *get_tree = txn_req->req.get_tree;
|
||||
uint64_t req_id = txn_req->req_id;
|
||||
int ret = 0;
|
||||
|
||||
/* cancel timer and send reply onward */
|
||||
@ -1291,11 +1285,9 @@ static int txn_get_tree_data_done(struct mgmt_txn_ctx *txn,
|
||||
if (ret) {
|
||||
MGMTD_TXN_ERR("Error saving the results of GETTREE for txn-id %" PRIu64
|
||||
" req_id %" PRIu64 " to requested type %u",
|
||||
txn->txn_id, txn_req->req_id,
|
||||
get_tree->result_type);
|
||||
txn->txn_id, req_id, get_tree->result_type);
|
||||
|
||||
(void)mgmt_fe_adapter_txn_error(txn->txn_id, txn_req->req_id,
|
||||
false, ret,
|
||||
(void)mgmt_fe_adapter_txn_error(txn->txn_id, req_id, false, ret,
|
||||
"Error converting results of GETTREE");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user