ripngd: add support for route tags
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index e1f436e..1d3757a 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -383,7 +383,7 @@
if ((ripng_enable_if_lookup(ifc->ifp->name) >= 0) ||
(ripng_enable_network_lookup2(ifc) >= 0))
ripng_redistribute_add(ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
- &address, ifc->ifp->ifindex, NULL);
+ &address, ifc->ifp->ifindex, NULL, 0);
}
@@ -704,13 +704,13 @@
if ((ripng_enable_if_lookup(connected->ifp->name) >= 0) ||
(ripng_enable_network_lookup2(connected) >= 0))
ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
- &address, connected->ifp->ifindex, NULL);
+ &address, connected->ifp->ifindex, NULL, 0);
} else {
ripng_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
&address, connected->ifp->ifindex);
if (ripng_redistribute_check (ZEBRA_ROUTE_CONNECT))
ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_REDISTRIBUTE,
- &address, connected->ifp->ifindex, NULL);
+ &address, connected->ifp->ifindex, NULL, 0);
}
}
}
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
index 7221616..a35bc99 100644
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -91,6 +91,12 @@
SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
api.metric = rinfo->metric;
+ if (rinfo->tag)
+ {
+ SET_FLAG (api.message, ZAPI_MESSAGE_TAG);
+ api.tag = rinfo->tag;
+ }
+
zapi_ipv6_route (cmd, zclient,
(struct prefix_ipv6 *)&rp->p, &api);
@@ -172,8 +178,14 @@
else
api.metric = 0;
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
+ api.tag = stream_getl (s);
+ else
+ api.tag = 0;
+
if (command == ZEBRA_IPV6_ROUTE_ADD)
- ripng_redistribute_add (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex, &nexthop);
+ ripng_redistribute_add (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p,
+ ifindex, &nexthop, api.tag);
else
ripng_redistribute_delete (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex);
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index d94bea3..824b3a4 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -905,7 +905,8 @@
/* Add redistributed route to RIPng table. */
void
ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p,
- ifindex_t ifindex, struct in6_addr *nexthop)
+ ifindex_t ifindex, struct in6_addr *nexthop,
+ route_tag_t tag)
{
struct route_node *rp;
struct ripng_info *rinfo = NULL, newinfo;
@@ -924,6 +925,8 @@
newinfo.sub_type = sub_type;
newinfo.ifindex = ifindex;
newinfo.metric = 1;
+ if (tag <= UINT16_MAX) /* RIPng only supports 16 bit tags */
+ newinfo.tag = tag;
newinfo.rp = rp;
if (nexthop && IN6_IS_ADDR_LINKLOCAL(nexthop))
newinfo.nexthop = *nexthop;
@@ -2214,7 +2217,7 @@
}
rp->info = (void *)1;
- ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_STATIC, &p, 0, NULL);
+ ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_STATIC, &p, 0, NULL, 0);
return CMD_SUCCESS;
}
@@ -2551,7 +2554,7 @@
ripng->default_information = 1;
str2prefix_ipv6 ("::/0", &p);
- ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT, &p, 0, NULL);
+ ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT, &p, 0, NULL, 0);
}
return CMD_SUCCESS;
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index ef6d56a..a0c6a4e 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -381,7 +381,7 @@
extern void ripng_event (enum ripng_event, int);
extern int ripng_request (struct interface *ifp);
extern void ripng_redistribute_add (int, int, struct prefix_ipv6 *,
- ifindex_t, struct in6_addr *);
+ ifindex_t, struct in6_addr *, route_tag_t);
extern void ripng_redistribute_delete (int, int, struct prefix_ipv6 *,
ifindex_t);
extern void ripng_redistribute_withdraw (int type);