diff options
author | Christian Franke <chris@opensourcerouting.org> | 2016-10-01 21:43:17 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-08 03:05:05 +0200 |
commit | 9471675f21f3f7d9cec41c32854477f96a5ce323 (patch) | |
tree | 20a3d943f82f818d64cf79b351e6eedb50a21955 /ripd | |
parent | ospf6d: add support for route tags (diff) | |
download | frr-9471675f21f3f7d9cec41c32854477f96a5ce323.tar.xz frr-9471675f21f3f7d9cec41c32854477f96a5ce323.zip |
ripd: add support for route tags
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/rip_interface.c | 6 | ||||
-rw-r--r-- | ripd/rip_zebra.c | 15 | ||||
-rw-r--r-- | ripd/ripd.c | 7 | ||||
-rw-r--r-- | ripd/ripd.h | 3 |
4 files changed, 23 insertions, 8 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 604343be8..359549ed8 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -640,7 +640,7 @@ rip_apply_address_add (struct connected *ifc) if ((rip_enable_if_lookup(ifc->ifp->name) >= 0) || (rip_enable_network_lookup2(ifc) >= 0)) rip_redistribute_add(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, - &address, ifc->ifp->ifindex, NULL, 0, 0); + &address, ifc->ifp->ifindex, NULL, 0, 0, 0); } @@ -951,7 +951,7 @@ rip_connect_set (struct interface *ifp, int set) (rip_enable_network_lookup2(connected) >= 0)) rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, &address, connected->ifp->ifindex, - NULL, 0, 0); + NULL, 0, 0, 0); } else { rip_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, @@ -959,7 +959,7 @@ rip_connect_set (struct interface *ifp, int set) if (rip_redistribute_check (ZEBRA_ROUTE_CONNECT)) rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_REDISTRIBUTE, &address, connected->ifp->ifindex, - NULL, 0, 0); + NULL, 0, 0, 0); } } } diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 23f2adf82..3f7c7a3e4 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -91,6 +91,12 @@ rip_zebra_ipv4_send (struct route_node *rp, u_char cmd) api.distance = rinfo->distance; } + if (rinfo->tag) + { + SET_FLAG (api.message, ZAPI_MESSAGE_TAG); + api.tag = rinfo->tag; + } + zapi_ipv4_route (cmd, zclient, (struct prefix_ipv4 *)&rp->p, &api); @@ -176,10 +182,15 @@ rip_zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length, else api.metric = 0; + if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG)) + api.tag = stream_getl (s); + else + api.tag = 0; + /* Then fetch IPv4 prefixes. */ if (command == ZEBRA_REDISTRIBUTE_IPV4_ADD) rip_redistribute_add (api.type, RIP_ROUTE_REDISTRIBUTE, &p, ifindex, - &nexthop, api.metric, api.distance); + &nexthop, api.metric, api.distance, api.tag); else if (command == ZEBRA_REDISTRIBUTE_IPV4_DEL) rip_redistribute_delete (api.type, RIP_ROUTE_REDISTRIBUTE, &p, ifindex); @@ -614,7 +625,7 @@ DEFUN (rip_default_information_originate, rip->default_information = 1; rip_redistribute_add (ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p, 0, - NULL, 0, 0); + NULL, 0, 0, 0); } return CMD_SUCCESS; diff --git a/ripd/ripd.c b/ripd/ripd.c index 220297e83..395a7f782 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -1513,7 +1513,8 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to, void rip_redistribute_add (int type, int sub_type, struct prefix_ipv4 *p, ifindex_t ifindex, struct in_addr *nexthop, - unsigned int metric, unsigned char distance) + unsigned int metric, unsigned char distance, + route_tag_t tag) { int ret; struct route_node *rp = NULL; @@ -1534,6 +1535,8 @@ rip_redistribute_add (int type, int sub_type, struct prefix_ipv4 *p, newinfo.metric = 1; newinfo.external_metric = metric; newinfo.distance = distance; + if (tag <= UINT16_MAX) /* RIP only supports 16 bit tags */ + newinfo.tag = tag; newinfo.rp = rp; if (nexthop) newinfo.nexthop = *nexthop; @@ -2945,7 +2948,7 @@ DEFUN (rip_route, node->info = (void *)1; - rip_redistribute_add (ZEBRA_ROUTE_RIP, RIP_ROUTE_STATIC, &p, 0, NULL, 0, 0); + rip_redistribute_add (ZEBRA_ROUTE_RIP, RIP_ROUTE_STATIC, &p, 0, NULL, 0, 0, 0); return CMD_SUCCESS; } diff --git a/ripd/ripd.h b/ripd/ripd.h index 2d5bd98de..3de23ec33 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -403,7 +403,8 @@ extern int rip_neighbor_lookup (struct sockaddr_in *); extern int rip_redistribute_check (int); extern void rip_redistribute_add (int, int, struct prefix_ipv4 *, ifindex_t, - struct in_addr *, unsigned int, unsigned char); + struct in_addr *, unsigned int, unsigned char, + route_tag_t); extern void rip_redistribute_delete (int, int, struct prefix_ipv4 *, ifindex_t); extern void rip_redistribute_withdraw (int); extern void rip_zebra_ipv4_add (struct route_node *); |