ripngd: add support for route tags

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2016-10-01 22:35:32 +02:00 committed by Donald Sharp
parent 9471675f21
commit 1796a585f0
4 changed files with 22 additions and 8 deletions

View File

@ -383,7 +383,7 @@ ripng_apply_address_add (struct connected *ifc) {
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 @@ ripng_connect_set (struct interface *ifp, int set)
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);
}
}
}

View File

@ -92,6 +92,12 @@ ripng_zebra_ipv6_send (struct route_node *rp, u_char cmd)
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,13 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
else
api.metric = 0;
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
api.tag = 0;
if (command == ZEBRA_REDISTRIBUTE_IPV6_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);

View File

@ -907,7 +907,8 @@ ripng_route_process (struct rte *rte, struct sockaddr_in6 *from,
/* 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;
@ -926,6 +927,8 @@ ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p,
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;
@ -2216,7 +2219,7 @@ DEFUN (ripng_route,
}
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;
}
@ -2553,7 +2556,7 @@ DEFUN (ripng_default_information_originate,
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;

View File

@ -383,7 +383,7 @@ extern void ripng_info_free (struct ripng_info *rinfo);
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);