summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isisd/isis_redist.c41
-rw-r--r--isisd/isis_zebra.c26
-rw-r--r--isisd/isis_zebra.h4
3 files changed, 51 insertions, 20 deletions
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index bdf90aaa1e..abc4003fe1 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -55,6 +55,18 @@ redist_protocol(int family)
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)
{
@@ -387,7 +399,7 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
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));
@@ -396,20 +408,23 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
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);
}
}
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index e7bd99c3e8..79bc752e5f 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -602,6 +602,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
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));
@@ -613,6 +614,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
ifindex = 0;
api.type = stream_getc(stream);
+ api.instance = stream_getw(stream);
api.flags = stream_getl(stream);
api.message = stream_getc(stream);
@@ -620,6 +622,18 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
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 */
@@ -634,6 +648,8 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
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
@@ -644,7 +660,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
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);
@@ -659,21 +675,21 @@ isis_distribute_list_update (int routetype)
}
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
diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h
index 217e3d48cd..69759a627c 100644
--- a/isisd/isis_zebra.h
+++ b/isisd/isis_zebra.h
@@ -28,7 +28,7 @@ void isis_zebra_init(struct thread_master *);
void isis_zebra_route_update (struct prefix *prefix,
struct isis_route_info *route_info);
int isis_distribute_list_update (int routetype);
-void isis_zebra_redistribute_set(int type);
-void isis_zebra_redistribute_unset(int type);
+void isis_zebra_redistribute_set(afi_t afi, int type);
+void isis_zebra_redistribute_unset(afi_t afi, int type);
#endif /* _ZEBRA_ISIS_ZEBRA_H */