Skip to content

Commit 63bfc6d

Browse files
authored
route: Routes may not have an interface assinged (#572)
As such, we cannot access dhcpcd_ctx so we can't use the free route list. Fixes #571.
1 parent 117742d commit 63bfc6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/route.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ rt_headclear0(struct dhcpcd_ctx *ctx, rb_tree_t *rts, int af)
313313

314314
if (rts == NULL)
315315
return;
316-
assert(ctx != NULL);
317316
#ifdef RT_FREE_ROUTE_TABLE
318-
assert(&ctx->froutes != rts);
317+
if (ctx != NULL)
318+
assert(&ctx->froutes != rts);
319319
#endif
320320

321321
RB_TREE_FOREACH_SAFE(rt, rts, rtn) {
@@ -335,7 +335,7 @@ rt_headclear(rb_tree_t *rts, int af)
335335

336336
if (rts == NULL || (rt = RB_TREE_MIN(rts)) == NULL)
337337
return;
338-
rt_headclear0(rt->rt_ifp->ctx, rts, af);
338+
rt_headclear0(rt->rt_ifp ? rt->rt_ifp->ctx : NULL, rts, af);
339339
}
340340

341341
static void

0 commit comments

Comments
 (0)