dhcpcd-discuss

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

Roy Marples

Sat Jan 16 15:47:32 2021

On 13/01/2021 20:45, Theo Buehler wrote:
I forgot to include the most important bit in my last mail: Thanks a lot
for dhcpcd! I'm a new user only a few months. It was easy to figure out
how to get it to do what I want it to and since then it has just worked.

High praise indeed!

Thanks :)
Two small notes:

On Mon, Jan 11, 2021 at 06:11:03PM +0100, Theo Buehler wrote:
After upgrading my router to OpenBSD-current and updating the dhcpcd
package from dhcpcd-9.3.2v0 to 9.3.4v0, I started seeing a noise of this

>> Jan 11 13:43:57 apu dhcpcd[89340]: make_env: Undefined error: 0
>> Jan 11 13:43:57 apu dhcpcd[89340]: script_runreason: Undefined error: 0
>> Jan 11 13:46:44 apu dhcpcd[89340]: make_env: Undefined error: 0
>> Jan 11 13:46:44 apu dhcpcd[89340]: script_runreason: Undefined error: 0
>>
>> Every 2-3 minutes such lines are added. Apart from the noise, everything
>> seems to be working as normal. Stuart Henderson tells me he's seeing the
>> same on one of his boxes.

I should propably set errno = EEXIST to get a better error as well.
So this means the route preference logic based on interface things there is a duplicate somehow.


Typo. I meant dhcpcd 9.4.0v0 when I wrote 9.3.4v0.

394         TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
395                 if (!ifp2->active)
396                         continue;
397                 rt = rt_new(UNCONST(ifp2));
398                 if (rt == NULL)
399                         goto eexit;
400                 if (rb_tree_insert_node(&ifaces, rt) != rt)

If the insertion fails, shouldn't rt be freed with rt_free()?

Yes, it should be freed.
Good catch!

I can't replicate this on my OpenBSD VM, but I suspect it's possible for interfaces to have the same priority number? If so does this patch help any?

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 OpenBSDStuart Henderson
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
Archive administrator: postmaster@marples.name