summaryrefslogtreecommitdiff
path: root/ripd/rip_zebra.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2017-11-21 14:05:19 -0200
committerGitHub <noreply@github.com>2017-11-21 14:05:19 -0200
commit859dd94575c7b75b398238d249cdc20b3a039a16 (patch)
tree56cbbb8d22d83dd71723079c5d16e33bcbf70d0d /ripd/rip_zebra.c
parent9f1cac598a1a3937000899dce81e7ca0d782818f (diff)
parent11ff71648e52a79b966cc8efc7c41e2c96650f66 (diff)
Merge pull request #1452 from donaldsharp/rip_nexthops
Blackhole Fixups for bgp and rip
Diffstat (limited to 'ripd/rip_zebra.c')
-rw-r--r--ripd/rip_zebra.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
index 3772f6223e..e479e2474d 100644
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -56,7 +56,7 @@ static void rip_zebra_ipv4_send(struct route_node *rp, u_char cmd)
if (count >= MULTIPATH_NUM)
break;
api_nh = &api.nexthops[count];
- api_nh->gate.ipv4 = rinfo->nexthop;
+ api_nh->gate = rinfo->nh.gate;
api_nh->type = NEXTHOP_TYPE_IPV4;
if (cmd == ZEBRA_ROUTE_ADD)
SET_FLAG(rinfo->flags, RIP_RTF_FIB);
@@ -121,8 +121,7 @@ static int rip_zebra_read_route(int command, struct zclient *zclient,
zebra_size_t length, vrf_id_t vrf_id)
{
struct zapi_route api;
- struct in_addr nexthop;
- unsigned long ifindex;
+ struct nexthop nh;
if (!rip)
return 0;
@@ -130,19 +129,21 @@ static int rip_zebra_read_route(int command, struct zclient *zclient,
if (zapi_route_decode(zclient->ibuf, &api) < 0)
return -1;
- nexthop = api.nexthops[0].gate.ipv4;
- ifindex = api.nexthops[0].ifindex;
+ memset(&nh, 0, sizeof(nh));
+ nh.type = api.nexthops[0].type;
+ nh.gate.ipv4 = api.nexthops[0].gate.ipv4;
+ nh.ifindex = api.nexthops[0].ifindex;
/* Then fetch IPv4 prefixes. */
if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
rip_redistribute_add(api.type, RIP_ROUTE_REDISTRIBUTE,
- (struct prefix_ipv4 *)&api.prefix, ifindex,
- &nexthop, api.metric, api.distance,
+ (struct prefix_ipv4 *)&api.prefix, &nh,
+ api.metric, api.distance,
api.tag);
else if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL)
rip_redistribute_delete(api.type, RIP_ROUTE_REDISTRIBUTE,
(struct prefix_ipv4 *)&api.prefix,
- ifindex);
+ nh.ifindex);
return 0;
}
@@ -501,15 +502,19 @@ DEFUN (rip_default_information_originate,
"Distribute a default route\n")
{
struct prefix_ipv4 p;
+ struct nexthop nh;
if (!rip->default_information) {
memset(&p, 0, sizeof(struct prefix_ipv4));
+ memset(&nh, 0, sizeof(nh));
+
p.family = AF_INET;
+ nh.type = NEXTHOP_TYPE_IPV4;
rip->default_information = 1;
- rip_redistribute_add(ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p, 0,
- NULL, 0, 0, 0);
+ rip_redistribute_add(ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p,
+ &nh, 0, 0, 0);
}
return CMD_SUCCESS;