return 0;
}
+static afi_t
+afi_for_redist_protocol(int protocol)
+{
+ if (protocol == 0)
+ return AFI_IP;
+ if (protocol == 1)
+ return AFI_IP6;
+
+ assert(!"Unknown redist protocol!");
+ return AFI_IP;
+}
+
static int
is_default(struct prefix *p)
{
int level;
int protocol;
- char do_subscribe[ZEBRA_ROUTE_MAX + 1];
+ char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1];
memset(do_subscribe, 0, sizeof(do_subscribe));
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
for (level = 0; level < ISIS_LEVELS; level++)
if (area->redist_settings[protocol][type][level].redist)
- do_subscribe[type] = 1;
+ do_subscribe[protocol][type] = 1;
- 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 == ZEBRA_ROUTE_ISIS)
- continue;
+ 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 == ZEBRA_ROUTE_ISIS)
+ continue;
- if (do_subscribe[type])
- isis_zebra_redistribute_set(type);
- else
- isis_zebra_redistribute_unset(type);
+ afi_t afi = afi_for_redist_protocol(protocol);
+
+ if (do_subscribe[protocol][type])
+ isis_zebra_redistribute_set(afi, type);
+ else
+ isis_zebra_redistribute_unset(afi, type);
}
}
struct stream *stream;
struct zapi_ipv6 api;
struct prefix_ipv6 p;
+ struct prefix src_p;
struct prefix *p_generic = (struct prefix*)&p;
struct in6_addr nexthop;
unsigned long ifindex __attribute__((unused));
ifindex = 0;
api.type = stream_getc(stream);
+ api.instance = stream_getw(stream);
api.flags = stream_getl(stream);
api.message = stream_getc(stream);
p.prefixlen = stream_getc(stream);
stream_get(&p.prefix, stream, PSIZE(p.prefixlen));
+ memset(&src_p, 0, sizeof (struct prefix));
+ src_p.family = AF_INET6;
+ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
+ {
+ src_p.prefixlen = stream_getc(stream);
+ stream_get(&src_p.u.prefix6, stream, PSIZE (src_p.prefixlen));
+ }
+
+ if (src_p.prefixlen)
+ /* we completely ignore srcdest routes for now. */
+ return 0;
+
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP))
{
api.nexthop_num = stream_getc(stream); /* this is always 1 */
api.distance = stream_getc(stream);
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC))
api.metric = stream_getl(stream);
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
+ api.tag = stream_getl(stream);
/*
* Avoid advertising a false default reachability. (A default
if (p.prefixlen == 0 && api.type == ZEBRA_ROUTE_ISIS)
command = ZEBRA_IPV6_ROUTE_DELETE;
- if (command == ZEBRA_IPV6_ROUTE_ADD)
+ if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD)
isis_redist_add(api.type, p_generic, api.distance, api.metric);
else
isis_redist_delete(api.type, p_generic);
}
void
-isis_zebra_redistribute_set(int type)
+isis_zebra_redistribute_set(afi_t afi, int type)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, VRF_DEFAULT);
else
- zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type, 0, VRF_DEFAULT);
+ zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, 0, VRF_DEFAULT);
}
void
-isis_zebra_redistribute_unset(int type)
+isis_zebra_redistribute_unset(afi_t afi, int type)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, VRF_DEFAULT);
else
- zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0, VRF_DEFAULT);
+ zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, 0, VRF_DEFAULT);
}
static void