|
|
fad460 |
diff -up dhcp-4.2.1b1/client/dhclient.8.man dhcp-4.2.1b1/client/dhclient.8
|
|
|
fad460 |
--- dhcp-4.2.1b1/client/dhclient.8.man 2010-07-14 22:09:34.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.1b1/client/dhclient.8 2011-01-27 18:19:07.000000000 +0100
|
|
|
fad460 |
@@ -115,6 +115,33 @@ dhclient - Dynamic Host Configuration Pr
|
|
|
fad460 |
.B -w
|
|
|
fad460 |
]
|
|
|
fad460 |
[
|
|
|
fad460 |
+.B -B
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -I
|
|
|
fad460 |
+.I dhcp-client-identifier
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -H
|
|
|
fad460 |
+.I host-name
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -F
|
|
|
fad460 |
+.I fqdn.fqdn
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -V
|
|
|
fad460 |
+.I vendor-class-identifier
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -R
|
|
|
fad460 |
+.I request-option-list
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
+.B -timeout
|
|
|
fad460 |
+.I timeout
|
|
|
fad460 |
+]
|
|
|
fad460 |
+[
|
|
|
fad460 |
.B -v
|
|
|
fad460 |
]
|
|
|
fad460 |
[
|
|
|
fad460 |
@@ -264,6 +291,69 @@ not to exit when it doesn't find any suc
|
|
|
fad460 |
program can then be used to notify the client when a network interface
|
|
|
fad460 |
has been added or removed, so that the client can attempt to configure an IP
|
|
|
fad460 |
address on that interface.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-B
|
|
|
fad460 |
+Set the BOOTP broadcast flag in request packets so servers will always
|
|
|
fad460 |
+broadcast replies.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-I\ <dhcp-client-identifier>
|
|
|
fad460 |
+Specify the dhcp-client-identifier option to send to the DHCP server.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-H\ <host-name>
|
|
|
fad460 |
+Specify the host-name option to send to the DHCP server. The host-name
|
|
|
fad460 |
+string only contains the client's hostname prefix, to which the server will
|
|
|
fad460 |
+append the ddns-domainname or domain-name options, if any, to derive the
|
|
|
fad460 |
+fully qualified domain name of the client. The
|
|
|
fad460 |
+.B -H
|
|
|
fad460 |
+option cannot be used with the
|
|
|
fad460 |
+.B -F
|
|
|
fad460 |
+option.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-F\ <fqdn.fqdn>
|
|
|
fad460 |
+Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
|
|
|
fad460 |
+be used with the
|
|
|
fad460 |
+.B -H
|
|
|
fad460 |
+option. The fqdn.fqdn option must specify the complete domain name of the
|
|
|
fad460 |
+client host, which the server may use for dynamic DNS updates.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-V\ <vendor-class-identifier>
|
|
|
fad460 |
+Specify the vendor-class-identifier option to send to the DHCP server.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-R\ <option>[,<option>...]
|
|
|
fad460 |
+Specify the list of options the client is to request from the server. The
|
|
|
fad460 |
+option list must be a single string consisting of option names separated
|
|
|
fad460 |
+by at least one command and optional space characters. The default option
|
|
|
fad460 |
+list is:
|
|
|
fad460 |
+
|
|
|
fad460 |
+.BR
|
|
|
fad460 |
+ subnet-mask, broadcast-address, time-offset, routers,
|
|
|
fad460 |
+.BR
|
|
|
fad460 |
+ domain-search, domain-name, domain-name-servers, host-name,
|
|
|
fad460 |
+.BR
|
|
|
fad460 |
+ nis-domain, nis-servers, ntp-servers, interface-mtu
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.B -R
|
|
|
fad460 |
+option does not append options to the default request, it overrides the
|
|
|
fad460 |
+default request list. Keep this in mind if you want to request an
|
|
|
fad460 |
+additional option besides the default request list. You will have to
|
|
|
fad460 |
+specify all option names for the
|
|
|
fad460 |
+.B -R
|
|
|
fad460 |
+parameter.
|
|
|
fad460 |
+
|
|
|
fad460 |
+.TP
|
|
|
fad460 |
+.BI \-timeout\ <timeout>
|
|
|
fad460 |
+Specify the time after which
|
|
|
fad460 |
+.B dhclient
|
|
|
fad460 |
+will decide that no DHCP servers can be contacted when no responses have been
|
|
|
fad460 |
+received.
|
|
|
fad460 |
+
|
|
|
fad460 |
.TP
|
|
|
fad460 |
.BI \-n
|
|
|
fad460 |
Do not configure any interfaces. This is most likely to be useful in
|
|
|
fad460 |
diff -up dhcp-4.2.4-P2/client/clparse.c.options dhcp-4.2.4-P2/client/clparse.c
|
|
|
fad460 |
--- dhcp-4.2.4-P2/client/clparse.c.options 2012-08-24 21:11:21.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.4-P2/client/clparse.c 2012-09-26 10:34:27.140049896 +0200
|
|
|
fad460 |
@@ -154,6 +154,7 @@ isc_result_t read_client_conf ()
|
|
|
fad460 |
/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
|
|
|
fad460 |
*/
|
|
|
fad460 |
top_level_config.requested_lease = 7200;
|
|
|
fad460 |
+ top_level_config.bootp_broadcast_always = 0;
|
|
|
fad460 |
|
|
|
fad460 |
group_allocate (&top_level_config.on_receipt, MDL);
|
|
|
fad460 |
if (!top_level_config.on_receipt)
|
|
|
fad460 |
@@ -320,7 +321,8 @@ void read_client_leases ()
|
|
|
fad460 |
interface-declaration |
|
|
|
fad460 |
LEASE client-lease-statement |
|
|
|
fad460 |
ALIAS client-lease-statement |
|
|
|
fad460 |
- KEY key-definition */
|
|
|
fad460 |
+ KEY key-definition |
|
|
|
fad460 |
+ BOOTP_BROADCAST_ALWAYS */
|
|
|
fad460 |
|
|
|
fad460 |
void parse_client_statement (cfile, ip, config)
|
|
|
fad460 |
struct parse *cfile;
|
|
|
fad460 |
@@ -739,6 +741,12 @@ void parse_client_statement (cfile, ip,
|
|
|
fad460 |
parse_reject_statement (cfile, config);
|
|
|
fad460 |
return;
|
|
|
fad460 |
|
|
|
fad460 |
+ case BOOTP_BROADCAST_ALWAYS:
|
|
|
fad460 |
+ token = next_token(&val, (unsigned*)0, cfile);
|
|
|
fad460 |
+ config -> bootp_broadcast_always = 1;
|
|
|
fad460 |
+ parse_semi (cfile);
|
|
|
fad460 |
+ return;
|
|
|
fad460 |
+
|
|
|
fad460 |
default:
|
|
|
fad460 |
lose = 0;
|
|
|
fad460 |
stmt = (struct executable_statement *)0;
|
|
|
fad460 |
diff -up dhcp-4.2.4-P2/client/dhclient.c.options dhcp-4.2.4-P2/client/dhclient.c
|
|
|
fad460 |
--- dhcp-4.2.4-P2/client/dhclient.c.options 2012-08-28 04:13:03.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.4-P2/client/dhclient.c 2012-09-26 10:36:10.396967531 +0200
|
|
|
fad460 |
@@ -39,6 +39,12 @@
|
|
|
fad460 |
#include <limits.h>
|
|
|
fad460 |
#include <dns/result.h>
|
|
|
fad460 |
|
|
|
fad460 |
+/*
|
|
|
fad460 |
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
|
|
|
fad460 |
+ * that when building ISC code.
|
|
|
fad460 |
+ */
|
|
|
fad460 |
+extern int asprintf(char **strp, const char *fmt, ...);
|
|
|
fad460 |
+
|
|
|
fad460 |
TIME default_lease_time = 43200; /* 12 hours... */
|
|
|
fad460 |
TIME max_lease_time = 86400; /* 24 hours... */
|
|
|
fad460 |
|
|
|
fad460 |
@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
|
|
|
fad460 |
int wanted_ia_ta = 0;
|
|
|
fad460 |
int wanted_ia_pd = 0;
|
|
|
fad460 |
char *mockup_relay = NULL;
|
|
|
fad460 |
+int bootp_broadcast_always = 0;
|
|
|
fad460 |
+
|
|
|
fad460 |
+extern struct option *default_requested_options[];
|
|
|
fad460 |
|
|
|
fad460 |
void run_stateless(int exit_mode);
|
|
|
fad460 |
|
|
|
fad460 |
@@ -123,6 +132,15 @@ main(int argc, char **argv) {
|
|
|
fad460 |
int local_family_set = 0;
|
|
|
fad460 |
#endif /* DHCPv6 */
|
|
|
fad460 |
char *s;
|
|
|
fad460 |
+ char *dhcp_client_identifier_arg = NULL;
|
|
|
fad460 |
+ char *dhcp_host_name_arg = NULL;
|
|
|
fad460 |
+ char *dhcp_fqdn_arg = NULL;
|
|
|
fad460 |
+ char *dhcp_vendor_class_identifier_arg = NULL;
|
|
|
fad460 |
+ char *dhclient_request_options = NULL;
|
|
|
fad460 |
+
|
|
|
fad460 |
+ int timeout_arg = 0;
|
|
|
fad460 |
+ char *arg_conf = NULL;
|
|
|
fad460 |
+ int arg_conf_len = 0;
|
|
|
fad460 |
|
|
|
fad460 |
/* Initialize client globals. */
|
|
|
fad460 |
memset(&default_duid, 0, sizeof(default_duid));
|
|
|
fad460 |
@@ -310,6 +328,88 @@ main(int argc, char **argv) {
|
|
|
fad460 |
} else if (!strcmp(argv[i], "--version")) {
|
|
|
fad460 |
log_info("isc-dhclient-%s", PACKAGE_VERSION);
|
|
|
fad460 |
exit(0);
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-I")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
|
|
fad460 |
+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ dhcp_client_identifier_arg = argv[i];
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-B")) {
|
|
|
fad460 |
+ bootp_broadcast_always = 1;
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-H")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
|
|
fad460 |
+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (dhcp_host_name_arg != NULL) {
|
|
|
fad460 |
+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ dhcp_host_name_arg = argv[i];
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-F")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
|
|
fad460 |
+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (dhcp_fqdn_arg != NULL) {
|
|
|
fad460 |
+ log_error("Only one -F <fqdn> argument can be specified");
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (dhcp_host_name_arg != NULL) {
|
|
|
fad460 |
+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ dhcp_fqdn_arg = argv[i];
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-timeout")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((timeout_arg = atoi(argv[i])) <= 0) {
|
|
|
fad460 |
+ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-V")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
|
|
fad460 |
+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ dhcp_vendor_class_identifier_arg = argv[i];
|
|
|
fad460 |
+ } else if (!strcmp(argv[i], "-R")) {
|
|
|
fad460 |
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
|
|
fad460 |
+ usage();
|
|
|
fad460 |
+ exit(1);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ dhclient_request_options = argv[i];
|
|
|
fad460 |
} else if (argv[i][0] == '-') {
|
|
|
fad460 |
usage();
|
|
|
fad460 |
} else if (interfaces_requested < 0) {
|
|
|
fad460 |
@@ -484,6 +584,156 @@ main(int argc, char **argv) {
|
|
|
fad460 |
/* Parse the dhclient.conf file. */
|
|
|
fad460 |
read_client_conf();
|
|
|
fad460 |
|
|
|
fad460 |
+ /* Parse any extra command line configuration arguments: */
|
|
|
fad460 |
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -I option dhcp-client-identifier");
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
|
|
|
fad460 |
+ if (arg_conf == 0) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -H option host-name");
|
|
|
fad460 |
+ } else {
|
|
|
fad460 |
+ char *last_arg_conf = arg_conf;
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -H option host-name");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(last_arg_conf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
|
|
|
fad460 |
+ if (arg_conf == 0) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
|
|
fad460 |
+ } else {
|
|
|
fad460 |
+ char *last_arg_conf = arg_conf;
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(last_arg_conf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (timeout_arg) {
|
|
|
fad460 |
+ if (arg_conf == 0) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to process -timeout timeout argument");
|
|
|
fad460 |
+ } else {
|
|
|
fad460 |
+ char *last_arg_conf = arg_conf;
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len == 0))
|
|
|
fad460 |
+ log_fatal("Unable to process -timeout timeout argument");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(last_arg_conf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
|
|
|
fad460 |
+ if (arg_conf == 0) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
|
|
fad460 |
+ } else {
|
|
|
fad460 |
+ char *last_arg_conf = arg_conf;
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(last_arg_conf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (dhclient_request_options != NULL) {
|
|
|
fad460 |
+ if (arg_conf == 0) {
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to parse -R <request options list> argument");
|
|
|
fad460 |
+ } else {
|
|
|
fad460 |
+ char *last_arg_conf = arg_conf;
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
fad460 |
+ log_fatal("Unable to parse -R <request options list> argument");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(last_arg_conf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (arg_conf) {
|
|
|
fad460 |
+ if (arg_conf_len == 0)
|
|
|
fad460 |
+ if ((arg_conf_len = strlen(arg_conf)) == 0)
|
|
|
fad460 |
+ /* huh ? cannot happen ! */
|
|
|
fad460 |
+ log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
|
|
|
fad460 |
+
|
|
|
fad460 |
+ /* parse the extra dhclient.conf configuration arguments
|
|
|
fad460 |
+ * into top level config: */
|
|
|
fad460 |
+ struct parse *cfile = (struct parse *)0;
|
|
|
fad460 |
+ const char *val = NULL;
|
|
|
fad460 |
+ int token;
|
|
|
fad460 |
+
|
|
|
fad460 |
+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
|
|
|
fad460 |
+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
|
|
|
fad460 |
+ /* more detailed parse failures will be logged */
|
|
|
fad460 |
+
|
|
|
fad460 |
+ do {
|
|
|
fad460 |
+ token = peek_token(&val, (unsigned *)0, cfile);
|
|
|
fad460 |
+ if (token == END_OF_FILE)
|
|
|
fad460 |
+ break;
|
|
|
fad460 |
+
|
|
|
fad460 |
+ parse_client_statement(cfile, (struct interface_info *)0, &top_level_config);
|
|
|
fad460 |
+ } while (1);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (cfile -> warnings_occurred)
|
|
|
fad460 |
+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
|
|
|
fad460 |
+ end_parse(&cfile);
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (timeout_arg) {
|
|
|
fad460 |
+ /* we just set the toplevel timeout, but per-client
|
|
|
fad460 |
+ * timeouts may still be at defaults.
|
|
|
fad460 |
+ */
|
|
|
fad460 |
+ for (ip=interfaces; ip; ip = ip->next) {
|
|
|
fad460 |
+ if (ip->client->config->timeout == 60)
|
|
|
fad460 |
+ ip->client->config->timeout = timeout_arg;
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
|
|
|
fad460 |
+ for (ip=interfaces; ip; ip = ip->next) {
|
|
|
fad460 |
+ if (ip->client->config->requested_options == default_requested_options)
|
|
|
fad460 |
+ ip->client->config->requested_options = top_level_config.requested_options;
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
+ free(arg_conf);
|
|
|
fad460 |
+ arg_conf = NULL;
|
|
|
fad460 |
+ arg_conf_len = 0;
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
/* Parse the lease database. */
|
|
|
fad460 |
read_client_leases();
|
|
|
fad460 |
|
|
|
fad460 |
@@ -715,6 +965,10 @@ static void usage()
|
|
|
fad460 |
" [-s server-addr] [-cf config-file] "
|
|
|
fad460 |
"[-lf lease-file]\n"
|
|
|
fad460 |
" [-pf pid-file] [--no-pid] [-e VAR=val]\n"
|
|
|
fad460 |
+ " [-I <dhcp-client-identifier>] [-B]\n"
|
|
|
fad460 |
+ " [-H <host-name> | -F <fqdn.fqdn>] [-timeout <timeout>]\n"
|
|
|
fad460 |
+ " [-V <vendor-class-identifier>]\n"
|
|
|
fad460 |
+ " [-R <request option list>]\n"
|
|
|
fad460 |
" [-sf script-file] [interface]");
|
|
|
fad460 |
}
|
|
|
fad460 |
|
|
|
fad460 |
@@ -2421,7 +2675,8 @@ void make_discover (client, lease)
|
|
|
fad460 |
client -> packet.xid = random ();
|
|
|
fad460 |
client -> packet.secs = 0; /* filled in by send_discover. */
|
|
|
fad460 |
|
|
|
fad460 |
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
fad460 |
+ if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
|
|
|
fad460 |
+ && can_receive_unicast_unconfigured(client->interface))
|
|
|
fad460 |
client -> packet.flags = 0;
|
|
|
fad460 |
else
|
|
|
fad460 |
client -> packet.flags = htons (BOOTP_BROADCAST);
|
|
|
fad460 |
@@ -2505,7 +2760,9 @@ void make_request (client, lease)
|
|
|
fad460 |
} else {
|
|
|
fad460 |
memset (&client -> packet.ciaddr, 0,
|
|
|
fad460 |
sizeof client -> packet.ciaddr);
|
|
|
fad460 |
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
fad460 |
+ if ((!(bootp_broadcast_always ||
|
|
|
fad460 |
+ client ->config->bootp_broadcast_always)) &&
|
|
|
fad460 |
+ can_receive_unicast_unconfigured (client -> interface))
|
|
|
fad460 |
client -> packet.flags = 0;
|
|
|
fad460 |
else
|
|
|
fad460 |
client -> packet.flags = htons (BOOTP_BROADCAST);
|
|
|
fad460 |
@@ -2567,7 +2824,8 @@ void make_decline (client, lease)
|
|
|
fad460 |
client -> packet.hops = 0;
|
|
|
fad460 |
client -> packet.xid = client -> xid;
|
|
|
fad460 |
client -> packet.secs = 0; /* Filled in by send_request. */
|
|
|
fad460 |
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
fad460 |
+ if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
|
|
|
fad460 |
+ && can_receive_unicast_unconfigured (client->interface))
|
|
|
fad460 |
client -> packet.flags = 0;
|
|
|
fad460 |
else
|
|
|
fad460 |
client -> packet.flags = htons (BOOTP_BROADCAST);
|
|
|
fad460 |
diff -up dhcp-4.2.4-P2/common/conflex.c.options dhcp-4.2.4-P2/common/conflex.c
|
|
|
fad460 |
--- dhcp-4.2.4-P2/common/conflex.c.options 2012-08-28 04:13:03.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.4-P2/common/conflex.c 2012-09-26 10:34:27.142049876 +0200
|
|
|
fad460 |
@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
|
|
|
fad460 |
return BALANCE;
|
|
|
fad460 |
if (!strcasecmp (atom + 1, "ound"))
|
|
|
fad460 |
return BOUND;
|
|
|
fad460 |
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
|
|
|
fad460 |
+ return BOOTP_BROADCAST_ALWAYS;
|
|
|
fad460 |
break;
|
|
|
fad460 |
case 'c':
|
|
|
fad460 |
if (!strcasecmp(atom + 1, "ase"))
|
|
|
fad460 |
diff -up dhcp-4.2.4-P2/includes/dhcpd.h.options dhcp-4.2.4-P2/includes/dhcpd.h
|
|
|
fad460 |
--- dhcp-4.2.4-P2/includes/dhcpd.h.options 2012-08-28 04:13:22.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-09-26 10:34:27.143049865 +0200
|
|
|
fad460 |
@@ -1153,6 +1153,9 @@ struct client_config {
|
|
|
fad460 |
int do_forward_update; /* If nonzero, and if we have the
|
|
|
fad460 |
information we need, update the
|
|
|
fad460 |
A record for the address we get. */
|
|
|
fad460 |
+
|
|
|
fad460 |
+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
|
|
|
fad460 |
+ flag in requests */
|
|
|
fad460 |
};
|
|
|
fad460 |
|
|
|
fad460 |
/* Per-interface state used in the dhcp client... */
|
|
|
fad460 |
diff -up dhcp-4.2.4-P2/includes/dhctoken.h.options dhcp-4.2.4-P2/includes/dhctoken.h
|
|
|
fad460 |
--- dhcp-4.2.4-P2/includes/dhctoken.h.options 2012-08-28 04:13:03.000000000 +0200
|
|
|
fad460 |
+++ dhcp-4.2.4-P2/includes/dhctoken.h 2012-09-26 10:34:27.144049854 +0200
|
|
|
fad460 |
@@ -364,7 +364,8 @@ enum dhcp_token {
|
|
|
fad460 |
GETHOSTBYNAME = 665,
|
|
|
fad460 |
PRIMARY6 = 666,
|
|
|
fad460 |
SECONDARY6 = 667,
|
|
|
fad460 |
- TOKEN_INFINIBAND = 668
|
|
|
fad460 |
+ TOKEN_INFINIBAND = 668,
|
|
|
fad460 |
+ BOOTP_BROADCAST_ALWAYS = 669
|
|
|
fad460 |
};
|
|
|
fad460 |
|
|
|
fad460 |
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
|