summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2016-10-01 22:35:32 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-10-08 03:05:06 +0200
commit1796a585f07b76a6855e32f339bfd7346432dd2d (patch)
treeb5a6a7eb97178d98b756bbee90c5f421ce8b164f
parentripd: add support for route tags (diff)
downloadfrr-1796a585f07b76a6855e32f339bfd7346432dd2d.tar.xz
frr-1796a585f07b76a6855e32f339bfd7346432dd2d.zip
ripngd: add support for route tags
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
-rw-r--r--ripngd/ripng_interface.c6
-rw-r--r--ripngd/ripng_zebra.c13
-rw-r--r--ripngd/ripngd.c9
-rw-r--r--ripngd/ripngd.h2
4 files changed, 22 insertions, 8 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 0061c0e80..c4dec7e7b 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -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);
}
}
}
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
index c4ed0c52c..d05b5dbad 100644
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -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);
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 0c9606e69..e8aad7774 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -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;
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index c4b34b348..e340eeecc 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -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);