Subject: bin/9406: dhclient fallback to static lease doesn't work w/o router
To: None <gnats-bugs@gnats.netbsd.org>
From: None <M.Drochner@fz-juelich.de>
List: netbsd-bugs
Date: 02/13/2000 07:39:44
>Number:         9406
>Category:       bin
>Synopsis:       dhclient fallback to static lease doesn't work w/o router
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 13 07:39:01 2000
>Last-Modified:
>Originator:     Matthias Drochner
>Organization:
	KFA Juelich
>Release:        today
>Environment:
	NetBSD-current
System: NetBSD zelz26 1.4S NetBSD 1.4S (xxx) #102: Thu Feb 10 12:23:34 MET 2000 drochner@zelz26:/home/drochner/xxx i386


>Description:
	I want to operate a laptop which is normally configured via DHCP
temporarily in a mini-network without a router and without DHCP server.
For that, I've given it a static lease in /etc/dhclient.conf.
(To work around the problem described in PR bin/9405 I've manually removed
the DHCP assigned lease in /var/db/dhclient.leases.)
The static lease doesn't get accepted unless
1. it contains an "option routers" statement
2. the router is pingable

Code inspection shows that /etc/dhclient-script is called with
reason=TIMEOUT within dhclient.c:state_panic(). The script looks like:
  if [ "$new_routers" != "" ]; then
    set $new_routers
    if ping -n -q -c 1 -w 1 $1; then
      [...]
      exit_with_hooks 0
    fi
  fi
  [...]
  exit_with_hooks 1

This makes the script return an error unless the conditions are fulfilled;
dhclient ignores leases where the script doesn't return success.

>How-To-Repeat:
	use a static lease without a router entry, or with a router
which isn't physically present
>Fix:
	???
>Audit-Trail:
>Unformatted: