return 0;
}
-static afi_t afi_for_redist_protocol(int protocol)
+afi_t afi_for_redist_protocol(int protocol)
{
if (protocol == 0)
return AFI_IP;
int level;
int protocol;
+ if (isis->vrf_id == VRF_UNKNOWN)
+ return;
+
char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1];
memset(do_subscribe, 0, sizeof(do_subscribe));
afi_t afi = afi_for_redist_protocol(protocol);
if (do_subscribe[protocol][type])
- isis_zebra_redistribute_set(afi, type);
+ isis_zebra_redistribute_set(afi, type,
+ isis->vrf_id);
else
- isis_zebra_redistribute_unset(afi, type);
+ isis_zebra_redistribute_unset(afi, type,
+ isis->vrf_id);
}
}
return 0;
}
-void isis_zebra_redistribute_set(afi_t afi, int type)
+void isis_zebra_redistribute_set(afi_t afi, int type, vrf_id_t vrf_id)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
- zclient, afi, VRF_DEFAULT);
+ zclient, afi, vrf_id);
else
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type,
- 0, VRF_DEFAULT);
+ 0, vrf_id);
}
-void isis_zebra_redistribute_unset(afi_t afi, int type)
+void isis_zebra_redistribute_unset(afi_t afi, int type, vrf_id_t vrf_id)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
- zclient, afi, VRF_DEFAULT);
+ zclient, afi, vrf_id);
else
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi,
- type, 0, VRF_DEFAULT);
+ type, 0, vrf_id);
}
/**
struct isis_sr_psid_info *psid);
void isis_zebra_send_adjacency_sid(int cmd, const struct sr_adjacency *sra);
int isis_distribute_list_update(int routetype);
-void isis_zebra_redistribute_set(afi_t afi, int type);
-void isis_zebra_redistribute_unset(afi_t afi, int type);
+void isis_zebra_redistribute_set(afi_t afi, int type, vrf_id_t vrf_id);
+void isis_zebra_redistribute_unset(afi_t afi, int type, vrf_id_t vrf_id);
int isis_zebra_rlfa_register(struct isis_spftree *spftree, struct rlfa *rlfa);
void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree);
bool isis_zebra_label_manager_ready(void);
else
isis->vrf_id = VRF_UNKNOWN;
+ isis_zebra_vrf_register(isis);
+
if (IS_DEBUG_EVENTS)
zlog_debug(
"%s: Create new isis instance with vrf_name %s vrf_id %u",
listnode_delete(im->isis, isis);
+ isis_zebra_vrf_deregister(isis);
+
vrf = vrf_lookup_by_name(isis->name);
if (vrf)
isis_vrf_unlink(isis, vrf);
return 0;
}
+static void isis_set_redist_vrf_bitmaps(struct isis *isis, bool set)
+{
+ struct listnode *node;
+ struct isis_area *area;
+ int type;
+ int level;
+ int protocol;
+
+ char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1];
+
+ memset(do_subscribe, 0, sizeof(do_subscribe));
+
+ for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
+ for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
+ for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
+ for (level = 0; level < ISIS_LEVELS; level++)
+ if (area->redist_settings[protocol]
+ [type][level]
+ .redist
+ == 1)
+ do_subscribe[protocol][type] =
+ 1;
+
+ for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
+ for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) {
+ /* This field is actually controlling transmission of
+ * the IS-IS
+ * routes to Zebra and has nothing to do with
+ * redistribution,
+ * so skip it. */
+ if (type == PROTO_TYPE)
+ continue;
+
+ if (!do_subscribe[protocol][type])
+ continue;
+
+ afi_t afi = afi_for_redist_protocol(protocol);
+
+ if (type == DEFAULT_ROUTE) {
+ if (set)
+ vrf_bitmap_set(
+ zclient->default_information
+ [afi],
+ isis->vrf_id);
+ else
+ vrf_bitmap_unset(
+ zclient->default_information
+ [afi],
+ isis->vrf_id);
+ } else {
+ if (set)
+ vrf_bitmap_set(
+ zclient->redist[afi][type],
+ isis->vrf_id);
+ else
+ vrf_bitmap_unset(
+ zclient->redist[afi][type],
+ isis->vrf_id);
+ }
+ }
+}
+
static int isis_vrf_enable(struct vrf *vrf)
{
struct isis *isis;
__func__, vrf->name, isis->vrf_id, old_vrf_id);
if (old_vrf_id != isis->vrf_id) {
/* start zebra redist to us for new vrf */
+ isis_set_redist_vrf_bitmaps(isis, true);
+
isis_zebra_vrf_register(isis);
}
}
isis_zebra_vrf_deregister(isis);
+ isis_set_redist_vrf_bitmaps(isis, false);
+
/* We have instance configured, unlink
* from VRF and make it "down".
*/