From 1da29456213a3062206bc7646de169e32e9cc324 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 17 May 2017 16:20:29 -0400 Subject: [PATCH] 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 --- lib/vrf.h | 17 +++++++++++++++++ lib/zclient.c | 3 +++ zebra/zserv.c | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/lib/vrf.h b/lib/vrf.h index fe2b4842b0..d470349f00 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -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); diff --git a/lib/zclient.c b/lib/zclient.c index a53e8112c8..b3a9338928 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -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); } diff --git a/zebra/zserv.c b/zebra/zserv.c index e93299d622..b131b208c6 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -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); -- 2.39.5