summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-02-14 22:37:07 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-02-14 22:43:27 +0100
commit3343088a7164a54b1e6c6cf9648d8036a61e9827 (patch)
tree15e57ab427ed9410ba9d4e968533f76a7af36220
parentab089f4fb5e1ac762a9c95ed4638e2477803678e (diff)
RIP: Fix crash when interface is removed
Recent changes in neighbor code caused RIP to access neighbor field which is NULL during interface/neighbor removal and caused crash when debug messages are enabled. Use correct field to get iface from neighbor.
-rw-r--r--proto/rip/rip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 4559310e..e811a3d8 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -167,7 +167,7 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
struct nexthop *nh = allocz(sizeof(struct nexthop));
nh->gw = rt->next_hop;
- nh->iface = rt->from->nbr->iface;
+ nh->iface = rt->from->ifa->iface;
nh->weight = rt->from->ifa->cf->ecmp_weight;
nexthop_insert(&nhs, nh);
@@ -184,7 +184,7 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
/* Unipath route */
a0.from = rt->from->nbr->addr;
a0.nh.gw = rt->next_hop;
- a0.nh.iface = rt->from->nbr->iface;
+ a0.nh.iface = rt->from->ifa->iface;
}
rta *a = rta_lookup(&a0);
@@ -402,7 +402,7 @@ rip_remove_neighbor(struct rip_proto *p, struct rip_neighbor *n)
{
neighbor *nbr = n->nbr;
- TRACE(D_EVENTS, "Removing neighbor %I on %s", nbr->addr, nbr->iface->name);
+ TRACE(D_EVENTS, "Removing neighbor %I on %s", nbr->addr, nbr->ifreq->name);
rem_node(NODE n);
n->ifa = NULL;