dhcpcd-discuss

Re: EXPIRE and RELEASE

Neal P. Murphy

Sun Mar 11 21:57:00 2018

On Sun, 11 Mar 2018 21:18:01 +0000
Roy Marples <roy@xxxxxxxxxxxx> wrote:

> Hi Neal
> 
> On 09/03/2018 04:04, Neal P. Murphy wrote:
> > A Smoothwall Express user recently encountered a slight problem with his ISP. dhcpcd produced reason EXPIRE, which my script doesn't handle. Nor does it handle RELEASE. But in my IPv6 testing, it does handle EXPIRE6 and RELEASE6.
> > 
> > Query: should EXPIRE(6) and RELEASE(6) do the same thing? (In the case of Smoothwall, basically clear /etc/resolv.conf, clear the local store of address/mask/gateway/etc. and 'active' status.) They indicate different reasons for taking action, but should the action for IPV4 and IPv6, respectively, be the same for each?  
> 
> EXPIRE and RELEASE should do the same thing.
> To make it easy, I introduced some more variables recently, deffo in 7.0 
> so you can do this:
> 
> if $if_up; then
> 	add_stuff
> elif $if_down; then
> 	remove_stuff
> fi
> 
> Roy

That should help reduce script complexity.

----
if DHCP; then
  if $if_down; then
    report/log reason
    clear stuff
    # Just exit. Things will die (from shutdown) or be restarted (when the link comes back)
    exit 0

  elif $if_up, then
    report/log reason
    if (BOUND|RENEW and addrs/masks/routers/dns did not change); then
      # Nothing changed, take no action.
      exit 0
    fi
    # Something changed, so handle it.
    set stuff

  else
    # Not up or down? Record reason and go back to sleep.
    report/log reason
    exit 0

  fi

elif STATIC; then
  # handle STATIC

else
  # handle PPPoX

fi

# restart dnsmasq, reset firewall rules, restart snort, squid, upnpd, traffiClogger, VPNs
#   and other stuff that depends on the upstream link.
----

For now, I'll just append |EXPIRE|RELEASE to STOP|STOPPED, which clears stuff. Don't want to change *too* much right now.

Thanks, Roy!
Neal

References:
EXPIRE and RELEASENeal P. Murphy
Re: EXPIRE and RELEASERoy Marples
Archive administrator: postmaster@marples.name