diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2024-01-11 19:58:09 +0100 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-01-11 21:56:42 +0100 |
commit | 0eac9b6f07aad0f82c312aed270987de06181150 (patch) | |
tree | 7536153ebb638ac3dd07cf221f5bfd7cb00f4e27 /mgmtd/mgmt_txn.c | |
parent | Merge pull request #15128 from opensourcerouting/fix/bgp_oad_ECOMMUNITY_ORIGI... (diff) | |
download | frr-0eac9b6f07aad0f82c312aed270987de06181150.tar.xz frr-0eac9b6f07aad0f82c312aed270987de06181150.zip |
mgmtd: don't try to send config to disconnected clients
When determining the interested backend clients for a configuration
change, don't consider disconnected clients. This fixes a crash in
`mgmt_txn_send_be_txn_create` when trying to send data to a non-existing
adapter.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'mgmtd/mgmt_txn.c')
-rw-r--r-- | mgmtd/mgmt_txn.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c index 297482f01..998e5a383 100644 --- a/mgmtd/mgmt_txn.c +++ b/mgmtd/mgmt_txn.c @@ -850,10 +850,9 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, enum mgmt_be_client_id id; struct mgmt_be_client_adapter *adapter; struct mgmt_commit_cfg_req *cmtcfg_req; - bool found_validator; int num_chgs = 0; int xpath_len, value_len; - uint64_t clients; + uint64_t clients, chg_clients; cmtcfg_req = &txn_req->req.commit_cfg; @@ -881,11 +880,8 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, value ? value : "NIL"); clients = mgmt_be_interested_clients(xpath, true); - cmtcfg_req->clients |= clients; - if (clients) - found_validator = true; - else - found_validator = false; + + chg_clients = 0; xpath_len = strlen(xpath) + 1; value_len = strlen(value) + 1; @@ -894,6 +890,8 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, if (!adapter) continue; + chg_clients |= (1ull << id); + batch = cmtcfg_req->last_be_cfg_batch[id]; if (!batch || (batch->num_cfg_data == @@ -940,13 +938,15 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, num_chgs++; } - if (!found_validator) { + if (!chg_clients) { snprintf(err_buf, sizeof(err_buf), "No validator module found for XPATH: '%s", xpath); MGMTD_TXN_ERR("***** %s", err_buf); } + cmtcfg_req->clients |= chg_clients; + free(xpath); } |