external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
author yamt <yamt@NetBSD.org>
Tue, 17 Apr 2012 00:01:34 +0000
branchyamt-pagecache
changeset 280360 e98874280705
parent 199649 7abaf08f3305
child 280393 591e5f54cb27
permissions -rw-r--r--
sync with head

.\" Copyright (c) 2006-2012 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 19, 2012
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
.Nm dhcpcd-run-hooks
.Nd DHCP client configuration script
.Sh DESCRIPTION
.Nm
is used by
.Xr dhcpcd 8
to run any system and user defined hook scripts.
System hook scripts are found in
.Pa @HOOKDIR@
and the user defined hooks are
.Pa @SYSCONFDIR@/dhcpcd.enter-hook .
and
.Pa @SYSCONFDIR@/dhcpcd.exit-hook .
The default install supplies hook scripts for configuring
.Pa /etc/resolv.conf
and the hostname.
Your distribution may have included other hook scripts to say configure
ntp or ypbind.
A test hook is also supplied that simply echos the dhcp variables to the
console from DISCOVER message.
.Pp
Each time
.Nm
is invoked,
.Ev $interface
is set to the interface that
.Nm dhcpcd
is run on and
.Ev $reason
is to the reason why
.Nm
was invoked.
DHCP information to be configured is held in variables starting with the word
new_ and old DHCP information to be removed is held in variables starting with
the word old_.
.Nm dhcpcd
can display the full list of variables it knows how about by using the
.Fl V , -variables
argument.
.Pp
Here's a list of reasons why
.Nm
could be invoked:
.Bl -tag -width ROUTERADVERT
.It Dv PREINIT
dhcpcd is starting up and any pre-initialisation should be done.
.It Dv CARRIER
dhcpcd has detected the carrier is up.
This is generally just a notification and no action need be taken.
.It Dv INFORM
dhcpcd informed a DHCP server about it's address and obtained other
configuration details.
.It Dv BOUND
dhcpcd obtained a new lease from a DHCP server.
.It Dv RENEW
dhcpcd renewed it's lease.
.It Dv REBIND
dhcpcd has rebound to a new DHCP server.
.It Dv REBOOT
dhcpcd successfully requested a lease from a DHCP server.
.It Dv IPV4LL
dhcpcd failed to contact any DHCP servers but did obtain an IPV4LL address.
.It Dv STATIC
dhcpcd has been configured with a static configuration which has not been
obtained from a DHCP server.
.It Dv 3RDPARTY
dhcpcd is monitoring the interface for a 3rd party to give it an IP address.
.It Dv TIMEOUT
dhcpcd failed to contact any DHCP servers but was able to use an old lease.
.It Dv EXPIRE
dhcpcd's lease or state expired and it failed to obtain a new one.
.It Dv RELEASE
dhcpcd's lease was released back to the DHCP server for re-use.
.It Dv NAK
dhcpcd received a NAK from the DHCP server.
This should be treated as EXPIRE.
.It Dv NOCARRIER
dhcpcd lost the carrier.
The cable may have been unplugged or association to the wireless point lost.
.It Dv FAIL
dhcpcd failed to operate on the interface.
This normally happens when dhcpcd does not support the raw interface, which
means it cannot work as a DHCP or ZeroConf client.
Static configuration and DHCP INFORM is still allowed.
.It Dv STOP
dhcpcd stopped running on the interface.
.It Dv DUMP
dhcpcd has been asked to dump the last lease for the interface.
.It Dv TEST
dhcpcd received an OFFER from a DHCP server but will not configure the
interface.
This is primarily used to test the variables are filled correctly for the
script to process them.
.It Dv ROUTERADVERT
dhcpcd has received an IPv6 Router Advertisment, or one has expired.
.El
.Sh FILES
When
.Nm
runs, it loads
.Pa @SYSCONFDIR@/dhcpcd.enter-hook
and any scripts found in
.Pa @HOOKDIR@
in a lexical order and then finally
.Pa @SYSCONFDIR@/dhcpcd.exit-hook
.Sh SEE ALSO
.Xr dhcpcd 8
.Sh AUTHORS
.An Roy Marples Aq roy@marples.name
.Sh BUGS
Please report them to
.Lk http://roy.marples.name/projects/dhcpcd
.Sh SECURITY CONSIDERATIONS
Little validation of DHCP options is done in dhcpcd itself.
Instead, it is up to the hooks to handle any validation needed.
To this end, some helper functions are provided, such as valid_domainname as
used by the
.Pa 20-resolv.conf
hook to ensure that the hostname is not set to an invalid value.
valid_path is also provided, but is currently unused by a stock hook script.