1DHCPCD-RUN-HOOKS(8)       BSD System Manager's Manual      DHCPCD-RUN-HOOKS(8)
2

NAME

4     dhcpcd-run-hooks — DHCP client configuration script
5

DESCRIPTION

7     dhcpcd-run-hooks is used by dhcpcd(8) to run any system and user defined
8     hook scripts.  System hook scripts are found in /usr/libexec/dhcpcd-hooks
9     and the user defined hooks are /etc/dhcpcd.enter-hook.  and
10     /etc/dhcpcd.exit-hook.  The default install supplies hook scripts for
11     configuring /etc/resolv.conf and the hostname.  Your distribution may
12     have included other hook scripts to say configure ntp or ypbind.  A test
13     hook is also supplied that simply echos the dhcp variables to the console
14     from DISCOVER message.
15
16     Each time dhcpcd-run-hooks is invoked, $interface is set to the interface
17     that dhcpcd is run on and $reason is to the reason why dhcpcd-run-hooks
18     was invoked.  DHCP information to be configured is held in variables
19     starting with the word new_ and old DHCP information to be removed is
20     held in variables starting with the word old_.  dhcpcd can display the
21     full list of variables it knows how about by using the -V, --variables
22     argument.
23
24     Here's a list of reasons why dhcpcd-run-hooks could be invoked:
25
26     PREINIT           dhcpcd is starting up and any pre-initialisation should
27                       be done.
28
29     CARRIER           dhcpcd has detected the carrier is up.  This is gener‐
30                       ally just a notification and no action need be taken.
31
32     NOCARRIER         dhcpcd lost the carrier.  The cable may have been
33                       unplugged or association to the wireless point lost.
34
35     INFORM | INFORM6  dhcpcd informed a DHCP server about it's address and
36                       obtained other configuration details.
37
38     BOUND | BOUND6    dhcpcd obtained a new lease from a DHCP server.
39
40     RENEW | RENEW6    dhcpcd renewed it's lease.
41
42     REBIND | REBIND6  dhcpcd has rebound to a new DHCP server.
43
44     REBOOT | REBOOT6  dhcpcd successfully requested a lease from a DHCP
45                       server.
46
47     DELEGATED6        dhcpcd assigned a delegated prefix to the interface.
48
49     IPV4LL            dhcpcd obtaind an IPV4LL address, or one was removed.
50
51     STATIC            dhcpcd has been configured with a static configuration
52                       which has not been obtained from a DHCP server.
53
54     3RDPARTY          dhcpcd is monitoring the interface for a 3rd party to
55                       give it an IP address.
56
57     TIMEOUT           dhcpcd failed to contact any DHCP servers but was able
58                       to use an old lease.
59
60     EXPIRE | EXPIRE6  dhcpcd's lease or state expired and it failed to obtain
61                       a new one.
62
63     NAK               dhcpcd received a NAK from the DHCP server.  This
64                       should be treated as EXPIRE.
65
66     RECONFIGURE       dhcpcd has been instructed to reconfigure an interface.
67
68     ROUTERADVERT      dhcpcd has received an IPv6 Router Advertisement, or
69                       one has expired.
70
71     STOP | STOP6      dhcpcd stopped running on the interface.
72
73     STOPPED           dhcpcd has stopped entirely.
74
75     DEPARTED          The interface has been removed.
76
77     FAIL              dhcpcd failed to operate on the interface.  This nor‐
78                       mally happens when dhcpcd does not support the raw
79                       interface, which means it cannot work as a DHCP or
80                       ZeroConf client.  Static configuration and DHCP INFORM
81                       is still allowed.
82
83     DUMP              dhcpcd has been asked to dump the last lease for the
84                       interface.
85
86     TEST              dhcpcd received an OFFER from a DHCP server but will
87                       not configure the interface.  This is primarily used to
88                       test the variables are filled correctly for the script
89                       to process them.
90

ENVIRONMENT

92     dhcpcd will clear the environment variables aside from $PATH and
93     $RC_SVCNAME.  The following variables will then be set, along with any
94     protocol supplied ones.
95
96     $interface                   the name of the interface.
97
98     $reason                      as described above.
99
100     $pid                         the pid of dhcpcd.
101
102     $ifcarrier                   the link status of $interface: unknown, up
103                                  or down.
104
105     $ifmetric                    $interface preference, lower is better.
106
107     $ifwireless                  1 if $interface is wireless, otherwise 0.
108
109     $ifflags                     $interface flags.
110
111     $ifmtu                       $interface MTU.
112
113     $ifssid                      the name of the SSID the interface is con‐
114                                  nected to.
115
116     $interface_order             A list of interfaces, in order of prefer‐
117                                  ence.
118
119     $if_up                       true if the interface is up, otherwise
120                                  false.
121
122     $if_down                     true if the interface is down, otherwise
123                                  false.
124
125     $af_waiting                  Address family waiting for, as defined in
126                                  dhcpcd.conf(5).
127
128     $profile                     the name of the profile selected from
129                                  dhcpcd.conf(5).
130
131     $new_delegated_dhcp6_prefix  space separated list of delegated prefixes.
132

FILES

134     When dhcpcd-run-hooks runs, it loads /etc/dhcpcd.enter-hook and any
135     scripts found in /usr/libexec/dhcpcd-hooks in a lexical order and then
136     finally /etc/dhcpcd.exit-hook
137

SEE ALSO

139     dhcpcd(8)
140

AUTHORS

142     Roy Marples <roy@marples.name>
143

BUGS

145     Please report them to
146           http://roy.marples.name/projects/dhcpcd
147

SECURITY CONSIDERATIONS

149     dhcpcd will validate the content of each option against its encoding.
150     For string, ascii, raw or binhex encoding it's up to the user to validate
151     it for the intended purpose.
152
153     When used in a shell script, each variable must be quoted correctly.
154
155BSD                              June 27, 2016                             BSD
Impressum