diff options
author | Ted Lemon <source@isc.org> | 2001-06-27 00:31:20 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 2001-06-27 00:31:20 +0000 |
commit | d758ad8cac9c00c70cfe4dd459bf7e87c268c579 (patch) | |
tree | 85d7e10e40b0e1061a40f45ef0e9f44073346482 /client | |
parent | 07b958004f4e39f9b222115b1b050044a2434ea1 (diff) | |
download | isc-dhcp-d758ad8cac9c00c70cfe4dd459bf7e87c268c579.tar.gz |
Merge changes between 3.0rc7 and 3.0rc8pl2.
Diffstat (limited to 'client')
-rw-r--r-- | client/clparse.c | 93 | ||||
-rw-r--r-- | client/dhclient.8 | 31 | ||||
-rw-r--r-- | client/dhclient.c | 218 | ||||
-rw-r--r-- | client/dhclient.conf.5 | 20 | ||||
-rwxr-xr-x | client/scripts/bsdos | 13 | ||||
-rwxr-xr-x | client/scripts/freebsd | 13 | ||||
-rwxr-xr-x | client/scripts/linux | 13 | ||||
-rwxr-xr-x | client/scripts/netbsd | 13 | ||||
-rw-r--r-- | client/scripts/nextstep | 13 | ||||
-rw-r--r-- | client/scripts/openbsd | 13 | ||||
-rwxr-xr-x | client/scripts/solaris | 13 |
11 files changed, 372 insertions, 81 deletions
diff --git a/client/clparse.c b/client/clparse.c index eb82b461..eaf4f579 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.62 2001/05/04 00:51:35 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.63 2001/06/27 00:29:27 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -70,11 +70,6 @@ u_int32_t default_requested_options [] = { isc_result_t read_client_conf () { - int file; - struct parse *cfile; - const char *val; - int token; - int declaration = 0; struct client_config *config; struct client_state *state; struct interface_info *ip; @@ -106,26 +101,12 @@ isc_result_t read_client_conf () if (!top_level_config.on_transmission) log_fatal ("no memory for top-level on_transmission group"); - if ((file = open (path_dhclient_conf, O_RDONLY)) >= 0) { - cfile = (struct parse *)0; - new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); - - do { - token = peek_token (&val, (unsigned *)0, cfile); - if (token == END_OF_FILE) - break; - parse_client_statement (cfile, - (struct interface_info *)0, - &top_level_config); - } while (1); - token = next_token (&val, (unsigned *)0, cfile); - status = (cfile -> warnings_occurred - ? ISC_R_BADPARSE - : ISC_R_SUCCESS); - close (file); - end_parse (&cfile); + status = read_client_conf_file (path_dhclient_conf, + (struct interface_info *)0, + &top_level_config); + if (status != ISC_R_SUCCESS) { + ; #ifdef LATER - } else { /* Set up the standard name service updater routine. */ parse = (struct parse *)0; status = new_parse (&parse, -1, default_client_config, @@ -175,6 +156,37 @@ isc_result_t read_client_conf () return status; } +int read_client_conf_file (const char *name, struct interface_info *ip, + struct client_config *client) +{ + int file; + struct parse *cfile; + const char *val; + int token; + isc_result_t status; + + if ((file = open (name, O_RDONLY)) < 0) + return uerr2isc (errno); + + cfile = (struct parse *)0; + new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); + + do { + token = peek_token (&val, (unsigned *)0, cfile); + if (token == END_OF_FILE) + break; + parse_client_statement (cfile, ip, client); + } while (1); + token = next_token (&val, (unsigned *)0, cfile); + status = (cfile -> warnings_occurred + ? ISC_R_BADPARSE + : ISC_R_SUCCESS); + close (file); + end_parse (&cfile); + return status; +} + + /* lease-file :== client-lease-statements END_OF_FILE client-lease-statements :== <nil> | client-lease-statements LEASE client-lease-statement */ @@ -246,8 +258,23 @@ void parse_client_statement (cfile, ip, config) enum policy policy; int known; int tmp, i; + isc_result_t status; switch (peek_token (&val, (unsigned *)0, cfile)) { + case INCLUDE: + next_token (&val, (unsigned *)0, cfile); + token = next_token (&val, (unsigned *)0, cfile); + if (token != STRING) { + parse_warn (cfile, "filename string expected."); + skip_to_semi (cfile); + } else { + status = read_client_conf_file (val, ip, config); + if (status != ISC_R_SUCCESS) + parse_warn (cfile, "%s: bad parse.", val); + parse_semi (cfile); + } + return; + case KEY: next_token (&val, (unsigned *)0, cfile); if (ip) { @@ -531,9 +558,10 @@ void parse_client_statement (cfile, ip, config) } } else { struct executable_statement **eptr, *sptr; - if (stmt -> op == send_option_statement || - (stmt -> op == on_statement && - (stmt -> data.on.evtypes & ON_TRANSMISSION))) { + if (stmt && + (stmt -> op == send_option_statement || + (stmt -> op == on_statement && + (stmt -> data.on.evtypes & ON_TRANSMISSION)))) { eptr = &config -> on_transmission -> statements; if (stmt -> op == on_statement) { sptr = (struct executable_statement *)0; @@ -551,9 +579,12 @@ void parse_client_statement (cfile, ip, config) } else eptr = &config -> on_receipt -> statements; - for (; *eptr; eptr = &(*eptr) -> next) - ; - executable_statement_reference (eptr, stmt, MDL); + if (stmt) { + for (; *eptr; eptr = &(*eptr) -> next) + ; + executable_statement_reference (eptr, + stmt, MDL); + } return; } break; diff --git a/client/dhclient.8 b/client/dhclient.8 index 7fef673b..52da6796 100644 --- a/client/dhclient.8 +++ b/client/dhclient.8 @@ -246,6 +246,37 @@ supplying the flag. .SH CONFIGURATION The syntax of the dhclient.conf(8) file is discussed seperately. +.SH OMAPI +The DHCP client provides some ability to control it while it is +running, without stopping it. This capability is provided using OMAPI, +an API for manipulating remote objects. OMAPI clients connect to the +client using TCP/IP, authenticate, and can then examine the client's +current status and make changes to it. +.PP +Rather than implementing the underlying OMAPI protocol directly, user +programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a +wrapper that handles some of the housekeeping chores that OMAPI does +not do automatically. Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR +and \fBomapi(3)\fR. Most things you'd want to do with the client can +be done directly using the \fBomshell(1)\fR command, rather than +having to write a special program. +.SH THE CONTROL OBJECT +The control object allows you to shut the client down, releasing all +leases that it holds and deleting any DNS records it may have added. +It also allows you to pause the client - this unconfigures any +interfaces the client is using. You can then restart it, which +causes it to reconfigure those interfaces. You would normally pause +the client prior to going into hibernation or sleep on a laptop +computer. You would then resume it after the power comes back. +This allows PC cards to be shut down while the computer is hibernating +or sleeping, and then reinitialized to their previous state once the +computer comes out of hibernation or sleep. +.PP +The control object has one attribute - the state attribute. To shut +the client down, set its state attribute to 2. It will automatically +do a DHCPRELEASE. To pause it, set its state attribute to 3. To +resume it, set its state attribute to 4. +.PP .SH FILES .B CLIENTBINDIR/dhclient-script, .B ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid, diff --git a/client/dhclient.c b/client/dhclient.c index 364505e1..e3667c74 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -41,7 +41,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.129 2001/04/16 22:07:33 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.130 2001/06/27 00:29:29 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -445,7 +445,8 @@ int main (argc, argv, envp) /* Set up the bootp packet handler... */ bootp_packet_handler = do_packet; -#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) +#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \ + defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) dmalloc_cutoff_generation = dmalloc_generation; dmalloc_longterm = dmalloc_outstanding; dmalloc_outstanding = 0; @@ -551,7 +552,8 @@ void state_reboot (cpp) /* If we don't remember an active lease, go straight to INIT. */ if (!client -> active || - client -> active -> is_bootp) { + client -> active -> is_bootp || + client -> active -> expiry <= cur_time) { state_init (client); return; } @@ -880,6 +882,7 @@ void bind_lease (client) client -> state = S_BOUND; reinitialize_interfaces (); go_daemon (); + client_dns_update (client, 1); } /* state_bound is called when we've successfully bound to a particular @@ -925,6 +928,32 @@ void state_bound (cpp) send_request (client); } +/* state_stop is called when we've been told to shut down. We unconfigure + the interfaces, and then stop operating until told otherwise. */ + +void state_stop (cpp) + void *cpp; +{ + struct client_state *client = cpp; + int i; + + /* Cancel all timeouts. */ + cancel_timeout (state_selecting, client); + cancel_timeout (send_discover, client); + cancel_timeout (send_request, client); + cancel_timeout (state_bound, client); + + /* If we have an address, unconfigure it. */ + if (client -> active) { + script_init (client, "STOP", client -> active -> medium); + script_write_params (client, "old_", client -> active); + if (client -> alias) + script_write_params (client, "alias_", + client -> alias); + script_go (client); + } +} + int commit_leases () { return 0; @@ -1021,6 +1050,7 @@ void dhcpoffer (packet) const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY"; struct iaddrlist *ap; struct option_cache *oc; + char obuf [1024]; #ifdef DEBUG_PACKET dump_packet (packet); @@ -1045,17 +1075,20 @@ void dhcpoffer (packet) return; } - log_info ("%s from %s", name, piaddr (packet -> client_addr)); + sprintf (obuf, "%s from %s", name, piaddr (packet -> client_addr)); /* If this lease doesn't supply the minimum required parameters, blow it off. */ if (client -> config -> required_options) { - for (i = 0; client -> config -> required_options [i]; i++) { - if (!lookup_option - (&dhcp_universe, packet -> options, - client -> config -> required_options [i])) { - log_info ("%s isn't satisfactory.", name); + for (i = 0; client -> config -> required_options [i]; i++) { + if (!lookup_option + (&dhcp_universe, packet -> options, + client -> config -> required_options [i])) { + log_info ("%s: no %s option.", + obuf, (dhcp_universe.options + [client -> config -> required_options [i]] + -> name)); return; } } @@ -1066,14 +1099,14 @@ void dhcpoffer (packet) if (lease -> address.len == sizeof packet -> raw -> yiaddr && !memcmp (lease -> address.iabuf, &packet -> raw -> yiaddr, lease -> address.len)) { - log_debug ("%s already seen.", name); + log_debug ("%s: already seen.", obuf); return; } } lease = packet_to_lease (packet, client); if (!lease) { - log_info ("packet_to_lease failed."); + log_info ("%s: packet_to_lease failed.", obuf); return; } @@ -1114,11 +1147,12 @@ void dhcpoffer (packet) state_selecting(). Otherwise, time out into state_selecting at the select interval. */ if (stop_selecting <= 0) - state_selecting (ip); + state_selecting (client); else { add_timeout (stop_selecting, state_selecting, client, 0, 0); cancel_timeout (send_discover, client); } + log_info ("%s", obuf); } /* Allocate a client_lease structure and initialize it from the parameters @@ -1741,6 +1775,10 @@ void make_client_options (client, lease, type, sid, rip, prl, op) struct option_cache *oc; struct buffer *bp = (struct buffer *)0; + /* If there are any leftover options, get rid of them. */ + if (*op) + option_state_dereference (op, MDL); + /* Allocate space for options. */ option_state_allocate (op, MDL); @@ -1870,7 +1908,6 @@ void make_request (client, lease) int i, j; unsigned char *tmp, *digest; unsigned char *old_digest_loc; - struct option_state *options = (struct option_state *)0; struct option_cache *oc; memset (&client -> packet, 0, sizeof (client -> packet)); @@ -1887,13 +1924,13 @@ void make_request (client, lease) ? &lease -> address : (struct iaddr *)0), client -> config -> requested_options, - &options); + &client -> sent_options); /* Set up the option buffer... */ client -> packet_length = cons_options ((struct packet *)0, &client -> packet, (struct lease *)0, client, 0, - (struct option_state *)0, options, + (struct option_state *)0, client -> sent_options, &global_scope, 0, 0, 0, (struct data_string *)0, client -> config -> vendor_space_name); if (client -> packet_length < BOOTP_MIN_LEN) @@ -2750,6 +2787,7 @@ void do_release(client) if (client -> alias) script_write_params (client, "alias_", client -> alias); + script_write_params (client, "old_", client -> active); script_go (client); } @@ -2886,3 +2924,153 @@ unsigned cons_agent_information_options (cfg_options, outpacket, { return length; } + +static void shutdown_exit (void *foo) +{ + exit (0); +} + +isc_result_t dhcp_set_control_state (control_object_state_t oldstate, + control_object_state_t newstate) +{ + struct interface_info *ip; + struct client_state *client; + + /* Do the right thing for each interface. */ + for (ip = interfaces; ip; ip = ip -> next) { + for (client = ip -> client; client; client = client -> next) { + switch (newstate) { + case server_startup: + return ISC_R_SUCCESS; + + case server_running: + return ISC_R_SUCCESS; + + case server_shutdown: + if (client -> active && + client -> active -> expiry > cur_time) { + client_dns_update (client, 0); + do_release (client); + } + break; + + case server_hibernate: + state_stop (client); + break; + + case server_awaken: + state_reboot (client); + break; + } + } + } + if (newstate == server_shutdown) + add_timeout (cur_time + 1, shutdown_exit, 0, 0, 0); + return ISC_R_SUCCESS; +} + +/* See if we should do a DNS update, and if so, do it. */ + +void client_dns_update (struct client_state *client, int addp) +{ + struct data_string ddns_fqdn, ddns_fwd_name, + ddns_dhcid, client_identifier; + struct option_cache *oc; + int ignorep; + int result; + isc_result_t rcode; + + /* If we didn't send an FQDN option, we certainly aren't going to + be doing an update. */ + if (!client -> sent_options) + return; + + /* If we don't have a lease, we can't do an update. */ + if (!client -> active) + return; + + /* If we set the no client update flag, don't do the update. */ + if ((oc = lookup_option (&fqdn_universe, client -> sent_options, + FQDN_NO_CLIENT_UPDATE)) && + evaluate_boolean_option_cache (&ignorep, (struct packet *)0, + (struct lease *)0, client, + client -> sent_options, + (struct option_state *)0, + &global_scope, oc, MDL)) + return; + + /* If we set the "server, please update" flag, or didn't set it + to false, don't do the update. */ + if (!(oc = lookup_option (&fqdn_universe, client -> sent_options, + FQDN_SERVER_UPDATE)) || + evaluate_boolean_option_cache (&ignorep, (struct packet *)0, + (struct lease *)0, client, + client -> sent_options, + (struct option_state *)0, + &global_scope, oc, MDL)) + return; + + /* If no FQDN option was supplied, don't do the update. */ + memset (&ddns_fwd_name, 0, sizeof ddns_fwd_name); + if (!(oc = lookup_option (&fqdn_universe, client -> sent_options, + FQDN_FQDN)) || + !evaluate_option_cache (&ddns_fwd_name, (struct packet *)0, + (struct lease *)0, client, + client -> sent_options, + (struct option_state *)0, + &global_scope, oc, MDL)) + return; + + /* Make a dhcid string out of either the client identifier, + if we are sending one, or the interface's MAC address, + otherwise. */ + memset (&ddns_dhcid, 0, sizeof ddns_dhcid); + + memset (&client_identifier, 0, sizeof client_identifier); + if ((oc = lookup_option (&dhcp_universe, client -> sent_options, + DHO_DHCP_CLIENT_IDENTIFIER)) && + evaluate_option_cache (&client_identifier, (struct packet *)0, + (struct lease *)0, client, + client -> sent_options, + (struct option_state *)0, + &global_scope, oc, MDL)) { + result = get_dhcid (&ddns_dhcid, + DHO_DHCP_CLIENT_IDENTIFIER, + client_identifier.data, + client_identifier.len); + data_string_forget (&client_identifier, MDL); + } else + result = get_dhcid (&ddns_dhcid, 0, + client -> interface -> hw_address.hbuf, + client -> interface -> hw_address.hlen); + if (!result) { + data_string_forget (&ddns_fwd_name, MDL); + return; + } + + /* Start the resolver, if necessary. */ + if (!resolver_inited) { + minires_ninit (&resolver_state); + resolver_inited = 1; + resolver_state.retrans = 1; + resolver_state.retry = 1; + } + + /* + * Perform updates. + */ + if (ddns_fwd_name.len && ddns_dhcid.len) { + if (addp) + rcode = ddns_update_a (&ddns_fwd_name, + client -> active -> address, + &ddns_dhcid, DEFAULT_DDNS_TTL, + 1); + else + rcode = ddns_remove_a (&ddns_fwd_name, + client -> active -> address, + &ddns_dhcid); + } + + data_string_forget (&ddns_fwd_name, MDL); + data_string_forget (&ddns_dhcid, MDL); +} diff --git a/client/dhclient.conf.5 b/client/dhclient.conf.5 index 6af31826..90e1843d 100644 --- a/client/dhclient.conf.5 +++ b/client/dhclient.conf.5 @@ -227,6 +227,26 @@ than the default requested lease time, which is two hours. The other obvious use for this statement is to send information to the server that will allow it to differentiate between this client and other clients or kinds of clients. +.SH DYNAMIC DNS +The client now has some very limited support for doing DNS updates +when a lease is acquired. This is prototypical, and probably doesn't +do what you want. It also only works if you happen to have control +over your DNS server, which isn't very likely. +.PP +To make it work, you have to declare a key and zone as in the DHCP +server (see \fBdhcpd.conf\fR(5) for details). You also need to +configure the fqdn option on the client, as follows: +.PP +.nf + send fqdn.fqdn "grosse.fugue.com."; + send fqdn.encoded on; + send fqdn.server-update off; +.fi +.PP +The \fIfqdn.fqdn\fR option \fBMUST\fR be a fully-qualified domain +name. You \fBMUST\fR define a zone statement for the zone to be +updated. The \fIfqdn.encoded\fR option may need to be set to +\fIon\fR or \fIoff\fR, depending on the DHCP server you are using. .SH OPTION MODIFIERS In some cases, a client may receive option data from the server which is not really appropriate for that client, or may not receive diff --git a/client/scripts/bsdos b/client/scripts/bsdos index 13be7008..d076d92d 100755 --- a/client/scripts/bsdos +++ b/client/scripts/bsdos @@ -1,10 +1,12 @@ #!/bin/sh make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -127,7 +129,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 diff --git a/client/scripts/freebsd b/client/scripts/freebsd index 4f2d971f..652d0d06 100755 --- a/client/scripts/freebsd +++ b/client/scripts/freebsd @@ -7,10 +7,12 @@ else fi make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -140,7 +142,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 diff --git a/client/scripts/linux b/client/scripts/linux index 9f02f23f..71d00ab3 100755 --- a/client/scripts/linux +++ b/client/scripts/linux @@ -23,10 +23,12 @@ # of the $1 in its args. function make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -147,7 +149,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then # Turn off alias interface. ifconfig $interface:0- inet 0 diff --git a/client/scripts/netbsd b/client/scripts/netbsd index f61d0e78..d226cdff 100755 --- a/client/scripts/netbsd +++ b/client/scripts/netbsd @@ -1,10 +1,12 @@ #!/bin/sh make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -127,7 +129,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 diff --git a/client/scripts/nextstep b/client/scripts/nextstep index 1c8c2a26..7600fb14 100644 --- a/client/scripts/nextstep +++ b/client/scripts/nextstep @@ -31,13 +31,16 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ route add default $router 1 >/dev/null 2>&1 done fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi exit 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$old_ip_address != x ]; then route delete $old_ip_address 127.1 >/dev/null 2>&1 for $router in $old_routers ; do diff --git a/client/scripts/openbsd b/client/scripts/openbsd index 13be7008..d076d92d 100644 --- a/client/scripts/openbsd +++ b/client/scripts/openbsd @@ -1,10 +1,12 @@ #!/bin/sh make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -127,7 +129,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 diff --git a/client/scripts/solaris b/client/scripts/solaris index 21e83fa0..e6187c71 100755 --- a/client/scripts/solaris +++ b/client/scripts/solaris @@ -1,10 +1,12 @@ #!/bin/sh make_resolv_conf() { - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + fi } # Must be used on exit. Invokes the local dhcp client exit hooks, if any. @@ -120,7 +122,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ exit_with_hooks 0 fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then $ifconfig ${interface}:1 0 down > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 |