From owner-freebsd-current Wed Jul 5 2:10:29 2000 Delivered-To: freebsd-current@freebsd.org Received: from dt052n3e.san.rr.com (dt052n3e.san.rr.com [204.210.33.62]) by hub.freebsd.org (Postfix) with ESMTP id DE21137B771 for ; Wed, 5 Jul 2000 02:10:24 -0700 (PDT) (envelope-from DougB@gorean.org) Received: from gorean.org (doug@master [10.0.0.2]) by dt052n3e.san.rr.com (8.9.3/8.9.3) with ESMTP id CAA08151; Wed, 5 Jul 2000 02:08:26 -0700 (PDT) (envelope-from DougB@gorean.org) Message-ID: <3962FB0A.2A8FADF4@gorean.org> Date: Wed, 05 Jul 2000 02:08:26 -0700 From: Doug Barton Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.72 [en] (X11; U; FreeBSD 5.0-CURRENT-0702 i386) X-Accept-Language: en MIME-Version: 1.0 To: Brian Dean Cc: Greg Lehey , Samuel Tardieu , current@FreeBSD.ORG Subject: Re: DHCP does not honor default router? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Brian Dean wrote: > > On Tue, 4 Jul 2000, Doug Barton wrote: > > > I updated my dhclient script to handle this case, since it > > happens on the roadrunner network as well. I can send you the patch > > if you want, but I have a lot of other hacks in my script so it > > might be confusing. Starting right around line 106 of the default > > script, I have: > > A hook is already provided for this kind of thing. You can create a > separate program called /etc/dhclient-exit-hooks, which get run at > various times by dhclient-script. I'm aware of this, I actually helped develop it. :) > Since /etc/dhclient-exit-hooks is > sourced by /sbin/dhclient-script, you have access to all of its > internal variables, such as '$reason', '$old_ip_address', > '$new_ip_address', etc. > > Thus, you don't have to maintain a separate /sbin/dhclient-script like > you do now. My motivation for maintaining a seperate script is that at one time I was working on rewriting it to be more... sane. Unfortunately I couldn't get obrien behind me at the time, and I've since lost interest in flogging that horse. That said, there are some things that are easier to handle _in_ the script than outside of it, mostly due to timing issues. In this particular case, when the script actually reaches the point where a total flush is needed, everything after it depends on the new routes being in place, so I'd effectively have to duplicate most of the script in the exit-hooks script if I went that route. That's one of the reasons the dhclient-script exists, instead of having that all be hidden in the client binary. > Also, if you run a firewall, you should re-instantiate your rules with > the new IP address here as well. That really depends on how your firewall rules are written, although I suppose it couldn't hurt. > I notice you also flush the routing table. Is that necessary - it > appears that dhclient-script does this when it's needed? Yes, it _appears_ to, but given the right (or wrong) combination of input from the server the code that does that could get missed. In my particular case, the !#@*&$ dhcp server doesn't return the information necessary to set the $old_routers variable, so the 'route delete default $router' never happens. I suspect that the original poster is seeing the same kind of problem. > I found this exit hook feature by looking at the source for > dhclient-script, but, oddly enough, it is even documented in the man > page. I'm going to assume that you meant that in a helpful way, and just say, "thanks." :) Doug -- "Live free or die" - State motto of my ancestral homeland, New Hampshire Do YOU Yahoo!? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message