mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-31 04:36:25 +00:00
lib: Add callbacks for vrf changes into protocol side
Allow protocols to get callbacks associated with vrf's Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
12f6fb9731
commit
1892f15e6c
@ -864,6 +864,32 @@ zebra_router_id_update_read (struct stream *s, struct prefix *rid)
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
struct vrf *
|
||||
zebra_vrf_add_read (struct stream *s, vrf_id_t vrf_id)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
char vrfname_tmp[VRF_NAMSIZ];
|
||||
|
||||
/* Read interface name. */
|
||||
stream_get (vrfname_tmp, s, VRF_NAMSIZ);
|
||||
|
||||
/* Lookup/create vrf by vrf_id. */
|
||||
vrf = vrf_get (vrf_id, vrfname_tmp);
|
||||
|
||||
return vrf;
|
||||
}
|
||||
|
||||
struct vrf *
|
||||
zebra_vrf_state_read (struct stream *s, vrf_id_t vrf_id)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
|
||||
/* Lookup vrf by vrf_id. */
|
||||
vrf = vrf_lookup (vrf_id);
|
||||
|
||||
return vrf;
|
||||
}
|
||||
|
||||
struct interface *
|
||||
zebra_interface_add_read (struct stream *s, vrf_id_t vrf_id)
|
||||
{
|
||||
@ -1232,6 +1258,14 @@ zclient_read (struct thread *thread)
|
||||
if (zclient->router_id_update)
|
||||
(*zclient->router_id_update) (command, zclient, length, vrf_id);
|
||||
break;
|
||||
case ZEBRA_VRF_ADD:
|
||||
if (zclient->vrf_add)
|
||||
(*zclient->vrf_add) (command, zclient, length, vrf_id);
|
||||
break;
|
||||
case ZEBRA_VRF_DELETE:
|
||||
if (zclient->vrf_delete)
|
||||
(*zclient->vrf_delete) (command, zclient, length, vrf_id);
|
||||
break;
|
||||
case ZEBRA_INTERFACE_ADD:
|
||||
if (zclient->interface_add)
|
||||
(*zclient->interface_add) (command, zclient, length, vrf_id);
|
||||
|
@ -87,6 +87,8 @@ struct zclient
|
||||
/* Pointer to the callback functions. */
|
||||
void (*zebra_connected) (struct zclient *);
|
||||
int (*router_id_update) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
int (*vrf_add) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
int (*vrf_delete) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
int (*interface_add) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
int (*interface_delete) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
int (*interface_up) (int, struct zclient *, uint16_t, vrf_id_t);
|
||||
@ -191,6 +193,8 @@ extern int zclient_send_message(struct zclient *);
|
||||
/* create header for command, length to be filled in by user later */
|
||||
extern void zclient_create_header (struct stream *, uint16_t, vrf_id_t);
|
||||
|
||||
extern struct vrf *zebra_vrf_add_read (struct stream *, vrf_id_t);
|
||||
extern struct vrf *zebra_vrf_state_read (struct stream *s, vrf_id_t);
|
||||
extern struct interface *zebra_interface_add_read (struct stream *, vrf_id_t);
|
||||
extern struct interface *zebra_interface_state_read (struct stream *s, vrf_id_t);
|
||||
extern struct connected *zebra_interface_address_read (int, struct stream *, vrf_id_t);
|
||||
|
Loading…
Reference in New Issue
Block a user