summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-08-30 17:17:27 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-09-14 11:53:54 +0200
commit84cac51a51fc29349077e8cecadf1aed11f9b824 (patch)
tree68186ea208019211d06ad98df82df84ab255f5e6 /proto
parenta1839f3c61af66814a8c52b9ad28e59aab4ede0e (diff)
Nest: Keep multipath next hops sorted
Diffstat (limited to 'proto')
-rw-r--r--proto/rip/rip.c5
-rw-r--r--proto/static/static.c5
2 files changed, 2 insertions, 8 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index c85fd69b..36527253 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -173,7 +173,6 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
{
/* ECMP route */
struct mpnh *nhs = NULL;
- struct mpnh **nhp = &nhs;
int num = 0;
for (rt = en->routes; rt && (num < p->ecmp); rt = rt->next)
@@ -185,9 +184,7 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
nh->gw = rt->next_hop;
nh->iface = rt->from->nbr->iface;
nh->weight = rt->from->ifa->cf->ecmp_weight;
- nh->next = NULL;
- *nhp = nh;
- nhp = &(nh->next);
+ mpnh_insert(&nhs, nh);
num++;
if (rt->tag != rt_tag)
diff --git a/proto/static/static.c b/proto/static/static.c
index be808593..d54302a8 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -81,7 +81,6 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
{
struct static_route *r2;
struct mpnh *nhs = NULL;
- struct mpnh **nhp = &nhs;
for (r2 = r->mp_next; r2; r2 = r2->mp_next)
if (r2->installed)
@@ -90,9 +89,7 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
nh->gw = r2->via;
nh->iface = r2->neigh->iface;
nh->weight = r2->masklen; /* really */
- nh->next = NULL;
- *nhp = nh;
- nhp = &(nh->next);
+ mpnh_insert(&nhs, nh);
}
/* There is at least one nexthop */