timeout option (command line) with value 3 or less was driving dhclient mad (#789719)

This commit is contained in:
Jiri Popelka 2012-02-13 18:46:33 +01:00
parent 4e92627fc4
commit 663dceaf48
2 changed files with 25 additions and 32 deletions

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.2.3rc1/client/clparse.c.options dhcp-4.2.3rc1/client/clparse.c
--- dhcp-4.2.3rc1/client/clparse.c.options 2011-04-21 16:08:14.000000000 +0200
+++ dhcp-4.2.3rc1/client/clparse.c 2011-10-18 18:43:04.341962957 +0200
diff -up dhcp-4.2.3-P2/client/clparse.c.options dhcp-4.2.3-P2/client/clparse.c
--- dhcp-4.2.3-P2/client/clparse.c.options 2011-04-21 16:08:14.000000000 +0200
+++ dhcp-4.2.3-P2/client/clparse.c 2012-02-13 18:21:32.233471518 +0100
@@ -146,6 +146,7 @@ isc_result_t read_client_conf ()
/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
*/
@ -32,9 +32,9 @@ diff -up dhcp-4.2.3rc1/client/clparse.c.options dhcp-4.2.3rc1/client/clparse.c
default:
lose = 0;
stmt = (struct executable_statement *)0;
diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
--- dhcp-4.2.3rc1/client/dhclient.c.options 2011-07-01 13:58:53.000000000 +0200
+++ dhcp-4.2.3rc1/client/dhclient.c 2011-10-18 18:43:04.342962944 +0200
diff -up dhcp-4.2.3-P2/client/dhclient.c.options dhcp-4.2.3-P2/client/dhclient.c
--- dhcp-4.2.3-P2/client/dhclient.c.options 2011-12-31 01:55:21.000000000 +0100
+++ dhcp-4.2.3-P2/client/dhclient.c 2012-02-13 18:22:11.554979930 +0100
@@ -39,6 +39,12 @@
#include <limits.h>
#include <dns/result.h>
@ -138,7 +138,7 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
+ }
+
+ if ((timeout_arg = atoi(argv[i])) <= 0) {
+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
+ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
+ exit(1);
+ }
+ } else if (!strcmp(argv[i], "-V")) {
@ -163,7 +163,7 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
} else if (argv[i][0] == '-') {
usage();
} else if (interfaces_requested < 0) {
@@ -484,6 +584,166 @@ main(int argc, char **argv) {
@@ -484,6 +584,156 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf();
@ -297,21 +297,11 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
+
+ if (timeout_arg) {
+ /* we just set the toplevel timeout, but per-client
+ * timeouts may still be at defaults. Also, it makes no
+ * sense having the reboot_timeout or backoff_cutoff
+ * greater than the timeout:
+ * timeouts may still be at defaults.
+ */
+ if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
+
+ for (ip=interfaces; ip; ip = ip->next) {
+ if (ip->client->config->timeout == 60)
+ ip->client->config->timeout = timeout_arg;
+
+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
+ ip->client->config->reboot_timeout = ip->client->config->timeout;
+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
+ }
+ }
+
@ -330,7 +320,7 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
/* Parse the lease database. */
read_client_leases();
@@ -2397,7 +2657,8 @@ void make_discover (client, lease)
@@ -2397,7 +2647,8 @@ void make_discover (client, lease)
client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */
@ -340,7 +330,7 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2481,7 +2742,9 @@ void make_request (client, lease)
@@ -2481,7 +2732,9 @@ void make_request (client, lease)
} else {
memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr);
@ -351,7 +341,7 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2543,7 +2806,8 @@ void make_decline (client, lease)
@@ -2543,7 +2796,8 @@ void make_decline (client, lease)
client -> packet.hops = 0;
client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */
@ -361,9 +351,9 @@ diff -up dhcp-4.2.3rc1/client/dhclient.c.options dhcp-4.2.3rc1/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
diff -up dhcp-4.2.3rc1/common/conflex.c.options dhcp-4.2.3rc1/common/conflex.c
--- dhcp-4.2.3rc1/common/conflex.c.options 2011-09-21 22:43:10.000000000 +0200
+++ dhcp-4.2.3rc1/common/conflex.c 2011-10-18 18:43:04.347962883 +0200
diff -up dhcp-4.2.3-P2/common/conflex.c.options dhcp-4.2.3-P2/common/conflex.c
--- dhcp-4.2.3-P2/common/conflex.c.options 2011-09-21 22:43:10.000000000 +0200
+++ dhcp-4.2.3-P2/common/conflex.c 2012-02-13 18:21:32.335470243 +0100
@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
return BALANCE;
if (!strcasecmp (atom + 1, "ound"))
@ -373,9 +363,9 @@ diff -up dhcp-4.2.3rc1/common/conflex.c.options dhcp-4.2.3rc1/common/conflex.c
break;
case 'c':
if (!strcasecmp(atom + 1, "ase"))
diff -up dhcp-4.2.3rc1/includes/dhcpd.h.options dhcp-4.2.3rc1/includes/dhcpd.h
--- dhcp-4.2.3rc1/includes/dhcpd.h.options 2011-10-04 21:43:12.000000000 +0200
+++ dhcp-4.2.3rc1/includes/dhcpd.h 2011-10-18 18:43:04.388962369 +0200
diff -up dhcp-4.2.3-P2/includes/dhcpd.h.options dhcp-4.2.3-P2/includes/dhcpd.h
--- dhcp-4.2.3-P2/includes/dhcpd.h.options 2011-12-31 00:17:04.000000000 +0100
+++ dhcp-4.2.3-P2/includes/dhcpd.h 2012-02-13 18:21:32.542467656 +0100
@@ -1147,6 +1147,9 @@ struct client_config {
int do_forward_update; /* If nonzero, and if we have the
information we need, update the
@ -386,9 +376,9 @@ diff -up dhcp-4.2.3rc1/includes/dhcpd.h.options dhcp-4.2.3rc1/includes/dhcpd.h
};
/* Per-interface state used in the dhcp client... */
diff -up dhcp-4.2.3rc1/includes/dhctoken.h.options dhcp-4.2.3rc1/includes/dhctoken.h
--- dhcp-4.2.3rc1/includes/dhctoken.h.options 2011-09-21 22:43:10.000000000 +0200
+++ dhcp-4.2.3rc1/includes/dhctoken.h 2011-10-18 18:47:08.039916315 +0200
diff -up dhcp-4.2.3-P2/includes/dhctoken.h.options dhcp-4.2.3-P2/includes/dhctoken.h
--- dhcp-4.2.3-P2/includes/dhctoken.h.options 2011-09-21 22:43:10.000000000 +0200
+++ dhcp-4.2.3-P2/includes/dhctoken.h 2012-02-13 18:21:32.644466377 +0100
@@ -363,7 +363,8 @@ enum dhcp_token {
INITIAL_DELAY = 664,
GETHOSTBYNAME = 665,

View File

@ -22,7 +22,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.3
Release: 17.%{patchver}%{?dist}
Release: 18.%{patchver}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -607,6 +607,9 @@ fi
%changelog
* Mon Feb 13 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.3-18.P2
- -timeout option (command line) with value 3 or less was driving dhclient mad (#789719)
* Tue Feb 07 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.3-17.P2
- dhclient-script: install link-local static routes with correct scope (#787318)