147c08596SBrooks Davis#!/bin/sh 247c08596SBrooks Davis# 347c08596SBrooks Davis# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ 48750adafSBrooks Davis# $FreeBSD$ 547c08596SBrooks Davis# 647c08596SBrooks Davis# Copyright (c) 2003 Kenneth R Westerback <[email protected]> 747c08596SBrooks Davis# 847c08596SBrooks Davis# Permission to use, copy, modify, and distribute this software for any 947c08596SBrooks Davis# purpose with or without fee is hereby granted, provided that the above 1047c08596SBrooks Davis# copyright notice and this permission notice appear in all copies. 1147c08596SBrooks Davis# 1247c08596SBrooks Davis# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1347c08596SBrooks Davis# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1447c08596SBrooks Davis# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1547c08596SBrooks Davis# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1647c08596SBrooks Davis# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1747c08596SBrooks Davis# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1847c08596SBrooks Davis# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1947c08596SBrooks Davis# 2047c08596SBrooks Davis# 2147c08596SBrooks Davis 22b1f35e43SBrooks DavisARP=/usr/sbin/arp 238750adafSBrooks DavisHOSTNAME=/bin/hostname 2460932bc9SAndrew ThompsonIFCONFIG='/sbin/ifconfig -n' 258750adafSBrooks Davis 268750adafSBrooks DavisLOCALHOST=127.0.0.1 278750adafSBrooks Davis 288750adafSBrooks Davisif [ -x /usr/bin/logger ]; then 298750adafSBrooks Davis LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" 308750adafSBrooks Daviselse 318750adafSBrooks Davis LOGGER=echo 328750adafSBrooks Davisfi 338750adafSBrooks Davis 3447c08596SBrooks Davis# 3547c08596SBrooks Davis# Helper functions that implement common actions. 3647c08596SBrooks Davis# 3747c08596SBrooks Davis 388750adafSBrooks Davischeck_hostname() { 398750adafSBrooks Davis current_hostname=`$HOSTNAME` 408750adafSBrooks Davis if [ -z "$current_hostname" ]; then 418750adafSBrooks Davis $LOGGER "New Hostname ($interface): $new_host_name" 428750adafSBrooks Davis $HOSTNAME $new_host_name 438750adafSBrooks Davis elif [ "$current_hostname" = "$old_host_name" -a \ 448750adafSBrooks Davis "$new_host_name" != "$old_host_name" ]; then 458750adafSBrooks Davis $LOGGER "New Hostname ($interface): $new_host_name" 468750adafSBrooks Davis $HOSTNAME $new_host_name 4747c08596SBrooks Davis fi 4847c08596SBrooks Davis} 4947c08596SBrooks Davis 508750adafSBrooks Davisarp_flush() { 518750adafSBrooks Davis arp -an -i $interface | \ 528750adafSBrooks Davis sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ 538750adafSBrooks Davis sh >/dev/null 2>&1 548750adafSBrooks Davis} 558750adafSBrooks Davis 568750adafSBrooks Davisdelete_old_address() { 5760932bc9SAndrew Thompson eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" 588750adafSBrooks Davis} 598750adafSBrooks Davis 6047c08596SBrooks Davisadd_new_address() { 6160932bc9SAndrew Thompson eval "$IFCONFIG $interface \ 6247c08596SBrooks Davis inet $new_ip_address \ 6347c08596SBrooks Davis netmask $new_subnet_mask \ 6447c08596SBrooks Davis broadcast $new_broadcast_address \ 65001f040aSBrooks Davis $medium" 6647c08596SBrooks Davis 678750adafSBrooks Davis $LOGGER "New IP Address ($interface): $new_ip_address" 688750adafSBrooks Davis $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" 698750adafSBrooks Davis $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" 708750adafSBrooks Davis $LOGGER "New Routers ($interface): $new_routers" 7147c08596SBrooks Davis} 7247c08596SBrooks Davis 7347c08596SBrooks Davisdelete_old_alias() { 7447c08596SBrooks Davis if [ -n "$alias_ip_address" ]; then 7560932bc9SAndrew Thompson $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 767e82455eSBrooks Davis #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 7747c08596SBrooks Davis fi 7847c08596SBrooks Davis} 7947c08596SBrooks Davis 8047c08596SBrooks Davisadd_new_alias() { 8147c08596SBrooks Davis if [ -n "$alias_ip_address" ]; then 8260932bc9SAndrew Thompson $IFCONFIG $interface inet alias $alias_ip_address netmask \ 8347c08596SBrooks Davis $alias_subnet_mask 847e82455eSBrooks Davis #route add $alias_ip_address $LOCALHOST 8547c08596SBrooks Davis fi 8647c08596SBrooks Davis} 8747c08596SBrooks Davis 882fcc7370SEd Mastefill_classless_routes() { 892fcc7370SEd Maste set $1 909f0d81baSEd Maste while [ $# -ge 5 ]; do 912fcc7370SEd Maste if [ $1 -eq 0 ]; then 922fcc7370SEd Maste route="default" 932fcc7370SEd Maste elif [ $1 -le 8 ]; then 942fcc7370SEd Maste route="$2.0.0.0/$1" 952fcc7370SEd Maste shift 962fcc7370SEd Maste elif [ $1 -le 16 ]; then 972fcc7370SEd Maste route="$2.$3.0.0/$1" 982fcc7370SEd Maste shift; shift 992fcc7370SEd Maste elif [ $1 -le 24 ]; then 1002fcc7370SEd Maste route="$2.$3.$4.0/$1" 1012fcc7370SEd Maste shift; shift; shift 1022fcc7370SEd Maste else 1032fcc7370SEd Maste route="$2.$3.$4.$5/$1" 1042fcc7370SEd Maste shift; shift; shift; shift 1052fcc7370SEd Maste fi 1062fcc7370SEd Maste shift 1072fcc7370SEd Maste router="$1.$2.$3.$4" 1082fcc7370SEd Maste classless_routes="$classless_routes $route $router" 1092fcc7370SEd Maste shift; shift; shift; shift 1102fcc7370SEd Maste done 1112fcc7370SEd Maste} 1122fcc7370SEd Maste 11347c08596SBrooks Davisdelete_old_routes() { 1147e82455eSBrooks Davis #route delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 1152fcc7370SEd Maste if [ -n "$old_classless_routes" ]; then 1162fcc7370SEd Maste fill_classless_routes "$old_classless_routes" 1172fcc7370SEd Maste set $classless_routes 1182fcc7370SEd Maste while [ $# -gt 1 ]; do 1192fcc7370SEd Maste route delete "$1" "$2" 1202fcc7370SEd Maste shift; shift 1212fcc7370SEd Maste done 1222fcc7370SEd Maste return 0; 1232fcc7370SEd Maste fi 1242fcc7370SEd Maste 125d5354256SBrooks Davis # If we supported multiple default routes, we'd be removing each 126d5354256SBrooks Davis # one here. We don't so just delete the default route if it's 127d5354256SBrooks Davis # through our interface. 128d5354256SBrooks Davis if is_default_interface; then 129d5354256SBrooks Davis route delete default >/dev/null 2>&1 1308750adafSBrooks Davis fi 13147c08596SBrooks Davis 13247c08596SBrooks Davis if [ -n "$old_static_routes" ]; then 13347c08596SBrooks Davis set $old_static_routes 13447c08596SBrooks Davis while [ $# -gt 1 ]; do 13547c08596SBrooks Davis route delete "$1" "$2" 13647c08596SBrooks Davis shift; shift 13747c08596SBrooks Davis done 13847c08596SBrooks Davis fi 13947c08596SBrooks Davis 1408750adafSBrooks Davis arp_flush 14147c08596SBrooks Davis} 14247c08596SBrooks Davis 14347c08596SBrooks Davisadd_new_routes() { 1447e82455eSBrooks Davis #route add $new_ip_address $LOCALHOST >/dev/null 2>&1 1452fcc7370SEd Maste 1462fcc7370SEd Maste # RFC 3442: If the DHCP server returns both a Classless Static 1472fcc7370SEd Maste # Routes option and a Router option, the DHCP client MUST ignore 1482fcc7370SEd Maste # the Router option. 1492fcc7370SEd Maste # 1502fcc7370SEd Maste # DHCP clients that support this option (Classless Static Routes) 1512fcc7370SEd Maste # MUST NOT install the routes specified in the Static Routes 1522fcc7370SEd Maste # option (option code 33) if both a Static Routes option and the 1532fcc7370SEd Maste # Classless Static Routes option are provided. 1542fcc7370SEd Maste 1552fcc7370SEd Maste if [ -n "$new_classless_routes" ]; then 1562fcc7370SEd Maste fill_classless_routes "$new_classless_routes" 1572fcc7370SEd Maste $LOGGER "New Classless Static Routes ($interface): $classless_routes" 1582fcc7370SEd Maste set $classless_routes 1592fcc7370SEd Maste while [ $# -gt 1 ]; do 1602fcc7370SEd Maste if [ "0.0.0.0" = "$2" ]; then 1612fcc7370SEd Maste route add "$1" -iface "$interface" 1622fcc7370SEd Maste else 1632fcc7370SEd Maste route add "$1" "$2" 1642fcc7370SEd Maste fi 1652fcc7370SEd Maste shift; shift 1662fcc7370SEd Maste done 1672fcc7370SEd Maste return 1682fcc7370SEd Maste fi 1692fcc7370SEd Maste 17047c08596SBrooks Davis for router in $new_routers; do 171d5354256SBrooks Davis if is_default_interface; then 172d5354256SBrooks Davis 17347c08596SBrooks Davis if [ "$new_ip_address" = "$router" ]; then 17447c08596SBrooks Davis route add default -iface $router >/dev/null 2>&1 17547c08596SBrooks Davis else 17647c08596SBrooks Davis route add default $router >/dev/null 2>&1 17747c08596SBrooks Davis fi 178d5354256SBrooks Davis fi 17947c08596SBrooks Davis # 2nd and subsequent default routers error out, so explicitly 18047c08596SBrooks Davis # stop processing the list after the first one. 18147c08596SBrooks Davis break 18247c08596SBrooks Davis done 18347c08596SBrooks Davis 18447c08596SBrooks Davis if [ -n "$new_static_routes" ]; then 1858750adafSBrooks Davis $LOGGER "New Static Routes ($interface): $new_static_routes" 18647c08596SBrooks Davis set $new_static_routes 18747c08596SBrooks Davis while [ $# -gt 1 ]; do 18847c08596SBrooks Davis route add $1 $2 18947c08596SBrooks Davis shift; shift 19047c08596SBrooks Davis done 19147c08596SBrooks Davis fi 19247c08596SBrooks Davis} 19347c08596SBrooks Davis 19447c08596SBrooks Davisadd_new_resolv_conf() { 19547c08596SBrooks Davis # XXX Old code did not create/update resolv.conf unless both 19647c08596SBrooks Davis # $new_domain_name and $new_domain_name_servers were provided. PR 19747c08596SBrooks Davis # #3135 reported some ISP's only provide $new_domain_name_servers and 19847c08596SBrooks Davis # thus broke the script. This code creates the resolv.conf if either 19947c08596SBrooks Davis # are provided. 20047c08596SBrooks Davis 201f1bacaa5SBrooks Davis local tmpres=/var/run/resolv.conf.${interface} 20290158aeeSWes Peters rm -f $tmpres 20347c08596SBrooks Davis 204409139f0SJean-Sébastien Pédron if [ -n "$new_domain_search" ]; then 205409139f0SJean-Sébastien Pédron echo "search $new_domain_search" >>$tmpres 206409139f0SJean-Sébastien Pédron elif [ -n "$new_domain_name" ]; then 20790158aeeSWes Peters echo "search $new_domain_name" >>$tmpres 20847c08596SBrooks Davis fi 20947c08596SBrooks Davis 21047c08596SBrooks Davis if [ -n "$new_domain_name_servers" ]; then 21147c08596SBrooks Davis for nameserver in $new_domain_name_servers; do 21290158aeeSWes Peters echo "nameserver $nameserver" >>$tmpres 21347c08596SBrooks Davis done 21447c08596SBrooks Davis fi 21547c08596SBrooks Davis 21690158aeeSWes Peters if [ -f $tmpres ]; then 21747c08596SBrooks Davis if [ -f /etc/resolv.conf.tail ]; then 21890158aeeSWes Peters cat /etc/resolv.conf.tail >>$tmpres 21947c08596SBrooks Davis fi 22047c08596SBrooks Davis 2219201145dSHajimu UMEMOTO case $resolvconf_enable in 2229201145dSHajimu UMEMOTO # "no", "false", "off", or "0" 2239201145dSHajimu UMEMOTO [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 224dd415a50SBrooks Davis # When resolv.conf is not changed actually, we don't 225dd415a50SBrooks Davis # need to update it. 226dd415a50SBrooks Davis # If /usr is not mounted yet, we cannot use cmp, then 227dd415a50SBrooks Davis # the following test fails. In such case, we simply 228dd415a50SBrooks Davis # ignore an error and do update resolv.conf. 22990158aeeSWes Peters if cmp -s $tmpres /etc/resolv.conf; then 23090158aeeSWes Peters rm -f $tmpres 231dd415a50SBrooks Davis return 0 232dd415a50SBrooks Davis fi 2>/dev/null 233dd415a50SBrooks Davis 2349201145dSHajimu UMEMOTO # In case (e.g. during OpenBSD installs) 2359201145dSHajimu UMEMOTO # /etc/resolv.conf is a symbolic link, take 2369201145dSHajimu UMEMOTO # care to preserve the link and write the new 2379201145dSHajimu UMEMOTO # data in the correct location. 23847c08596SBrooks Davis 23947c08596SBrooks Davis if [ -f /etc/resolv.conf ]; then 24047c08596SBrooks Davis cat /etc/resolv.conf > /etc/resolv.conf.save 24147c08596SBrooks Davis fi 24290158aeeSWes Peters cat $tmpres > /etc/resolv.conf 24347c08596SBrooks Davis 24447c08596SBrooks Davis # Try to ensure correct ownership and permissions. 24547c08596SBrooks Davis chown -RL root:wheel /etc/resolv.conf 24647c08596SBrooks Davis chmod -RL 644 /etc/resolv.conf 2479201145dSHajimu UMEMOTO ;; 2489201145dSHajimu UMEMOTO 2499201145dSHajimu UMEMOTO *) 2509201145dSHajimu UMEMOTO /sbin/resolvconf -a ${interface} < $tmpres 2519201145dSHajimu UMEMOTO ;; 2529201145dSHajimu UMEMOTO esac 2539201145dSHajimu UMEMOTO 2549201145dSHajimu UMEMOTO rm -f $tmpres 25547c08596SBrooks Davis 25647c08596SBrooks Davis return 0 25747c08596SBrooks Davis fi 25847c08596SBrooks Davis 25947c08596SBrooks Davis return 1 26047c08596SBrooks Davis} 26147c08596SBrooks Davis 262d6790d5aSBrooks Davis# Must be used on exit. Invokes the local dhcp client exit hooks, if any. 263d6790d5aSBrooks Davisexit_with_hooks() { 264d6790d5aSBrooks Davis exit_status=$1 265d6790d5aSBrooks Davis if [ -f /etc/dhclient-exit-hooks ]; then 266d6790d5aSBrooks Davis . /etc/dhclient-exit-hooks 267d6790d5aSBrooks Davis fi 268d6790d5aSBrooks Davis # probably should do something with exit status of the local script 269d6790d5aSBrooks Davis exit $exit_status 270d6790d5aSBrooks Davis} 271d6790d5aSBrooks Davis 272d5354256SBrooks Davis# Get the interface with the current ipv4 default route on it using only 273d5354256SBrooks Davis# commands that are available prior to /usr being mounted. 274d5354256SBrooks Davisis_default_interface() 275d5354256SBrooks Davis{ 2769761cdd8SBrooks Davis routeget="`route -n get -inet default`" 277d5354256SBrooks Davis oldifs="$IFS" 278d5354256SBrooks Davis IFS=" 279d5354256SBrooks Davis" 280d5354256SBrooks Davis defif= 281d5354256SBrooks Davis for line in $routeget ; do 282d5354256SBrooks Davis case $line in 283d5354256SBrooks Davis *interface:*) 284d5354256SBrooks Davis defif=${line##*: } 285d5354256SBrooks Davis ;; 286d5354256SBrooks Davis esac 287d5354256SBrooks Davis done 288d5354256SBrooks Davis IFS=${oldifs} 289d5354256SBrooks Davis 290d5354256SBrooks Davis if [ -z "$defif" -o "$defif" = "$interface" ]; then 291d5354256SBrooks Davis return 0 292d5354256SBrooks Davis else 293d5354256SBrooks Davis return 1 294d5354256SBrooks Davis fi 295d5354256SBrooks Davis} 296d5354256SBrooks Davis 29747c08596SBrooks Davis# 29847c08596SBrooks Davis# Start of active code. 29947c08596SBrooks Davis# 30047c08596SBrooks Davis 301d5fedb6eSBrooks Davis# Invoke the local dhcp client enter hooks, if they exist. 302d5fedb6eSBrooks Davisif [ -f /etc/dhclient-enter-hooks ]; then 303d5fedb6eSBrooks Davis exit_status=0 304d5fedb6eSBrooks Davis . /etc/dhclient-enter-hooks 305d5fedb6eSBrooks Davis # allow the local script to abort processing of this state 306d5fedb6eSBrooks Davis # local script must set exit_status variable to nonzero. 307d5fedb6eSBrooks Davis if [ $exit_status -ne 0 ]; then 308d5fedb6eSBrooks Davis exit $exit_status 309d5fedb6eSBrooks Davis fi 310d5fedb6eSBrooks Davisfi 311d5fedb6eSBrooks Davis 3129201145dSHajimu UMEMOTO: ${resolvconf_enable="YES"} 3139201145dSHajimu UMEMOTO 31447c08596SBrooks Daviscase $reason in 31547c08596SBrooks DavisMEDIUM) 31660932bc9SAndrew Thompson eval "$IFCONFIG $interface $medium" 31760932bc9SAndrew Thompson eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 31847c08596SBrooks Davis sleep 1 31947c08596SBrooks Davis ;; 32047c08596SBrooks Davis 32147c08596SBrooks DavisPREINIT) 32247c08596SBrooks Davis delete_old_alias 323*1c6eeddaSGleb Smirnoff $IFCONFIG $interface inet alias 0.0.0.0 netmask 255.0.0.0 broadcast 255.255.255.255 up 32447c08596SBrooks Davis ;; 32547c08596SBrooks Davis 32647c08596SBrooks DavisARPCHECK|ARPSEND) 32747c08596SBrooks Davis ;; 32847c08596SBrooks Davis 32947c08596SBrooks DavisBOUND|RENEW|REBIND|REBOOT) 3308750adafSBrooks Davis check_hostname 33147c08596SBrooks Davis if [ -n "$old_ip_address" ]; then 33247c08596SBrooks Davis if [ "$old_ip_address" != "$alias_ip_address" ]; then 33347c08596SBrooks Davis delete_old_alias 33447c08596SBrooks Davis fi 33547c08596SBrooks Davis if [ "$old_ip_address" != "$new_ip_address" ]; then 33647c08596SBrooks Davis delete_old_address 33747c08596SBrooks Davis delete_old_routes 33847c08596SBrooks Davis fi 33947c08596SBrooks Davis fi 34047c08596SBrooks Davis if [ "$reason" = BOUND ] || \ 34147c08596SBrooks Davis [ "$reason" = REBOOT ] || \ 34247c08596SBrooks Davis [ -z "$old_ip_address" ] || \ 34347c08596SBrooks Davis [ "$old_ip_address" != "$new_ip_address" ]; then 34447c08596SBrooks Davis add_new_address 34547c08596SBrooks Davis add_new_routes 34647c08596SBrooks Davis fi 34747c08596SBrooks Davis if [ "$new_ip_address" != "$alias_ip_address" ]; then 34847c08596SBrooks Davis add_new_alias 34947c08596SBrooks Davis fi 350d5354256SBrooks Davis if is_default_interface; then 35147c08596SBrooks Davis add_new_resolv_conf 352d5354256SBrooks Davis fi 35347c08596SBrooks Davis ;; 35447c08596SBrooks Davis 35547c08596SBrooks DavisEXPIRE|FAIL) 35647c08596SBrooks Davis delete_old_alias 35747c08596SBrooks Davis if [ -n "$old_ip_address" ]; then 35847c08596SBrooks Davis delete_old_address 35947c08596SBrooks Davis delete_old_routes 36047c08596SBrooks Davis fi 361b1f35e43SBrooks Davis if [ -x $ARP ]; then 362b1f35e43SBrooks Davis $ARP -d -a -i $interface 363b1f35e43SBrooks Davis fi 36447c08596SBrooks Davis # XXX Why add alias we just deleted above? 36547c08596SBrooks Davis add_new_alias 366d5354256SBrooks Davis if is_default_interface; then 3679201145dSHajimu UMEMOTO case $resolvconf_enable in 3689201145dSHajimu UMEMOTO # "no", "false", "off", or "0" 3699201145dSHajimu UMEMOTO [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 37047c08596SBrooks Davis if [ -f /etc/resolv.conf.save ]; then 37147c08596SBrooks Davis cat /etc/resolv.conf.save > /etc/resolv.conf 37247c08596SBrooks Davis fi 3739201145dSHajimu UMEMOTO ;; 3749201145dSHajimu UMEMOTO *) 3759201145dSHajimu UMEMOTO /sbin/resolvconf -d ${interface} 3769201145dSHajimu UMEMOTO ;; 3779201145dSHajimu UMEMOTO esac 378d5354256SBrooks Davis fi 37947c08596SBrooks Davis ;; 38047c08596SBrooks Davis 38147c08596SBrooks DavisTIMEOUT) 38247c08596SBrooks Davis delete_old_alias 38347c08596SBrooks Davis add_new_address 38447c08596SBrooks Davis sleep 1 38547c08596SBrooks Davis if [ -n "$new_routers" ]; then 3868750adafSBrooks Davis $LOGGER "New Routers ($interface): $new_routers" 38747c08596SBrooks Davis set "$new_routers" 388b0864f3aSBrooks Davis if ping -q -c 1 -t 1 "$1"; then 38947c08596SBrooks Davis if [ "$new_ip_address" != "$alias_ip_address" ]; then 39047c08596SBrooks Davis add_new_alias 39147c08596SBrooks Davis fi 39247c08596SBrooks Davis add_new_routes 393d5354256SBrooks Davis if ! is_default_interface; then 394d5354256SBrooks Davis exit_with_hooks 0 395d5354256SBrooks Davis fi 39647c08596SBrooks Davis if add_new_resolv_conf; then 397d6790d5aSBrooks Davis exit_with_hooks 0 39847c08596SBrooks Davis fi 39947c08596SBrooks Davis fi 40047c08596SBrooks Davis fi 40160932bc9SAndrew Thompson eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" 40247c08596SBrooks Davis delete_old_routes 403d6790d5aSBrooks Davis exit_with_hooks 1 40447c08596SBrooks Davis ;; 40547c08596SBrooks Davisesac 40647c08596SBrooks Davis 407d6790d5aSBrooks Davisexit_with_hooks 0 408