dhcpcd-discuss

Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSD

Roy Marples

Sat Jan 16 17:08:34 2021

On 16/01/2021 16:26, Theo Buehler wrote:
Indeed it does, it's now as silent as before. It works fine on my router.
Thanks!

Great!

However, since rt_proto_add() internally does rt_free(rt) on
rb_tree_insert_node() failure, I believe the free(rt) is now incorrect,
as that would be a double free.

Eek!
New patch.

Roy

diff --git a/src/route.c b/src/route.c
index 71523c14..89d0c132 100644
--- a/src/route.c
+++ b/src/route.c
@@ -409,6 +409,7 @@ rt_proto_add_ctx(rb_tree_t *tree, struct rt *rt, struct dhcpcd_ctx *ctx)
                return rt;

        rt_free(rt);
+       errno = EEXIST;
        return NULL;
 }

diff --git a/src/script.c b/src/script.c
index 5f404eac..622bab87 100644
--- a/src/script.c
+++ b/src/script.c
@@ -390,6 +390,7 @@ make_env(struct dhcpcd_ctx *ctx, const struct interface *ifp,
        if (ifp->ctx->options & DHCPCD_DUMPLEASE)
                goto dumplease;

+       ifp->ctx->rt_order = 0;
        rb_tree_init(&ifaces, &rt_compare_proto_ops);
        TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
                if (!ifp2->active)
@@ -397,7 +398,7 @@ make_env(struct dhcpcd_ctx *ctx, const struct interface *ifp,
                rt = rt_new(UNCONST(ifp2));
                if (rt == NULL)
                        goto eexit;
-               if (rb_tree_insert_node(&ifaces, rt) != rt)
+               if (rt_proto_add(&ifaces, rt) != rt)
                        goto eexit;
        }
        if (fprintf(fp, "interface_order=") == -1)

Follow-Ups:
Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDTheo Buehler
References:
log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDTheo Buehler
Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDTheo Buehler
Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDRoy Marples
Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDTheo Buehler
Archive administrator: postmaster@marples.name