1 diff -up dhcp-4.2.1b1/client/dhclient.8.man dhcp-4.2.1b1/client/dhclient.8
2 --- dhcp-4.2.1b1/client/dhclient.8.man 2010-07-14 22:09:34.000000000 +0200
3 +++ dhcp-4.2.1b1/client/dhclient.8 2011-01-27 18:19:07.000000000 +0100
4 @@ -115,6 +115,33 @@ dhclient - Dynamic Host Configuration Pr
12 +.I dhcp-client-identifier
24 +.I vendor-class-identifier
28 +.I request-option-list
38 @@ -264,6 +291,69 @@ not to exit when it doesn't find any suc
39 program can then be used to notify the client when a network interface
40 has been added or removed, so that the client can attempt to configure an IP
41 address on that interface.
45 +Set the BOOTP broadcast flag in request packets so servers will always
49 +.BI \-I\ <dhcp-client-identifier>
50 +Specify the dhcp-client-identifier option to send to the DHCP server.
54 +Specify the host-name option to send to the DHCP server. The host-name
55 +string only contains the client's hostname prefix, to which the server will
56 +append the ddns-domainname or domain-name options, if any, to derive the
57 +fully qualified domain name of the client. The
59 +option cannot be used with the
65 +Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
68 +option. The fqdn.fqdn option must specify the complete domain name of the
69 +client host, which the server may use for dynamic DNS updates.
72 +.BI \-V\ <vendor-class-identifier>
73 +Specify the vendor-class-identifier option to send to the DHCP server.
76 +.BI \-R\ <option>[,<option>...]
77 +Specify the list of options the client is to request from the server. The
78 +option list must be a single string consisting of option names separated
79 +by at least one command and optional space characters. The default option
83 + subnet-mask, broadcast-address, time-offset, routers,
85 + domain-search, domain-name, domain-name-servers, host-name,
87 + nis-domain, nis-servers, ntp-servers, interface-mtu
91 +option does not append options to the default request, it overrides the
92 +default request list. Keep this in mind if you want to request an
93 +additional option besides the default request list. You will have to
94 +specify all option names for the
99 +.BI \-timeout\ <timeout>
100 +Specify the time after which
102 +will decide that no DHCP servers can be contacted when no responses have been
107 Do not configure any interfaces. This is most likely to be useful in
108 diff -up dhcp-4.2.4-P2/client/clparse.c.options dhcp-4.2.4-P2/client/clparse.c
109 --- dhcp-4.2.4-P2/client/clparse.c.options 2012-08-24 21:11:21.000000000 +0200
110 +++ dhcp-4.2.4-P2/client/clparse.c 2012-09-26 10:34:27.140049896 +0200
111 @@ -154,6 +154,7 @@ isc_result_t read_client_conf ()
112 /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
114 top_level_config.requested_lease = 7200;
115 + top_level_config.bootp_broadcast_always = 0;
117 group_allocate (&top_level_config.on_receipt, MDL);
118 if (!top_level_config.on_receipt)
119 @@ -320,7 +321,8 @@ void read_client_leases ()
120 interface-declaration |
121 LEASE client-lease-statement |
122 ALIAS client-lease-statement |
123 - KEY key-definition */
124 + KEY key-definition |
125 + BOOTP_BROADCAST_ALWAYS */
127 void parse_client_statement (cfile, ip, config)
129 @@ -739,6 +741,12 @@ void parse_client_statement (cfile, ip,
130 parse_reject_statement (cfile, config);
133 + case BOOTP_BROADCAST_ALWAYS:
134 + token = next_token(&val, (unsigned*)0, cfile);
135 + config -> bootp_broadcast_always = 1;
136 + parse_semi (cfile);
141 stmt = (struct executable_statement *)0;
142 diff -up dhcp-4.2.4-P2/client/dhclient.c.options dhcp-4.2.4-P2/client/dhclient.c
143 --- dhcp-4.2.4-P2/client/dhclient.c.options 2012-08-28 04:13:03.000000000 +0200
144 +++ dhcp-4.2.4-P2/client/dhclient.c 2012-09-26 10:36:10.396967531 +0200
147 #include <dns/result.h>
150 + * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
151 + * that when building ISC code.
153 +extern int asprintf(char **strp, const char *fmt, ...);
155 TIME default_lease_time = 43200; /* 12 hours... */
156 TIME max_lease_time = 86400; /* 24 hours... */
158 @@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
159 int wanted_ia_ta = 0;
160 int wanted_ia_pd = 0;
161 char *mockup_relay = NULL;
162 +int bootp_broadcast_always = 0;
164 +extern u_int32_t default_requested_options[];
166 void run_stateless(int exit_mode);
168 @@ -123,6 +132,15 @@ main(int argc, char **argv) {
169 int local_family_set = 0;
172 + char *dhcp_client_identifier_arg = NULL;
173 + char *dhcp_host_name_arg = NULL;
174 + char *dhcp_fqdn_arg = NULL;
175 + char *dhcp_vendor_class_identifier_arg = NULL;
176 + char *dhclient_request_options = NULL;
178 + int timeout_arg = 0;
179 + char *arg_conf = NULL;
180 + int arg_conf_len = 0;
182 /* Initialize client globals. */
183 memset(&default_duid, 0, sizeof(default_duid));
184 @@ -310,6 +328,88 @@ main(int argc, char **argv) {
185 } else if (!strcmp(argv[i], "--version")) {
186 log_info("isc-dhclient-%s", PACKAGE_VERSION);
188 + } else if (!strcmp(argv[i], "-I")) {
189 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
194 + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
195 + log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
199 + dhcp_client_identifier_arg = argv[i];
200 + } else if (!strcmp(argv[i], "-B")) {
201 + bootp_broadcast_always = 1;
202 + } else if (!strcmp(argv[i], "-H")) {
203 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
208 + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
209 + log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
213 + if (dhcp_host_name_arg != NULL) {
214 + log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
218 + dhcp_host_name_arg = argv[i];
219 + } else if (!strcmp(argv[i], "-F")) {
220 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
225 + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
226 + log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
230 + if (dhcp_fqdn_arg != NULL) {
231 + log_error("Only one -F <fqdn> argument can be specified");
235 + if (dhcp_host_name_arg != NULL) {
236 + log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
240 + dhcp_fqdn_arg = argv[i];
241 + } else if (!strcmp(argv[i], "-timeout")) {
242 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
247 + if ((timeout_arg = atoi(argv[i])) <= 0) {
248 + log_error("timeout option must be > 0 - bad value: %s",argv[i]);
251 + } else if (!strcmp(argv[i], "-V")) {
252 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
257 + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
258 + log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
262 + dhcp_vendor_class_identifier_arg = argv[i];
263 + } else if (!strcmp(argv[i], "-R")) {
264 + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
269 + dhclient_request_options = argv[i];
270 } else if (argv[i][0] == '-') {
272 } else if (interfaces_requested < 0) {
273 @@ -484,6 +584,156 @@ main(int argc, char **argv) {
274 /* Parse the dhclient.conf file. */
277 + /* Parse any extra command line configuration arguments: */
278 + if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
279 + arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
281 + if ((arg_conf == 0) || (arg_conf_len <= 0))
282 + log_fatal("Unable to send -I option dhcp-client-identifier");
285 + if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
286 + if (arg_conf == 0) {
287 + arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
289 + if ((arg_conf == 0) || (arg_conf_len <= 0))
290 + log_fatal("Unable to send -H option host-name");
292 + char *last_arg_conf = arg_conf;
294 + arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
296 + if ((arg_conf == 0) || (arg_conf_len <= 0))
297 + log_fatal("Unable to send -H option host-name");
299 + free(last_arg_conf);
303 + if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
304 + if (arg_conf == 0) {
305 + arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
307 + if ((arg_conf == 0) || (arg_conf_len <= 0))
308 + log_fatal("Unable to send -F option fqdn.fqdn");
310 + char *last_arg_conf = arg_conf;
312 + arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
314 + if ((arg_conf == 0) || (arg_conf_len <= 0))
315 + log_fatal("Unable to send -F option fqdn.fqdn");
317 + free(last_arg_conf);
322 + if (arg_conf == 0) {
323 + arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
325 + if ((arg_conf == 0) || (arg_conf_len <= 0))
326 + log_fatal("Unable to process -timeout timeout argument");
328 + char *last_arg_conf = arg_conf;
330 + arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
332 + if ((arg_conf == 0) || (arg_conf_len == 0))
333 + log_fatal("Unable to process -timeout timeout argument");
335 + free(last_arg_conf);
339 + if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
340 + if (arg_conf == 0) {
341 + arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
343 + if ((arg_conf == 0) || (arg_conf_len <= 0))
344 + log_fatal("Unable to send -V option vendor-class-identifier");
346 + char *last_arg_conf = arg_conf;
348 + arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
350 + if ((arg_conf == 0) || (arg_conf_len <= 0))
351 + log_fatal("Unable to send -V option vendor-class-identifier");
353 + free(last_arg_conf);
357 + if (dhclient_request_options != NULL) {
358 + if (arg_conf == 0) {
359 + arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
361 + if ((arg_conf == 0) || (arg_conf_len <= 0))
362 + log_fatal("Unable to parse -R <request options list> argument");
364 + char *last_arg_conf = arg_conf;
366 + arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
368 + if ((arg_conf == 0) || (arg_conf_len <= 0))
369 + log_fatal("Unable to parse -R <request options list> argument");
371 + free(last_arg_conf);
376 + if (arg_conf_len == 0)
377 + if ((arg_conf_len = strlen(arg_conf)) == 0)
378 + /* huh ? cannot happen ! */
379 + log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
381 + /* parse the extra dhclient.conf configuration arguments
382 + * into top level config: */
383 + struct parse *cfile = (struct parse *)0;
384 + const char *val = NULL;
387 + status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
389 + if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
390 + log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
391 + /* more detailed parse failures will be logged */
394 + token = peek_token(&val, (unsigned *)0, cfile);
395 + if (token == END_OF_FILE)
398 + parse_client_statement(cfile, (struct interface_info *)0, &top_level_config);
401 + if (cfile -> warnings_occurred)
402 + log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
406 + /* we just set the toplevel timeout, but per-client
407 + * timeouts may still be at defaults.
409 + for (ip=interfaces; ip; ip = ip->next) {
410 + if (ip->client->config->timeout == 60)
411 + ip->client->config->timeout = timeout_arg;
415 + if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
416 + for (ip=interfaces; ip; ip = ip->next) {
417 + if (ip->client->config->requested_options == default_requested_options)
418 + ip->client->config->requested_options = top_level_config.requested_options;
427 /* Parse the lease database. */
428 read_client_leases();
430 @@ -715,6 +965,10 @@ static void usage()
431 " [-s server-addr] [-cf config-file] "
433 " [-pf pid-file] [--no-pid] [-e VAR=val]\n"
434 + " [-I <dhcp-client-identifier>] [-B]\n"
435 + " [-H <host-name> | -F <fqdn.fqdn>] [-timeout <timeout>]\n"
436 + " [-V <vendor-class-identifier>]\n"
437 + " [-R <request option list>]\n"
438 " [-sf script-file] [interface]");
441 @@ -2421,7 +2675,8 @@ void make_discover (client, lease)
442 client -> packet.xid = random ();
443 client -> packet.secs = 0; /* filled in by send_discover. */
445 - if (can_receive_unicast_unconfigured (client -> interface))
446 + if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
447 + && can_receive_unicast_unconfigured(client->interface))
448 client -> packet.flags = 0;
450 client -> packet.flags = htons (BOOTP_BROADCAST);
451 @@ -2505,7 +2760,9 @@ void make_request (client, lease)
453 memset (&client -> packet.ciaddr, 0,
454 sizeof client -> packet.ciaddr);
455 - if (can_receive_unicast_unconfigured (client -> interface))
456 + if ((!(bootp_broadcast_always ||
457 + client ->config->bootp_broadcast_always)) &&
458 + can_receive_unicast_unconfigured (client -> interface))
459 client -> packet.flags = 0;
461 client -> packet.flags = htons (BOOTP_BROADCAST);
462 @@ -2567,7 +2824,8 @@ void make_decline (client, lease)
463 client -> packet.hops = 0;
464 client -> packet.xid = client -> xid;
465 client -> packet.secs = 0; /* Filled in by send_request. */
466 - if (can_receive_unicast_unconfigured (client -> interface))
467 + if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
468 + && can_receive_unicast_unconfigured (client->interface))
469 client -> packet.flags = 0;
471 client -> packet.flags = htons (BOOTP_BROADCAST);
472 diff -up dhcp-4.2.4-P2/common/conflex.c.options dhcp-4.2.4-P2/common/conflex.c
473 --- dhcp-4.2.4-P2/common/conflex.c.options 2012-08-28 04:13:03.000000000 +0200
474 +++ dhcp-4.2.4-P2/common/conflex.c 2012-09-26 10:34:27.142049876 +0200
475 @@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
477 if (!strcasecmp (atom + 1, "ound"))
479 + if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
480 + return BOOTP_BROADCAST_ALWAYS;
483 if (!strcasecmp(atom + 1, "ase"))
484 diff -up dhcp-4.2.4-P2/includes/dhcpd.h.options dhcp-4.2.4-P2/includes/dhcpd.h
485 --- dhcp-4.2.4-P2/includes/dhcpd.h.options 2012-08-28 04:13:22.000000000 +0200
486 +++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-09-26 10:34:27.143049865 +0200
487 @@ -1153,6 +1153,9 @@ struct client_config {
488 int do_forward_update; /* If nonzero, and if we have the
489 information we need, update the
490 A record for the address we get. */
492 + int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
493 + flag in requests */
496 /* Per-interface state used in the dhcp client... */
497 diff -up dhcp-4.2.4-P2/includes/dhctoken.h.options dhcp-4.2.4-P2/includes/dhctoken.h
498 --- dhcp-4.2.4-P2/includes/dhctoken.h.options 2012-08-28 04:13:03.000000000 +0200
499 +++ dhcp-4.2.4-P2/includes/dhctoken.h 2012-09-26 10:34:27.144049854 +0200
500 @@ -364,7 +364,8 @@ enum dhcp_token {
504 - TOKEN_INFINIBAND = 668
505 + TOKEN_INFINIBAND = 668,
506 + BOOTP_BROADCAST_ALWAYS = 669
509 #define is_identifier(x) ((x) >= FIRST_TOKEN && \