]> git.puffer.fish Git - matthieu/frr.git/commitdiff
mgmtd: lib: move INIT to after client registers
authorChristian Hopps <chopps@labn.net>
Mon, 15 May 2023 04:15:31 +0000 (00:15 -0400)
committerChristian Hopps <chopps@labn.net>
Sun, 28 May 2023 09:13:22 +0000 (05:13 -0400)
Signed-off-by: Christian Hopps <chopps@labn.net>
lib/mgmt_be_client.c
mgmtd/mgmt_be_adapter.c

index 29b54690d2aa226dbef299be96095669c8cda26d..63c38081c2cff3eeca5c2778dad9beb1e786bf69 100644 (file)
@@ -993,6 +993,9 @@ enum mgmt_result mgmt_be_subscribe_yang_data(uintptr_t lib_hndl,
 {
        struct mgmt_be_client_ctx *client_ctx;
 
+       if (!num_reg_xpaths)
+               return MGMTD_SUCCESS;
+
        client_ctx = (struct mgmt_be_client_ctx *)lib_hndl;
        if (!client_ctx)
                return MGMTD_INVALID_PARAM;
@@ -1014,6 +1017,9 @@ enum mgmt_result mgmt_be_unsubscribe_yang_data(uintptr_t lib_hndl,
 {
        struct mgmt_be_client_ctx *client_ctx;
 
+       if (!num_reg_xpaths)
+               return MGMTD_SUCCESS;
+
        client_ctx = (struct mgmt_be_client_ctx *)lib_hndl;
        if (!client_ctx)
                return MGMTD_INVALID_PARAM;
index 583b03eccc2a56dd67f2f117ab9b5477f4089824..907590501dcd2bb26e63e13f32ab31eca0da2439 100644 (file)
@@ -416,6 +416,9 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
                        }
                        mgmt_be_adapters_by_id[adapter->id] = adapter;
                        mgmt_be_adapter_cleanup_old_conn(adapter);
+
+                       /* schedule INIT sequence now that it is registered */
+                       mgmt_be_adapter_sched_init_event(adapter);
                }
 
                if (be_msg->subscr_req->n_xpath_reg)
@@ -762,8 +765,10 @@ struct msg_conn *mgmt_be_create_adapter(int conn_fd, union sockunion *from)
        MGMTD_BE_ADAPTER_DBG("Added new MGMTD Backend adapter '%s'",
                             adapter->name);
 
+#if 0 /* wait until we receive the SUBSCR_REQ registration with name */
        /* Trigger resync of config with the new adapter */
        mgmt_be_adapter_sched_init_event(adapter);
+#endif
 
        return adapter->conn;
 }