mirror_frr/lib/routing_nb.h
Igor Ryzhov 2ada626940 lib: register dependency between control plane protocol and vrf nb nodes
When the control plane protocol is created, the vrf structure is
allocated, and its address is stored in the northbound node.
The vrf structure may later be deleted by the user, which will lead to
a stale pointer stored in this node.

Instead of this, allow daemons that use the vrf pointer to register the
dependency between the control plane protocol and vrf nodes. This will
guarantee that the nodes will always be created and deleted together, and
there won't be any stale pointers.

Add such registration to staticd and pimd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-22 18:53:24 +03:00

32 lines
1.2 KiB
C

#ifndef _FRR_ROUTING_NB_H_
#define _FRR_ROUTING_NB_H_
extern const struct frr_yang_module_info frr_routing_info;
/* Mandatory callbacks. */
int routing_control_plane_protocols_control_plane_protocol_create(
struct nb_cb_create_args *args);
int routing_control_plane_protocols_control_plane_protocol_destroy(
struct nb_cb_destroy_args *args);
#define FRR_ROUTING_XPATH \
"/frr-routing:routing/control-plane-protocols/control-plane-protocol"
#define FRR_ROUTING_KEY_XPATH \
"/frr-routing:routing/control-plane-protocols/" \
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']"
#define FRR_ROUTING_KEY_XPATH_VRF \
"/frr-routing:routing/control-plane-protocols/" \
"control-plane-protocol[vrf='%s']"
/*
* callbacks for routing to handle configuration events
* based on the control plane protocol
*/
DECLARE_HOOK(routing_conf_event, (struct nb_cb_create_args *args), (args))
void routing_control_plane_protocols_register_vrf_dependency(void);
#endif /* _FRR_ROUTING_NB_H_ */