2012-04-17 09:46:32 +00:00
|
|
|
diff -up dhcp-4.2.4b1/client/clparse.c.options dhcp-4.2.4b1/client/clparse.c
|
|
|
|
--- dhcp-4.2.4b1/client/clparse.c.options 2012-03-09 12:28:10.000000000 +0100
|
|
|
|
+++ dhcp-4.2.4b1/client/clparse.c 2012-04-16 17:24:58.794047046 +0200
|
|
|
|
@@ -154,6 +154,7 @@ isc_result_t read_client_conf ()
|
2009-01-06 23:50:29 +00:00
|
|
|
/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
|
|
|
|
*/
|
|
|
|
top_level_config.requested_lease = 7200;
|
|
|
|
+ top_level_config.bootp_broadcast_always = 0;
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2009-01-06 23:50:29 +00:00
|
|
|
group_allocate (&top_level_config.on_receipt, MDL);
|
|
|
|
if (!top_level_config.on_receipt)
|
2012-04-17 09:46:32 +00:00
|
|
|
@@ -320,7 +321,8 @@ void read_client_leases ()
|
2009-01-06 23:50:29 +00:00
|
|
|
interface-declaration |
|
|
|
|
LEASE client-lease-statement |
|
|
|
|
ALIAS client-lease-statement |
|
|
|
|
- KEY key-definition */
|
|
|
|
+ KEY key-definition |
|
|
|
|
+ BOOTP_BROADCAST_ALWAYS */
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2009-01-06 23:50:29 +00:00
|
|
|
void parse_client_statement (cfile, ip, config)
|
|
|
|
struct parse *cfile;
|
2012-04-17 09:46:32 +00:00
|
|
|
@@ -739,6 +741,12 @@ void parse_client_statement (cfile, ip,
|
2009-01-06 23:50:29 +00:00
|
|
|
parse_reject_statement (cfile, config);
|
|
|
|
return;
|
|
|
|
|
|
|
|
+ case BOOTP_BROADCAST_ALWAYS:
|
|
|
|
+ token = next_token(&val, (unsigned*)0, cfile);
|
|
|
|
+ config -> bootp_broadcast_always = 1;
|
|
|
|
+ parse_semi (cfile);
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
default:
|
|
|
|
lose = 0;
|
|
|
|
stmt = (struct executable_statement *)0;
|
2012-04-17 09:46:32 +00:00
|
|
|
diff -up dhcp-4.2.4b1/client/dhclient.c.options dhcp-4.2.4b1/client/dhclient.c
|
|
|
|
--- dhcp-4.2.4b1/client/dhclient.c.options 2012-04-11 22:43:24.000000000 +0200
|
|
|
|
+++ dhcp-4.2.4b1/client/dhclient.c 2012-04-16 17:24:58.795047032 +0200
|
2010-07-21 16:56:35 +00:00
|
|
|
@@ -39,6 +39,12 @@
|
2008-01-13 21:02:47 +00:00
|
|
|
#include <limits.h>
|
2010-07-21 16:56:35 +00:00
|
|
|
#include <dns/result.h>
|
2008-01-11 00:16:44 +00:00
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
|
|
|
|
+ * that when building ISC code.
|
|
|
|
+ */
|
|
|
|
+extern int asprintf(char **strp, const char *fmt, ...);
|
|
|
|
+
|
|
|
|
TIME default_lease_time = 43200; /* 12 hours... */
|
|
|
|
TIME max_lease_time = 86400; /* 24 hours... */
|
|
|
|
|
2011-10-18 17:13:08 +00:00
|
|
|
@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
|
2009-01-06 23:50:29 +00:00
|
|
|
int wanted_ia_ta = 0;
|
|
|
|
int wanted_ia_pd = 0;
|
2008-01-13 21:02:47 +00:00
|
|
|
char *mockup_relay = NULL;
|
2008-01-11 00:16:44 +00:00
|
|
|
+int bootp_broadcast_always = 0;
|
|
|
|
+
|
|
|
|
+extern u_int32_t default_requested_options[];
|
|
|
|
|
2009-01-06 23:50:29 +00:00
|
|
|
void run_stateless(int exit_mode);
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2011-07-01 12:42:18 +00:00
|
|
|
@@ -123,6 +132,15 @@ main(int argc, char **argv) {
|
2008-01-13 21:02:47 +00:00
|
|
|
int local_family_set = 0;
|
2009-01-06 23:50:29 +00:00
|
|
|
#endif /* DHCPv6 */
|
2008-01-11 00:16:44 +00:00
|
|
|
char *s;
|
|
|
|
+ char *dhcp_client_identifier_arg = NULL;
|
|
|
|
+ char *dhcp_host_name_arg = NULL;
|
|
|
|
+ char *dhcp_fqdn_arg = NULL;
|
|
|
|
+ char *dhcp_vendor_class_identifier_arg = NULL;
|
|
|
|
+ char *dhclient_request_options = NULL;
|
|
|
|
+
|
|
|
|
+ int timeout_arg = 0;
|
|
|
|
+ char *arg_conf = NULL;
|
|
|
|
+ int arg_conf_len = 0;
|
|
|
|
|
2008-01-13 21:02:47 +00:00
|
|
|
/* Initialize client globals. */
|
|
|
|
memset(&default_duid, 0, sizeof(default_duid));
|
2011-07-01 12:42:18 +00:00
|
|
|
@@ -310,6 +328,88 @@ main(int argc, char **argv) {
|
2009-01-06 23:50:29 +00:00
|
|
|
} else if (!strcmp(argv[i], "--version")) {
|
|
|
|
log_info("isc-dhclient-%s", PACKAGE_VERSION);
|
|
|
|
exit(0);
|
|
|
|
+ } else if (!strcmp(argv[i], "-I")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
2008-01-13 21:02:47 +00:00
|
|
|
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dhcp_client_identifier_arg = argv[i];
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-B")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ bootp_broadcast_always = 1;
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-H")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
2008-01-13 21:02:47 +00:00
|
|
|
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dhcp_host_name_arg != NULL) {
|
|
|
|
+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dhcp_host_name_arg = argv[i];
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-F")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
2008-01-13 21:02:47 +00:00
|
|
|
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dhcp_fqdn_arg != NULL) {
|
|
|
|
+ log_error("Only one -F <fqdn> argument can be specified");
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dhcp_host_name_arg != NULL) {
|
|
|
|
+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dhcp_fqdn_arg = argv[i];
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-timeout")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((timeout_arg = atoi(argv[i])) <= 0) {
|
2012-02-13 17:46:33 +00:00
|
|
|
+ log_error("timeout option must be > 0 - bad value: %s",argv[i]);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-V")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
2008-01-13 21:02:47 +00:00
|
|
|
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dhcp_vendor_class_identifier_arg = argv[i];
|
2009-01-06 23:50:29 +00:00
|
|
|
+ } else if (!strcmp(argv[i], "-R")) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ usage();
|
|
|
|
+ exit(1);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ }
|
|
|
|
+
|
2009-01-06 23:50:29 +00:00
|
|
|
+ dhclient_request_options = argv[i];
|
|
|
|
} else if (argv[i][0] == '-') {
|
|
|
|
usage();
|
|
|
|
} else if (interfaces_requested < 0) {
|
2012-02-13 17:46:33 +00:00
|
|
|
@@ -484,6 +584,156 @@ main(int argc, char **argv) {
|
2008-01-11 00:16:44 +00:00
|
|
|
/* Parse the dhclient.conf file. */
|
2009-01-06 23:50:29 +00:00
|
|
|
read_client_conf();
|
2008-01-11 00:16:44 +00:00
|
|
|
|
|
|
|
+ /* Parse any extra command line configuration arguments: */
|
|
|
|
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -I option dhcp-client-identifier");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
|
|
|
|
+ if (arg_conf == 0) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -H option host-name");
|
|
|
|
+ } else {
|
|
|
|
+ char *last_arg_conf = arg_conf;
|
|
|
|
+ arg_conf = NULL;
|
2009-01-06 23:50:29 +00:00
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -H option host-name");
|
|
|
|
+
|
|
|
|
+ free(last_arg_conf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
|
|
|
|
+ if (arg_conf == 0) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
|
|
|
+ } else {
|
|
|
|
+ char *last_arg_conf = arg_conf;
|
|
|
|
+ arg_conf = NULL;
|
2009-01-06 23:50:29 +00:00
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
|
|
|
+
|
|
|
|
+ free(last_arg_conf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (timeout_arg) {
|
|
|
|
+ if (arg_conf == 0) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_fatal("Unable to process -timeout timeout argument");
|
2008-01-11 00:16:44 +00:00
|
|
|
+ } else {
|
|
|
|
+ char *last_arg_conf = arg_conf;
|
|
|
|
+ arg_conf = NULL;
|
2009-01-06 23:50:29 +00:00
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len == 0))
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_fatal("Unable to process -timeout timeout argument");
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ free(last_arg_conf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
|
|
|
|
+ if (arg_conf == 0) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
|
|
|
+ } else {
|
|
|
|
+ char *last_arg_conf = arg_conf;
|
|
|
|
+ arg_conf = NULL;
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
|
|
|
+
|
|
|
|
+ free(last_arg_conf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dhclient_request_options != NULL) {
|
|
|
|
+ if (arg_conf == 0) {
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to parse -R <request options list> argument");
|
|
|
|
+ } else {
|
|
|
|
+ char *last_arg_conf = arg_conf;
|
|
|
|
+ arg_conf = NULL;
|
|
|
|
+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
|
|
|
|
+
|
|
|
|
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
|
|
|
+ log_fatal("Unable to parse -R <request options list> argument");
|
|
|
|
+
|
|
|
|
+ free(last_arg_conf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (arg_conf) {
|
|
|
|
+ if (arg_conf_len == 0)
|
|
|
|
+ if ((arg_conf_len = strlen(arg_conf)) == 0)
|
|
|
|
+ /* huh ? cannot happen ! */
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ /* parse the extra dhclient.conf configuration arguments
|
|
|
|
+ * into top level config: */
|
|
|
|
+ struct parse *cfile = (struct parse *)0;
|
|
|
|
+ const char *val = NULL;
|
|
|
|
+ int token;
|
|
|
|
+
|
2009-01-06 23:50:29 +00:00
|
|
|
+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
|
2008-01-11 00:16:44 +00:00
|
|
|
+ /* more detailed parse failures will be logged */
|
|
|
|
+
|
|
|
|
+ do {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ token = peek_token(&val, (unsigned *)0, cfile);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if (token == END_OF_FILE)
|
|
|
|
+ break;
|
|
|
|
+
|
2009-01-06 23:50:29 +00:00
|
|
|
+ parse_client_statement(cfile, (struct interface_info *)0, &top_level_config);
|
2008-01-11 00:16:44 +00:00
|
|
|
+ } while (1);
|
|
|
|
+
|
|
|
|
+ if (cfile -> warnings_occurred)
|
2009-01-06 23:50:29 +00:00
|
|
|
+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
|
|
|
|
+ end_parse(&cfile);
|
2008-01-11 00:16:44 +00:00
|
|
|
+
|
|
|
|
+ if (timeout_arg) {
|
|
|
|
+ /* we just set the toplevel timeout, but per-client
|
2012-02-13 17:46:33 +00:00
|
|
|
+ * timeouts may still be at defaults.
|
2008-01-11 00:16:44 +00:00
|
|
|
+ */
|
2009-01-06 23:50:29 +00:00
|
|
|
+ for (ip=interfaces; ip; ip = ip->next) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if (ip->client->config->timeout == 60)
|
|
|
|
+ ip->client->config->timeout = timeout_arg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
|
2009-01-06 23:50:29 +00:00
|
|
|
+ for (ip=interfaces; ip; ip = ip->next) {
|
2008-01-11 00:16:44 +00:00
|
|
|
+ if (ip->client->config->requested_options == default_requested_options)
|
|
|
|
+ ip->client->config->requested_options = top_level_config.requested_options;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ free(arg_conf);
|
|
|
|
+ arg_conf = NULL;
|
|
|
|
+ arg_conf_len = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
/* Parse the lease database. */
|
2009-01-06 23:50:29 +00:00
|
|
|
read_client_leases();
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2012-04-17 09:46:32 +00:00
|
|
|
@@ -2421,7 +2671,8 @@ void make_discover (client, lease)
|
2008-01-11 00:16:44 +00:00
|
|
|
client -> packet.xid = random ();
|
|
|
|
client -> packet.secs = 0; /* filled in by send_discover. */
|
|
|
|
|
|
|
|
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
|
+ if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
|
|
|
|
+ && can_receive_unicast_unconfigured(client->interface))
|
|
|
|
client -> packet.flags = 0;
|
|
|
|
else
|
|
|
|
client -> packet.flags = htons (BOOTP_BROADCAST);
|
2012-04-17 09:46:32 +00:00
|
|
|
@@ -2505,7 +2756,9 @@ void make_request (client, lease)
|
2008-01-11 00:16:44 +00:00
|
|
|
} else {
|
|
|
|
memset (&client -> packet.ciaddr, 0,
|
|
|
|
sizeof client -> packet.ciaddr);
|
|
|
|
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
|
+ if ((!(bootp_broadcast_always ||
|
|
|
|
+ client ->config->bootp_broadcast_always)) &&
|
|
|
|
+ can_receive_unicast_unconfigured (client -> interface))
|
|
|
|
client -> packet.flags = 0;
|
|
|
|
else
|
|
|
|
client -> packet.flags = htons (BOOTP_BROADCAST);
|
2012-04-17 09:46:32 +00:00
|
|
|
@@ -2567,7 +2820,8 @@ void make_decline (client, lease)
|
2008-01-11 00:16:44 +00:00
|
|
|
client -> packet.hops = 0;
|
|
|
|
client -> packet.xid = client -> xid;
|
|
|
|
client -> packet.secs = 0; /* Filled in by send_request. */
|
|
|
|
- if (can_receive_unicast_unconfigured (client -> interface))
|
|
|
|
+ if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
|
|
|
|
+ && can_receive_unicast_unconfigured (client->interface))
|
|
|
|
client -> packet.flags = 0;
|
|
|
|
else
|
|
|
|
client -> packet.flags = htons (BOOTP_BROADCAST);
|
2012-04-17 09:46:32 +00:00
|
|
|
diff -up dhcp-4.2.4b1/common/conflex.c.options dhcp-4.2.4b1/common/conflex.c
|
|
|
|
--- dhcp-4.2.4b1/common/conflex.c.options 2012-02-16 22:09:14.000000000 +0100
|
|
|
|
+++ dhcp-4.2.4b1/common/conflex.c 2012-04-16 17:24:58.796047018 +0200
|
2011-10-18 17:13:08 +00:00
|
|
|
@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
|
2009-01-06 23:50:29 +00:00
|
|
|
return BALANCE;
|
|
|
|
if (!strcasecmp (atom + 1, "ound"))
|
|
|
|
return BOUND;
|
|
|
|
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
|
|
|
|
+ return BOOTP_BROADCAST_ALWAYS;
|
|
|
|
break;
|
|
|
|
case 'c':
|
2010-01-20 17:07:47 +00:00
|
|
|
if (!strcasecmp(atom + 1, "ase"))
|
2012-04-17 09:46:32 +00:00
|
|
|
diff -up dhcp-4.2.4b1/includes/dhcpd.h.options dhcp-4.2.4b1/includes/dhcpd.h
|
|
|
|
--- dhcp-4.2.4b1/includes/dhcpd.h.options 2012-04-10 02:55:06.000000000 +0200
|
|
|
|
+++ dhcp-4.2.4b1/includes/dhcpd.h 2012-04-16 17:24:58.797047004 +0200
|
2011-07-01 12:42:18 +00:00
|
|
|
@@ -1147,6 +1147,9 @@ struct client_config {
|
2009-01-06 23:50:29 +00:00
|
|
|
int do_forward_update; /* If nonzero, and if we have the
|
|
|
|
information we need, update the
|
|
|
|
A record for the address we get. */
|
|
|
|
+
|
|
|
|
+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
|
|
|
|
+ flag in requests */
|
|
|
|
};
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2009-01-06 23:50:29 +00:00
|
|
|
/* Per-interface state used in the dhcp client... */
|
2012-04-17 09:46:32 +00:00
|
|
|
diff -up dhcp-4.2.4b1/includes/dhctoken.h.options dhcp-4.2.4b1/includes/dhctoken.h
|
|
|
|
--- dhcp-4.2.4b1/includes/dhctoken.h.options 2012-02-16 22:09:15.000000000 +0100
|
|
|
|
+++ dhcp-4.2.4b1/includes/dhctoken.h 2012-04-16 17:25:53.819276248 +0200
|
|
|
|
@@ -364,7 +364,8 @@ enum dhcp_token {
|
2011-10-18 17:13:08 +00:00
|
|
|
GETHOSTBYNAME = 665,
|
|
|
|
PRIMARY6 = 666,
|
2012-04-17 09:46:32 +00:00
|
|
|
SECONDARY6 = 667,
|
|
|
|
- TOKEN_INFINIBAND = 668
|
|
|
|
+ TOKEN_INFINIBAND = 668,
|
|
|
|
+ BOOTP_BROADCAST_ALWAYS = 669
|
2009-01-06 23:50:29 +00:00
|
|
|
};
|
2008-01-11 00:16:44 +00:00
|
|
|
|
2010-07-21 16:56:35 +00:00
|
|
|
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
|