dhcpcd-discuss

Re: $skip_hooks empty for some $reason values

Scott Leggett

Thu May 21 17:00:34 2020

On 2020-05-20.22:09, Roy Marples wrote:
> 
> No, it's not intentional.
> 
> What version do you see this with?
> 

This is with dhcpcd-9.0.2-60-gdad38acf, built without privsep, running
under systemd on Linux.

My config is:

    noipv4ll
    noipv6rs
    nohook resolv.conf
    allowinterfaces enp1s0
    interface enp1s0
        waitip 4
        release
        # noipv6
        ipv6rs
        ia_pd 1 enp2s0/1 enp3s0/2 wlx00c0ca974683/3

If I apply this patch to the 20-resolv.conf hook:

    --- hooks/20-resolv.conf	2020-05-16 20:46:08.553036463 +0800
    +++ 20-resolv.conf	2020-05-21 23:55:19.730015540 +0800
    @@ -198,8 +198,18 @@
     	;;
     esac
     
    -if $if_up || [ "$reason" = ROUTERADVERT ]; then
    -	add_resolv_conf
    -elif $if_down; then
    -	remove_resolv_conf
    -fi
    +case "$reason" in
    +STOPPED|PREINIT|NOCARRIER)
    +	# skip update of /etc/resolv.conf since $skip_hooks is not populated
    +	# and there are no useful updates anyway
    +	echo reason: $reason
    +	echo skip_hooks: $skip_hooks
    +	;;
    +*)
    +	if $if_up || [ "$reason" = ROUTERADVERT ]; then
    +		add_resolv_conf
    +	elif $if_down; then
    +		remove_resolv_conf
    +	fi
    +	;;
    +esac

I get this in my logs:

    May 21 23:53:35 gateway dhcpcd[1370]: reason: PREINIT
    May 21 23:53:35 gateway dhcpcd[1370]: skip_hooks:
    May 21 23:53:35 gateway dhcpcd[1370]: reason: PREINIT
    May 21 23:53:35 gateway dhcpcd[1370]: skip_hooks:
    May 21 23:53:35 gateway dhcpcd[1370]: reason: NOCARRIER
    May 21 23:53:35 gateway dhcpcd[1370]: skip_hooks:
    May 21 23:53:35 gateway dhcpcd[1370]: reason: PREINIT
    May 21 23:53:35 gateway dhcpcd[1370]: skip_hooks:

If I move the `nohook resolv.conf` line under the interface definition
in my config file I get the same result.

Let me know if there is some more information I can provide :-)

-- 
Regards,
Scott Leggett.

Attachment: signature.asc
Description: PGP signature


Follow-Ups:
Re: $skip_hooks empty for some $reason valuesRoy Marples
References:
$skip_hooks empty for some $reason valuesScott Leggett
Re: $skip_hooks empty for some $reason valuesRoy Marples
Archive administrator: postmaster@marples.name