147c08596SBrooks Davis#!/bin/sh 247c08596SBrooks Davis# 347c08596SBrooks Davis# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ 447c08596SBrooks Davis# 547c08596SBrooks Davis# Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org> 647c08596SBrooks Davis# 747c08596SBrooks Davis# Permission to use, copy, modify, and distribute this software for any 847c08596SBrooks Davis# purpose with or without fee is hereby granted, provided that the above 947c08596SBrooks Davis# copyright notice and this permission notice appear in all copies. 1047c08596SBrooks Davis# 1147c08596SBrooks Davis# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1247c08596SBrooks Davis# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1347c08596SBrooks Davis# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1447c08596SBrooks Davis# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1547c08596SBrooks Davis# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1647c08596SBrooks Davis# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1747c08596SBrooks Davis# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1847c08596SBrooks Davis# 1947c08596SBrooks Davis# 2047c08596SBrooks Davis 21b1f35e43SBrooks DavisARP=/usr/sbin/arp 228750adafSBrooks DavisHOSTNAME=/bin/hostname 2360932bc9SAndrew ThompsonIFCONFIG='/sbin/ifconfig -n' 248750adafSBrooks Davis 258750adafSBrooks DavisLOCALHOST=127.0.0.1 268750adafSBrooks Davis 278750adafSBrooks Davisif [ -x /usr/bin/logger ]; then 288750adafSBrooks Davis LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" 298750adafSBrooks Daviselse 308750adafSBrooks Davis LOGGER=echo 318750adafSBrooks Davisfi 328750adafSBrooks Davis 3347c08596SBrooks Davis# 3447c08596SBrooks Davis# Helper functions that implement common actions. 3547c08596SBrooks Davis# 3647c08596SBrooks Davis 378750adafSBrooks Davischeck_hostname() { 388750adafSBrooks Davis current_hostname=`$HOSTNAME` 398750adafSBrooks Davis if [ -z "$current_hostname" ]; then 408750adafSBrooks Davis $LOGGER "New Hostname ($interface): $new_host_name" 418750adafSBrooks Davis $HOSTNAME $new_host_name 428750adafSBrooks Davis elif [ "$current_hostname" = "$old_host_name" -a \ 438750adafSBrooks Davis "$new_host_name" != "$old_host_name" ]; then 448750adafSBrooks Davis $LOGGER "New Hostname ($interface): $new_host_name" 458750adafSBrooks Davis $HOSTNAME $new_host_name 4647c08596SBrooks Davis fi 4747c08596SBrooks Davis} 4847c08596SBrooks Davis 498750adafSBrooks Davisarp_flush() { 508750adafSBrooks Davis arp -an -i $interface | \ 518750adafSBrooks Davis sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ 528750adafSBrooks Davis sh >/dev/null 2>&1 538750adafSBrooks Davis} 548750adafSBrooks Davis 558750adafSBrooks Davisdelete_old_address() { 5660932bc9SAndrew Thompson eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" 578750adafSBrooks Davis} 588750adafSBrooks Davis 5947c08596SBrooks Davisadd_new_address() { 6060932bc9SAndrew Thompson eval "$IFCONFIG $interface \ 6147c08596SBrooks Davis inet $new_ip_address \ 6247c08596SBrooks Davis netmask $new_subnet_mask \ 6347c08596SBrooks Davis broadcast $new_broadcast_address \ 64001f040aSBrooks Davis $medium" 6547c08596SBrooks Davis 668750adafSBrooks Davis $LOGGER "New IP Address ($interface): $new_ip_address" 678750adafSBrooks Davis $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" 688750adafSBrooks Davis $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" 698750adafSBrooks Davis $LOGGER "New Routers ($interface): $new_routers" 7047c08596SBrooks Davis} 7147c08596SBrooks Davis 7247c08596SBrooks Davisdelete_old_alias() { 7347c08596SBrooks Davis if [ -n "$alias_ip_address" ]; then 7460932bc9SAndrew Thompson $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 757e82455eSBrooks Davis #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 7647c08596SBrooks Davis fi 7747c08596SBrooks Davis} 7847c08596SBrooks Davis 7947c08596SBrooks Davisadd_new_alias() { 8047c08596SBrooks Davis if [ -n "$alias_ip_address" ]; then 8160932bc9SAndrew Thompson $IFCONFIG $interface inet alias $alias_ip_address netmask \ 8247c08596SBrooks Davis $alias_subnet_mask 837e82455eSBrooks Davis #route add $alias_ip_address $LOCALHOST 8447c08596SBrooks Davis fi 8547c08596SBrooks Davis} 8647c08596SBrooks Davis 872fcc7370SEd Mastefill_classless_routes() { 882fcc7370SEd Maste set $1 899f0d81baSEd Maste while [ $# -ge 5 ]; do 902fcc7370SEd Maste if [ $1 -eq 0 ]; then 912fcc7370SEd Maste route="default" 922fcc7370SEd Maste elif [ $1 -le 8 ]; then 932fcc7370SEd Maste route="$2.0.0.0/$1" 942fcc7370SEd Maste shift 952fcc7370SEd Maste elif [ $1 -le 16 ]; then 962fcc7370SEd Maste route="$2.$3.0.0/$1" 972fcc7370SEd Maste shift; shift 982fcc7370SEd Maste elif [ $1 -le 24 ]; then 992fcc7370SEd Maste route="$2.$3.$4.0/$1" 1002fcc7370SEd Maste shift; shift; shift 1012fcc7370SEd Maste else 1022fcc7370SEd Maste route="$2.$3.$4.$5/$1" 1032fcc7370SEd Maste shift; shift; shift; shift 1042fcc7370SEd Maste fi 1052fcc7370SEd Maste shift 1062fcc7370SEd Maste router="$1.$2.$3.$4" 1072fcc7370SEd Maste classless_routes="$classless_routes $route $router" 1082fcc7370SEd Maste shift; shift; shift; shift 1092fcc7370SEd Maste done 1102fcc7370SEd Maste} 1112fcc7370SEd Maste 11247c08596SBrooks Davisdelete_old_routes() { 1137e82455eSBrooks Davis #route delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 1142fcc7370SEd Maste if [ -n "$old_classless_routes" ]; then 1152fcc7370SEd Maste fill_classless_routes "$old_classless_routes" 1162fcc7370SEd Maste set $classless_routes 1172fcc7370SEd Maste while [ $# -gt 1 ]; do 1182fcc7370SEd Maste route delete "$1" "$2" 1192fcc7370SEd Maste shift; shift 1202fcc7370SEd Maste done 1212fcc7370SEd Maste return 0; 1222fcc7370SEd Maste fi 1232fcc7370SEd Maste 124d5354256SBrooks Davis # If we supported multiple default routes, we'd be removing each 125d5354256SBrooks Davis # one here. We don't so just delete the default route if it's 126d5354256SBrooks Davis # through our interface. 127d5354256SBrooks Davis if is_default_interface; then 128d5354256SBrooks Davis route delete default >/dev/null 2>&1 1298750adafSBrooks Davis fi 13047c08596SBrooks Davis 13147c08596SBrooks Davis if [ -n "$old_static_routes" ]; then 13247c08596SBrooks Davis set $old_static_routes 13347c08596SBrooks Davis while [ $# -gt 1 ]; do 13447c08596SBrooks Davis route delete "$1" "$2" 13547c08596SBrooks Davis shift; shift 13647c08596SBrooks Davis done 13747c08596SBrooks Davis fi 13847c08596SBrooks Davis 1398750adafSBrooks Davis arp_flush 14047c08596SBrooks Davis} 14147c08596SBrooks Davis 14247c08596SBrooks Davisadd_new_routes() { 1437e82455eSBrooks Davis #route add $new_ip_address $LOCALHOST >/dev/null 2>&1 1442fcc7370SEd Maste 1452fcc7370SEd Maste # RFC 3442: If the DHCP server returns both a Classless Static 1462fcc7370SEd Maste # Routes option and a Router option, the DHCP client MUST ignore 1472fcc7370SEd Maste # the Router option. 1482fcc7370SEd Maste # 1492fcc7370SEd Maste # DHCP clients that support this option (Classless Static Routes) 1502fcc7370SEd Maste # MUST NOT install the routes specified in the Static Routes 1512fcc7370SEd Maste # option (option code 33) if both a Static Routes option and the 1522fcc7370SEd Maste # Classless Static Routes option are provided. 1532fcc7370SEd Maste 1542fcc7370SEd Maste if [ -n "$new_classless_routes" ]; then 1552fcc7370SEd Maste fill_classless_routes "$new_classless_routes" 1562fcc7370SEd Maste $LOGGER "New Classless Static Routes ($interface): $classless_routes" 1572fcc7370SEd Maste set $classless_routes 1582fcc7370SEd Maste while [ $# -gt 1 ]; do 1592fcc7370SEd Maste if [ "0.0.0.0" = "$2" ]; then 1602fcc7370SEd Maste route add "$1" -iface "$interface" 1612fcc7370SEd Maste else 1622fcc7370SEd Maste route add "$1" "$2" 1632fcc7370SEd Maste fi 1642fcc7370SEd Maste shift; shift 1652fcc7370SEd Maste done 1662fcc7370SEd Maste return 1672fcc7370SEd Maste fi 1682fcc7370SEd Maste 16947c08596SBrooks Davis for router in $new_routers; do 170d5354256SBrooks Davis if is_default_interface; then 171d5354256SBrooks Davis 17247c08596SBrooks Davis if [ "$new_ip_address" = "$router" ]; then 17347c08596SBrooks Davis route add default -iface $router >/dev/null 2>&1 17447c08596SBrooks Davis else 175fd6ecc18SKristof Provost if [ "$new_subnet_mask" = "255.255.255.255" ]; then 176fd6ecc18SKristof Provost route add "$router" -iface "$interface" >/dev/null 2>&1 177fd6ecc18SKristof Provost fi 178fd6ecc18SKristof Provost 17947c08596SBrooks Davis route add default $router >/dev/null 2>&1 18047c08596SBrooks Davis fi 181d5354256SBrooks Davis fi 18247c08596SBrooks Davis # 2nd and subsequent default routers error out, so explicitly 18347c08596SBrooks Davis # stop processing the list after the first one. 18447c08596SBrooks Davis break 18547c08596SBrooks Davis done 18647c08596SBrooks Davis 18747c08596SBrooks Davis if [ -n "$new_static_routes" ]; then 1888750adafSBrooks Davis $LOGGER "New Static Routes ($interface): $new_static_routes" 18947c08596SBrooks Davis set $new_static_routes 19047c08596SBrooks Davis while [ $# -gt 1 ]; do 19147c08596SBrooks Davis route add $1 $2 19247c08596SBrooks Davis shift; shift 19347c08596SBrooks Davis done 19447c08596SBrooks Davis fi 19547c08596SBrooks Davis} 19647c08596SBrooks Davis 19747c08596SBrooks Davisadd_new_resolv_conf() { 19847c08596SBrooks Davis # XXX Old code did not create/update resolv.conf unless both 19947c08596SBrooks Davis # $new_domain_name and $new_domain_name_servers were provided. PR 20047c08596SBrooks Davis # #3135 reported some ISP's only provide $new_domain_name_servers and 20147c08596SBrooks Davis # thus broke the script. This code creates the resolv.conf if either 20247c08596SBrooks Davis # are provided. 20347c08596SBrooks Davis 204f1bacaa5SBrooks Davis local tmpres=/var/run/resolv.conf.${interface} 20590158aeeSWes Peters rm -f $tmpres 20647c08596SBrooks Davis 207409139f0SJean-Sébastien Pédron if [ -n "$new_domain_search" ]; then 208409139f0SJean-Sébastien Pédron echo "search $new_domain_search" >>$tmpres 209409139f0SJean-Sébastien Pédron elif [ -n "$new_domain_name" ]; then 21090158aeeSWes Peters echo "search $new_domain_name" >>$tmpres 21147c08596SBrooks Davis fi 21247c08596SBrooks Davis 21347c08596SBrooks Davis if [ -n "$new_domain_name_servers" ]; then 21447c08596SBrooks Davis for nameserver in $new_domain_name_servers; do 21590158aeeSWes Peters echo "nameserver $nameserver" >>$tmpres 21647c08596SBrooks Davis done 21747c08596SBrooks Davis fi 21847c08596SBrooks Davis 21990158aeeSWes Peters if [ -f $tmpres ]; then 22047c08596SBrooks Davis if [ -f /etc/resolv.conf.tail ]; then 22190158aeeSWes Peters cat /etc/resolv.conf.tail >>$tmpres 22247c08596SBrooks Davis fi 22347c08596SBrooks Davis 2249201145dSHajimu UMEMOTO case $resolvconf_enable in 2259201145dSHajimu UMEMOTO # "no", "false", "off", or "0" 2269201145dSHajimu UMEMOTO [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 227dd415a50SBrooks Davis # When resolv.conf is not changed actually, we don't 228dd415a50SBrooks Davis # need to update it. 229dd415a50SBrooks Davis # If /usr is not mounted yet, we cannot use cmp, then 230dd415a50SBrooks Davis # the following test fails. In such case, we simply 231dd415a50SBrooks Davis # ignore an error and do update resolv.conf. 23290158aeeSWes Peters if cmp -s $tmpres /etc/resolv.conf; then 23390158aeeSWes Peters rm -f $tmpres 234dd415a50SBrooks Davis return 0 235dd415a50SBrooks Davis fi 2>/dev/null 236dd415a50SBrooks Davis 2379201145dSHajimu UMEMOTO # In case (e.g. during OpenBSD installs) 2389201145dSHajimu UMEMOTO # /etc/resolv.conf is a symbolic link, take 2399201145dSHajimu UMEMOTO # care to preserve the link and write the new 2409201145dSHajimu UMEMOTO # data in the correct location. 24147c08596SBrooks Davis 24247c08596SBrooks Davis if [ -f /etc/resolv.conf ]; then 24347c08596SBrooks Davis cat /etc/resolv.conf > /etc/resolv.conf.save 24447c08596SBrooks Davis fi 24590158aeeSWes Peters cat $tmpres > /etc/resolv.conf 24647c08596SBrooks Davis 24747c08596SBrooks Davis # Try to ensure correct ownership and permissions. 24847c08596SBrooks Davis chown -RL root:wheel /etc/resolv.conf 24947c08596SBrooks Davis chmod -RL 644 /etc/resolv.conf 2509201145dSHajimu UMEMOTO ;; 2519201145dSHajimu UMEMOTO 2529201145dSHajimu UMEMOTO *) 2539201145dSHajimu UMEMOTO /sbin/resolvconf -a ${interface} < $tmpres 2549201145dSHajimu UMEMOTO ;; 2559201145dSHajimu UMEMOTO esac 2569201145dSHajimu UMEMOTO 2579201145dSHajimu UMEMOTO rm -f $tmpres 25847c08596SBrooks Davis 25947c08596SBrooks Davis return 0 26047c08596SBrooks Davis fi 26147c08596SBrooks Davis 26247c08596SBrooks Davis return 1 26347c08596SBrooks Davis} 26447c08596SBrooks Davis 265d6790d5aSBrooks Davis# Must be used on exit. Invokes the local dhcp client exit hooks, if any. 266d6790d5aSBrooks Davisexit_with_hooks() { 267d6790d5aSBrooks Davis exit_status=$1 268d6790d5aSBrooks Davis if [ -f /etc/dhclient-exit-hooks ]; then 269d6790d5aSBrooks Davis . /etc/dhclient-exit-hooks 270d6790d5aSBrooks Davis fi 271d6790d5aSBrooks Davis # probably should do something with exit status of the local script 272d6790d5aSBrooks Davis exit $exit_status 273d6790d5aSBrooks Davis} 274d6790d5aSBrooks Davis 275d5354256SBrooks Davis# Get the interface with the current ipv4 default route on it using only 276d5354256SBrooks Davis# commands that are available prior to /usr being mounted. 277d5354256SBrooks Davisis_default_interface() 278d5354256SBrooks Davis{ 2799761cdd8SBrooks Davis routeget="`route -n get -inet default`" 280d5354256SBrooks Davis oldifs="$IFS" 281d5354256SBrooks Davis IFS=" 282d5354256SBrooks Davis" 283d5354256SBrooks Davis defif= 284d5354256SBrooks Davis for line in $routeget ; do 285d5354256SBrooks Davis case $line in 286d5354256SBrooks Davis *interface:*) 287d5354256SBrooks Davis defif=${line##*: } 288d5354256SBrooks Davis ;; 289d5354256SBrooks Davis esac 290d5354256SBrooks Davis done 291d5354256SBrooks Davis IFS=${oldifs} 292d5354256SBrooks Davis 293d5354256SBrooks Davis if [ -z "$defif" -o "$defif" = "$interface" ]; then 294d5354256SBrooks Davis return 0 295d5354256SBrooks Davis else 296d5354256SBrooks Davis return 1 297d5354256SBrooks Davis fi 298d5354256SBrooks Davis} 299d5354256SBrooks Davis 30047c08596SBrooks Davis# 30147c08596SBrooks Davis# Start of active code. 30247c08596SBrooks Davis# 30347c08596SBrooks Davis 304d5fedb6eSBrooks Davis# Invoke the local dhcp client enter hooks, if they exist. 305d5fedb6eSBrooks Davisif [ -f /etc/dhclient-enter-hooks ]; then 306d5fedb6eSBrooks Davis exit_status=0 307d5fedb6eSBrooks Davis . /etc/dhclient-enter-hooks 308d5fedb6eSBrooks Davis # allow the local script to abort processing of this state 309d5fedb6eSBrooks Davis # local script must set exit_status variable to nonzero. 310d5fedb6eSBrooks Davis if [ $exit_status -ne 0 ]; then 311d5fedb6eSBrooks Davis exit $exit_status 312d5fedb6eSBrooks Davis fi 313d5fedb6eSBrooks Davisfi 314d5fedb6eSBrooks Davis 3159201145dSHajimu UMEMOTO: ${resolvconf_enable="YES"} 3169201145dSHajimu UMEMOTO 31747c08596SBrooks Daviscase $reason in 31847c08596SBrooks DavisMEDIUM) 31960932bc9SAndrew Thompson eval "$IFCONFIG $interface $medium" 32047c08596SBrooks Davis sleep 1 32147c08596SBrooks Davis ;; 32247c08596SBrooks Davis 32347c08596SBrooks DavisPREINIT) 32447c08596SBrooks Davis delete_old_alias 325*e2dc8d78SAlexander V. Chernikov eval "$IFCONFIG $interface up" 32647c08596SBrooks Davis ;; 32747c08596SBrooks Davis 32847c08596SBrooks DavisARPCHECK|ARPSEND) 32947c08596SBrooks Davis ;; 33047c08596SBrooks Davis 33147c08596SBrooks DavisBOUND|RENEW|REBIND|REBOOT) 3328750adafSBrooks Davis check_hostname 33347c08596SBrooks Davis if [ -n "$old_ip_address" ]; then 33447c08596SBrooks Davis if [ "$old_ip_address" != "$alias_ip_address" ]; then 33547c08596SBrooks Davis delete_old_alias 33647c08596SBrooks Davis fi 33747c08596SBrooks Davis if [ "$old_ip_address" != "$new_ip_address" ]; then 33847c08596SBrooks Davis delete_old_address 33947c08596SBrooks Davis delete_old_routes 34047c08596SBrooks Davis fi 34147c08596SBrooks Davis fi 34247c08596SBrooks Davis if [ "$reason" = BOUND ] || \ 34347c08596SBrooks Davis [ "$reason" = REBOOT ] || \ 34447c08596SBrooks Davis [ -z "$old_ip_address" ] || \ 34547c08596SBrooks Davis [ "$old_ip_address" != "$new_ip_address" ]; then 34647c08596SBrooks Davis add_new_address 34747c08596SBrooks Davis add_new_routes 34847c08596SBrooks Davis fi 34947c08596SBrooks Davis if [ "$new_ip_address" != "$alias_ip_address" ]; then 35047c08596SBrooks Davis add_new_alias 35147c08596SBrooks Davis fi 352d5354256SBrooks Davis if is_default_interface; then 35347c08596SBrooks Davis add_new_resolv_conf 354d5354256SBrooks Davis fi 35547c08596SBrooks Davis ;; 35647c08596SBrooks Davis 35747c08596SBrooks DavisEXPIRE|FAIL) 35847c08596SBrooks Davis delete_old_alias 35947c08596SBrooks Davis if [ -n "$old_ip_address" ]; then 36047c08596SBrooks Davis delete_old_address 36147c08596SBrooks Davis delete_old_routes 36247c08596SBrooks Davis fi 363b1f35e43SBrooks Davis if [ -x $ARP ]; then 364b1f35e43SBrooks Davis $ARP -d -a -i $interface 365b1f35e43SBrooks Davis fi 36647c08596SBrooks Davis # XXX Why add alias we just deleted above? 36747c08596SBrooks Davis add_new_alias 368d5354256SBrooks Davis if is_default_interface; then 3699201145dSHajimu UMEMOTO case $resolvconf_enable in 3709201145dSHajimu UMEMOTO # "no", "false", "off", or "0" 3719201145dSHajimu UMEMOTO [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 37247c08596SBrooks Davis if [ -f /etc/resolv.conf.save ]; then 37347c08596SBrooks Davis cat /etc/resolv.conf.save > /etc/resolv.conf 37447c08596SBrooks Davis fi 3759201145dSHajimu UMEMOTO ;; 3769201145dSHajimu UMEMOTO *) 3779201145dSHajimu UMEMOTO /sbin/resolvconf -d ${interface} 3789201145dSHajimu UMEMOTO ;; 3799201145dSHajimu UMEMOTO esac 380d5354256SBrooks Davis fi 38147c08596SBrooks Davis ;; 38247c08596SBrooks Davis 38347c08596SBrooks DavisTIMEOUT) 38447c08596SBrooks Davis delete_old_alias 38547c08596SBrooks Davis add_new_address 38647c08596SBrooks Davis sleep 1 38747c08596SBrooks Davis if [ -n "$new_routers" ]; then 3888750adafSBrooks Davis $LOGGER "New Routers ($interface): $new_routers" 38947c08596SBrooks Davis set "$new_routers" 390b0864f3aSBrooks Davis if ping -q -c 1 -t 1 "$1"; then 39147c08596SBrooks Davis if [ "$new_ip_address" != "$alias_ip_address" ]; then 39247c08596SBrooks Davis add_new_alias 39347c08596SBrooks Davis fi 39447c08596SBrooks Davis add_new_routes 395d5354256SBrooks Davis if ! is_default_interface; then 396d5354256SBrooks Davis exit_with_hooks 0 397d5354256SBrooks Davis fi 39847c08596SBrooks Davis if add_new_resolv_conf; then 399d6790d5aSBrooks Davis exit_with_hooks 0 40047c08596SBrooks Davis fi 40147c08596SBrooks Davis fi 40247c08596SBrooks Davis fi 40360932bc9SAndrew Thompson eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" 40447c08596SBrooks Davis delete_old_routes 405d6790d5aSBrooks Davis exit_with_hooks 1 40647c08596SBrooks Davis ;; 40747c08596SBrooks Davisesac 40847c08596SBrooks Davis 409d6790d5aSBrooks Davisexit_with_hooks 0 410