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