summaryrefslogtreecommitdiff
path: root/proto/ospf/rt.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-04-18 13:22:41 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2015-04-18 13:26:45 +0200
commitef3cac669ca0f6f2b983e33ab6d553705c35f3df (patch)
treedb6a93d4476ef6dba958d76cbc2aea5a7a32e2d4 /proto/ospf/rt.c
parent304ac2e861a5ea28683489aff38ff37ff6873bb4 (diff)
OSPF: Fixes handling of external routes with immediate gw
The bug caused that received external LSAs with locally reachable next hops were ignored. I wonder why nobody noticed it sooner.
Diffstat (limited to 'proto/ospf/rt.c')
-rw-r--r--proto/ospf/rt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index b616c0d1..74d10c7b 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -95,6 +95,8 @@ merge_nexthops(struct ospf_proto *p, struct mpnh *s1, struct mpnh *s2, int r1, i
struct mpnh **n = &root;
int count = p->ecmp;
+ ASSERT(p->ecmp);
+
/*
* r1, r2 signalize whether we can reuse nexthops from s1, s2.
* New nexthops (s2, new) can be reused if they are not inherited
@@ -153,6 +155,9 @@ fix_device_nexthops(struct ospf_proto *p, const struct mpnh *n, ip_addr gw)
struct mpnh **nn1 = &root1;
struct mpnh **nn2 = &root2;
+ if (!p->ecmp)
+ return new_nexthop(p, gw, n->iface, n->weight);
+
/* This is a bit tricky. We cannot just copy the list and update n->gw,
because the list should stay sorted, so we create two lists, one with new
gateways and one with old ones, and then merge them. */