summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2005-06-08 18:21:56 +0000
committerbrooks <brooks@FreeBSD.org>2005-06-08 18:21:56 +0000
commitdbc80a24b5fc610abc66334d903410afd01b6c92 (patch)
tree1137f3deea9cd4e2b19474510526a2ca42a9e868 /sbin/dhclient
parentb2d9df7a8b2f7ba0078f682432607f490b6cd2c8 (diff)
downloadFreeBSD-src-dbc80a24b5fc610abc66334d903410afd01b6c92.zip
FreeBSD-src-dbc80a24b5fc610abc66334d903410afd01b6c92.tar.gz
Add support for /etc/dhclient-exit-hooks file.
Tested by: Max Boyarov <max_b at tut dot by>
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient-script16
1 files changed, 13 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script
index 2d267f3..46974fb 100644
--- a/sbin/dhclient/dhclient-script
+++ b/sbin/dhclient/dhclient-script
@@ -172,6 +172,16 @@ add_new_resolv_conf() {
return 1
}
+# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
+exit_with_hooks() {
+ exit_status=$1
+ if [ -f /etc/dhclient-exit-hooks ]; then
+ . /etc/dhclient-exit-hooks
+ fi
+ # probably should do something with exit status of the local script
+ exit $exit_status
+}
+
#
# Start of active code.
#
@@ -247,14 +257,14 @@ TIMEOUT)
fi
add_new_routes
if add_new_resolv_conf; then
- exit 0
+ exit_with_hooks 0
fi
fi
fi
ifconfig $interface inet -alias $new_ip_address $medium
delete_old_routes
- exit 1
+ exit_with_hooks 1
;;
esac
-exit 0
+exit_with_hooks 0
OpenPOWER on IntegriCloud