lib, zebra: Pass up kernel table_id for vrf's

pim controls the vrf table creation for due to the way that
pim must interact with the kernel.  In order to match the
table_id for unicast <-> multicast( not necessary but a
real nice to have ) we need to pass up from zebra the
table_id associated with the vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-05-17 16:20:29 -04:00
parent f0683d2227
commit 1da2945621
3 changed files with 25 additions and 0 deletions

View File

@ -56,6 +56,20 @@ enum {
#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n"
#define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n"
/*
* Pass some OS specific data up through
* to the daemons
*/
struct vrf_data
{
union
{
struct {
uint32_t table_id;
} l;
};
};
struct vrf
{
RB_ENTRY(vrf) id_entry, name_entry;
@ -76,6 +90,9 @@ struct vrf
/* User data */
void *info;
/* The table_id from the kernel */
struct vrf_data data;
QOBJ_FIELDS
};
RB_HEAD (vrf_id_head, vrf);

View File

@ -1077,12 +1077,15 @@ zclient_vrf_add (struct zclient *zclient, vrf_id_t vrf_id)
{
struct vrf *vrf;
char vrfname_tmp[VRF_NAMSIZ];
struct vrf_data data;
stream_get (&data, zclient->ibuf, sizeof (struct vrf_data));
/* Read interface name. */
stream_get (vrfname_tmp, zclient->ibuf, VRF_NAMSIZ);
/* Lookup/create vrf by vrf_id. */
vrf = vrf_get (vrf_id, vrfname_tmp);
vrf->data = data;
vrf_enable (vrf);
}

View File

@ -192,6 +192,11 @@ zserv_encode_interface (struct stream *s, struct interface *ifp)
static void
zserv_encode_vrf (struct stream *s, struct zebra_vrf *zvrf)
{
struct vrf_data data;
data.l.table_id = zvrf->table_id;
/* Pass the tableid */
stream_put (s, &data, sizeof (struct vrf_data));
/* Interface information. */
stream_put (s, zvrf_name (zvrf), VRF_NAMSIZ);