Samuel Tan | d7ed851 | 2015-08-13 16:11:35 -0700 | [diff] [blame] | 1 | .\" Copyright (c) 2006-2015 Roy Marples |
| 2 | .\" All rights reserved |
| 3 | .\" |
| 4 | .\" Redistribution and use in source and binary forms, with or without |
| 5 | .\" modification, are permitted provided that the following conditions |
| 6 | .\" are met: |
| 7 | .\" 1. Redistributions of source code must retain the above copyright |
| 8 | .\" notice, this list of conditions and the following disclaimer. |
| 9 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 10 | .\" notice, this list of conditions and the following disclaimer in the |
| 11 | .\" documentation and/or other materials provided with the distribution. |
| 12 | .\" |
| 13 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 14 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 17 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 18 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 19 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 20 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 21 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 22 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 23 | .\" SUCH DAMAGE. |
| 24 | .\" |
| 25 | .Dd October 3, 2014 |
| 26 | .Dt DHCPCD-RUN-HOOKS 8 |
| 27 | .Os |
| 28 | .Sh NAME |
| 29 | .Nm dhcpcd-run-hooks |
| 30 | .Nd DHCP client configuration script |
| 31 | .Sh DESCRIPTION |
| 32 | .Nm |
| 33 | is used by |
| 34 | .Xr dhcpcd 8 |
| 35 | to run any system and user defined hook scripts. |
| 36 | System hook scripts are found in |
| 37 | .Pa @HOOKDIR@ |
| 38 | and the user defined hooks are |
| 39 | .Pa @SYSCONFDIR@/dhcpcd.enter-hook . |
| 40 | and |
| 41 | .Pa @SYSCONFDIR@/dhcpcd.exit-hook . |
| 42 | The default install supplies hook scripts for configuring |
| 43 | .Pa /etc/resolv.conf |
| 44 | and the hostname. |
| 45 | Your distribution may have included other hook scripts to say configure |
| 46 | ntp or ypbind. |
| 47 | A test hook is also supplied that simply echos the dhcp variables to the |
| 48 | console from DISCOVER message. |
| 49 | .Pp |
| 50 | Each time |
| 51 | .Nm |
| 52 | is invoked, |
| 53 | .Ev $interface |
| 54 | is set to the interface that |
| 55 | .Nm dhcpcd |
| 56 | is run on and |
| 57 | .Ev $reason |
| 58 | is to the reason why |
| 59 | .Nm |
| 60 | was invoked. |
| 61 | DHCP information to be configured is held in variables starting with the word |
| 62 | new_ and old DHCP information to be removed is held in variables starting with |
| 63 | the word old_. |
| 64 | .Nm dhcpcd |
| 65 | can display the full list of variables it knows how about by using the |
| 66 | .Fl V , -variables |
| 67 | argument. |
| 68 | .Pp |
| 69 | Here's a list of reasons why |
| 70 | .Nm |
| 71 | could be invoked: |
| 72 | .Bl -tag -width EXPIREXXXEXPIRE6 |
| 73 | .It Dv PREINIT |
| 74 | dhcpcd is starting up and any pre-initialisation should be done. |
| 75 | .It Dv CARRIER |
| 76 | dhcpcd has detected the carrier is up. |
| 77 | This is generally just a notification and no action need be taken. |
| 78 | .It Dv NOCARRIER |
| 79 | dhcpcd lost the carrier. |
| 80 | The cable may have been unplugged or association to the wireless point lost. |
| 81 | .It Dv INFORM | Dv INFORM6 |
| 82 | dhcpcd informed a DHCP server about it's address and obtained other |
| 83 | configuration details. |
| 84 | .It Dv BOUND | Dv BOUND6 |
| 85 | dhcpcd obtained a new lease from a DHCP server. |
| 86 | .It Dv RENEW | Dv RENEW6 |
| 87 | dhcpcd renewed it's lease. |
| 88 | .It Dv REBIND | Dv REBIND6 |
| 89 | dhcpcd has rebound to a new DHCP server. |
| 90 | .It Dv REBOOT | Dv REBOOT6 |
| 91 | dhcpcd successfully requested a lease from a DHCP server. |
| 92 | .It Dv DELEGATED6 |
| 93 | dhcpcd assigned a delegated prefix to the interface. |
| 94 | .It Dv IPV4LL |
| 95 | dhcpcd failed to contact any DHCP servers but did obtain an IPV4LL address. |
| 96 | .It Dv STATIC |
| 97 | dhcpcd has been configured with a static configuration which has not been |
| 98 | obtained from a DHCP server. |
| 99 | .It Dv 3RDPARTY |
| 100 | dhcpcd is monitoring the interface for a 3rd party to give it an IP address. |
| 101 | .It Dv TIMEOUT |
| 102 | dhcpcd failed to contact any DHCP servers but was able to use an old lease. |
| 103 | .It Dv EXPIRE | EXPIRE6 |
| 104 | dhcpcd's lease or state expired and it failed to obtain a new one. |
| 105 | .It Dv NAK |
| 106 | dhcpcd received a NAK from the DHCP server. |
| 107 | This should be treated as EXPIRE. |
| 108 | .It Dv RECONFIGURE |
| 109 | dhcpcd has been instructed to reconfigure an interface. |
| 110 | .It Dv ROUTERADVERT |
| 111 | dhcpcd has received an IPv6 Router Advertisment, or one has expired. |
| 112 | .It Dv STOP | Dv STOP6 |
| 113 | dhcpcd stopped running on the interface. |
| 114 | .It Dv STOPPED |
| 115 | dhcpcd has stopped entirely. |
| 116 | .It Dv DEPARTED |
| 117 | The interface has been removed. |
| 118 | .It Dv FAIL |
| 119 | dhcpcd failed to operate on the interface. |
| 120 | This normally happens when dhcpcd does not support the raw interface, which |
| 121 | means it cannot work as a DHCP or ZeroConf client. |
| 122 | Static configuration and DHCP INFORM is still allowed. |
| 123 | .It Dv DUMP |
| 124 | dhcpcd has been asked to dump the last lease for the interface. |
| 125 | .It Dv TEST |
| 126 | dhcpcd received an OFFER from a DHCP server but will not configure the |
| 127 | interface. |
| 128 | This is primarily used to test the variables are filled correctly for the |
| 129 | script to process them. |
| 130 | .El |
| 131 | .Sh ENVIRONMENT |
| 132 | .Nm dhcpcd |
| 133 | will clear the environment variables aside from |
| 134 | .Ev $PATH |
| 135 | and |
| 136 | .Ev $RC_SVCNAME . |
| 137 | The following variables will then be set, along with any protocol supplied |
| 138 | ones. |
| 139 | .Bl -tag -width xnew_delegated_dhcp6_prefix |
| 140 | .It Ev $interface |
| 141 | the name of the interface. |
| 142 | .It Ev $reason |
| 143 | as described above. |
| 144 | .It Ev $pid |
| 145 | the pid of |
| 146 | .Nm dhcpcd . |
| 147 | .It Ev $ifcarrier |
| 148 | the link status of |
| 149 | .Ev $interface : |
| 150 | .Dv unknown , |
| 151 | .Dv up |
| 152 | or |
| 153 | .Dv down . |
| 154 | .It Ev $ifmetric |
| 155 | .Ev $interface |
| 156 | preference, lower is better. |
| 157 | .It Ev $ifwireless |
| 158 | .Dv 1 if |
| 159 | .Ev $interface |
| 160 | is wireless, otherwise |
| 161 | .Dv 0 . |
| 162 | .It Ev $ifflags |
| 163 | .Ev $interface |
| 164 | flags. |
| 165 | .It Ev $ifmtu |
| 166 | .Ev $interface |
| 167 | MTU. |
| 168 | .It Ev $ifssid |
| 169 | the name of the SSID the |
| 170 | .Ev interface |
| 171 | is connected to. |
| 172 | .It Ev $interface_order |
| 173 | A list of interfaces, in order of preference. |
| 174 | .It Ev $if_up |
| 175 | .Dv true |
| 176 | if the |
| 177 | .Ev interface |
| 178 | is up, otherwise |
| 179 | .Dv false . |
| 180 | .It Ev $if_down |
| 181 | .Dv true |
| 182 | if the |
| 183 | .Ev interface |
| 184 | is down, otherwise |
| 185 | .Dv false . |
| 186 | .It Ev $if_oneup |
| 187 | .Dv true |
| 188 | if any interface is up, otherwise false. |
| 189 | .It Ev $if_ipwaited |
| 190 | .Dv true |
| 191 | if any interface has been assigned an IP address which matches any wait |
| 192 | requirements specified in |
| 193 | .Xr dhcpcd.conf 5 . |
| 194 | .It Ev $profile |
| 195 | the name of the profile selected from |
| 196 | .Xr dhcpcd.conf 5 . |
| 197 | .It Ev $new_delegated_dhcp6_prefix |
| 198 | space separated list of delegated prefixes. |
| 199 | .El |
| 200 | .Sh FILES |
| 201 | When |
| 202 | .Nm |
| 203 | runs, it loads |
| 204 | .Pa @SYSCONFDIR@/dhcpcd.enter-hook |
| 205 | and any scripts found in |
| 206 | .Pa @HOOKDIR@ |
| 207 | in a lexical order and then finally |
| 208 | .Pa @SYSCONFDIR@/dhcpcd.exit-hook |
| 209 | .Sh SEE ALSO |
| 210 | .Xr dhcpcd 8 |
| 211 | .Sh AUTHORS |
| 212 | .An Roy Marples Aq Mt roy@marples.name |
| 213 | .Sh BUGS |
| 214 | Please report them to |
| 215 | .Lk http://roy.marples.name/projects/dhcpcd |
| 216 | .Sh SECURITY CONSIDERATIONS |
| 217 | .Nm dhcpcd |
| 218 | will validate the content of each option against its encoding. |
| 219 | For string, ascii, raw or binhex encoding it's up to the user to validate it |
| 220 | for the intended purpose. |
| 221 | .Pp |
| 222 | When used in a shell script, each variable must be quoted correctly. |