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