dhcpcd-discuss

Re: Change how error reported when interface is not allowed by config

Maxime Daniel

Tue Mar 17 07:50:16 2020

Hello,

Yep, that's sound better tep, thanks !

On Tue, Mar 17, 2020 at 8:36 AM Roy Marples <roy@xxxxxxxxxxxx> wrote:

> Hi
>
> On 16/03/2020 22:37, Maxime Daniel wrote:
> > When using allowinterfaces / denyinterfaces configuration keywords, when
> running
> > dhcpcd on one denied or not allowed interface, the error reported is:
> > xxxx: interface not found or invalid
> >
> > Even if the message looks accurate since it's not allowed by
> configuration (and
> > interface is probably simply not present on the available interface list
> in the
> > code), when you don't know it's configuration related or you're forget
> you set
> > it on the config file, the error is really unclear. I think it would be
> useful
> > to report that interface is explicitly not allowed, no ?
>
> Does this patch improve the error message for you?
>
> Roy
>
> diff --git a/src/dhcpcd.c b/src/dhcpcd.c
> index bf5d74c3..bd2556ea 100644
> --- a/src/dhcpcd.c
> +++ b/src/dhcpcd.c
> @@ -2173,9 +2173,11 @@ printpidfile:
>                  goto exit_failure;
>          }
>          for (i = 0; i < ctx.ifc; i++) {
> -               if ((ifp = if_find(ctx.ifaces, ctx.ifv[i])) == NULL ||
> -                   !ifp->active)
> -                       logerrx("%s: interface not found or invalid",
> +               if ((ifp = if_find(ctx.ifaces, ctx.ifv[i])) == NULL)
> +                       logerrx("%s: interface not found",
> +                           ctx.ifv[i]);
> +               else if (!ifp->active)
> +                       logerrx("%s: interface has an invalid
> configuration",
>                              ctx.ifv[i]);
>          }
>          TAILQ_FOREACH(ifp, ctx.ifaces, next) {
>

Follow-Ups:
Re: Change how error reported when interface is not allowed by configRoy Marples
References:
Change how error reported when interface is not allowed by configMaxime Daniel
Re: Change how error reported when interface is not allowed by configRoy Marples
Archive administrator: postmaster@marples.name