diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-02-01 12:11:39 -0800 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-02-01 12:11:39 -0800 |
| commit | 1892f15e6c64863ee8306871e4e7e8ec83ce40c4 (patch) | |
| tree | 1403b5526ceecc02671963fa708e0ba5d5816a35 /lib/zclient.c | |
| parent | 12f6fb97311c58742f305ef240f918aa5d57fa79 (diff) | |
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>
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 8279fc70a1..42a9659393 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -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); |
