dhcpcd-discuss

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

Theo Buehler

Sat Jan 16 16:26:11 2021

> I can't replicate this on my OpenBSD VM, but I suspect it's possible for
> interfaces to have the same priority number?

I believe so, yes.

> If so does this patch help any?

Indeed it does, it's now as silent as before. It works fine on my router.
Thanks!

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.

> 
> Roy
> 
> diff --git a/src/script.c b/src/script.c
> index 5f404eac..42decc49 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,8 +398,11 @@ 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) {
> +                       free(rt);
> +                       errno = EEXIST;
>                         goto eexit;
> +               }
>         }
>         if (fprintf(fp, "interface_order=") == -1)
>                 goto eexit;

Follow-Ups:
Re: log noise after upgrading from 9.3.2 to 9.4.0 on OpenBSDRoy Marples
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
Archive administrator: postmaster@marples.name