diff options
| author | Christian Hopps <chopps@gmail.com> | 2024-02-14 10:04:11 -0500 | 
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2024-02-18 18:53:37 -0500 | 
| commit | 4a93d171c2e3ec1ff6c4fc553d6acf42e035e0d4 (patch) | |
| tree | 6b1b90eace15b70e08b5b487c97b5ebfbe06962f /mgmtd/mgmt_be_adapter.c | |
| parent | 1d4ea437e4a4fced3fce6e441952fdea8d94af80 (diff) | |
lib: mgmtd: add xpath arg to notification message
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'mgmtd/mgmt_be_adapter.c')
| -rw-r--r-- | mgmtd/mgmt_be_adapter.c | 26 | 
1 files changed, 15 insertions, 11 deletions
diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c index d85d87b4b6..b311bf4698 100644 --- a/mgmtd/mgmt_be_adapter.c +++ b/mgmtd/mgmt_be_adapter.c @@ -592,25 +592,29 @@ static void mgmt_be_adapter_send_notify(struct mgmt_msg_notify_data *msg,  {  	struct mgmt_be_client_adapter *adapter;  	struct mgmt_be_xpath_map *map; -	char notif[XPATH_MAXLEN]; -	struct lyd_node *dnode; -	LY_ERR err; -	uint id; +	struct nb_node *nb_node; +	const char *notif; +	uint id, len;  	if (!darr_len(be_notif_xpath_map))  		return; -	err = yang_parse_notification(msg->result_type, (char *)msg->result, -				      &dnode); -	if (err) +	notif = mgmt_msg_native_xpath_decode(msg, msglen); +	if (!notif) { +		__log_err("Corrupt notify msg");  		return; +	} -	lysc_path(dnode->schema, LYSC_PATH_DATA, notif, sizeof(notif)); - -	lyd_free_all(dnode); +	nb_node = nb_node_find(notif); +	if (!nb_node) { +		__log_err("No schema found for notification: %s", notif); +		return; +	}  	darr_foreach_p (be_notif_xpath_map, map) { -		if (strncmp(map->xpath_prefix, notif, strlen(map->xpath_prefix))) +		len = strlen(map->xpath_prefix); +		if (strncmp(map->xpath_prefix, nb_node->xpath, len) && +		    strncmp(map->xpath_prefix, notif, len))  			continue;  		FOREACH_BE_CLIENT_BITS (id, map->clients) {  | 
