ospf6d: add support for route tags
[ported by Paul Jakma, paul@jakma.org]
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index f80bb23..2976214 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -247,6 +247,11 @@
else
api.metric = 0;
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
+ api.tag = stream_getl (s);
+ else
+ api.tag = 0;
+
if (IS_OSPF6_DEBUG_ZEBRA (RECV))
{
char prefixstr[128], nexthopstr[128];
@@ -256,14 +261,14 @@
else
snprintf (nexthopstr, sizeof (nexthopstr), "::");
- zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld",
+ zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %u",
(command == ZEBRA_IPV6_ROUTE_ADD ? "add" : "delete"),
- zebra_route_string(api.type), prefixstr, nexthopstr, ifindex);
+ zebra_route_string(api.type), prefixstr, nexthopstr, ifindex, api.tag);
}
if (command == ZEBRA_IPV6_ROUTE_ADD)
ospf6_asbr_redistribute_add (api.type, ifindex, (struct prefix *) &p,
- api.nexthop_num, nexthop);
+ api.nexthop_num, nexthop, api.tag);
else
ospf6_asbr_redistribute_remove (api.type, ifindex, (struct prefix *) &p);
@@ -470,9 +475,12 @@
SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
api.metric = (request->path.metric_type == 2 ?
request->path.cost_e2 : request->path.cost);
- SET_FLAG (api.message, ZAPI_MESSAGE_DISTANCE);
- api.distance = ospf6_distance_apply (request, ospf6);
-
+ if (request->path.tag)
+ {
+ SET_FLAG (api.message, ZAPI_MESSAGE_TAG);
+ api.tag = request->path.tag;
+ }
+
dest = (struct prefix_ipv6 *) &request->prefix;
if (type == REM)
ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api);