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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to