diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-12 20:34:33 +0200 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-12 20:55:34 +0200 | 
| commit | 745a2bd8b3bb586f9b643a186b79f24e515548e8 (patch) | |
| tree | 73334d4270cbcb3cc284b8ad73085b610800e879 /mgmtd | |
| parent | 24ca4f408b27f567cdb8a1187a1db20a9859e56c (diff) | |
mgmtd: fix be_is_client_interested
Backend "subscribe" API allows daemons to dynamically register xpaths
they are interested in. Such xpaths are not stored in hardcoded
config/oper xpath arrays so this function fails to understand that a
backend daemon is interested in them. Fix by using dynamic xpath maps
instead which store both hardcoded and dynamic xpaths.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'mgmtd')
| -rw-r--r-- | mgmtd/mgmt_be_adapter.c | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c index f4353defe9..d85d87b4b6 100644 --- a/mgmtd/mgmt_be_adapter.c +++ b/mgmtd/mgmt_be_adapter.c @@ -925,22 +925,17 @@ uint64_t mgmt_be_interested_clients(const char *xpath, bool config)  static bool be_is_client_interested(const char *xpath,  				    enum mgmt_be_client_id id, bool config)  { -	const char *const *xpaths; +	uint64_t clients;  	assert(id < MGMTD_BE_CLIENT_ID_MAX);  	__dbg("Checking client: %s for xpath: '%s'", mgmt_be_client_id2name(id),  	      xpath); -	xpaths = config ? be_client_config_xpaths[id] -			: be_client_oper_xpaths[id]; -	if (xpaths) { -		for (; *xpaths; xpaths++) { -			if (mgmt_be_xpath_prefix(*xpaths, xpath)) { -				__dbg("xpath: %s: matched: %s", *xpaths, xpath); -				return true; -			} -		} +	clients = mgmt_be_interested_clients(xpath, config); +	if (IS_IDBIT_SET(clients, id)) { +		__dbg("client: %s: interested", mgmt_be_client_id2name(id)); +		return true;  	}  	__dbg("client: %s: not interested", mgmt_be_client_id2name(id));  | 
