-diff -up dhcp-4.2.1b1/client/dhclient.8.man dhcp-4.2.1b1/client/dhclient.8
---- dhcp-4.2.1b1/client/dhclient.8.man 2010-07-14 22:09:34.000000000 +0200
-+++ dhcp-4.2.1b1/client/dhclient.8 2011-01-27 18:19:07.000000000 +0100
-@@ -115,6 +115,33 @@ dhclient - Dynamic Host Configuration Pr
+From af18c830fe55f6be0b89997a36b611d981e3c25d Mon Sep 17 00:00:00 2001
+From: Pavel Zhukov <pzhukov@redhat.com>
+Date: Thu, 21 Feb 2019 10:19:47 +0100
+Subject: [PATCH 02/28] additional dhclient options
+
+---
+ client/clparse.c | 10 +-
+ client/dhclient.8 | 27 +++++
+ client/dhclient.c | 271 +++++++++++++++++++++++++++++++++++++++++++-
+ common/conflex.c | 2 +
+ includes/dhcpd.h | 3 +
+ includes/dhctoken.h | 3 +-
+ 6 files changed, 309 insertions(+), 7 deletions(-)
+
+diff --git a/client/clparse.c b/client/clparse.c
+index 74ca499..bb63825 100644
+--- a/client/clparse.c
++++ b/client/clparse.c
+@@ -192,6 +192,7 @@ isc_result_t read_client_conf ()
+ /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
+ */
+ top_level_config.requested_lease = 7200;
++ top_level_config.bootp_broadcast_always = 0;
+
+ group_allocate (&top_level_config.on_receipt, MDL);
+ if (!top_level_config.on_receipt)
+@@ -397,7 +398,8 @@ void read_client_leases ()
+ interface-declaration |
+ LEASE client-lease-statement |
+ ALIAS client-lease-statement |
+- KEY key-definition */
++ KEY key-definition |
++ BOOTP_BROADCAST_ALWAYS */
+
+ void parse_client_statement (cfile, ip, config)
+ struct parse *cfile;
+@@ -820,6 +822,12 @@ void parse_client_statement (cfile, ip, config)
+ parse_lease_id_format(cfile);
+ break;
+
++ case BOOTP_BROADCAST_ALWAYS:
++ token = next_token(&val, (unsigned*)0, cfile);
++ config -> bootp_broadcast_always = 1;
++ parse_semi (cfile);
++ return;
++
+
+ default:
+ lose = 0;
+diff --git a/client/dhclient.8 b/client/dhclient.8
+index 861ff56..5029dac 100644
+--- a/client/dhclient.8
++++ b/client/dhclient.8
+@@ -135,6 +135,33 @@ dhclient - Dynamic Host Configuration Protocol Client
.B -w
]
[
+.B -B
+]
+[
-+.B -I
++.B -C
+.I dhcp-client-identifier
+]
+[
+.I vendor-class-identifier
+]
+[
-+.B -R
++.B --request-options
+.I request-option-list
+]
+[
-+.B -timeout
++.B --timeout
+.I timeout
+]
+[
- .B -v
+ .B --dad-wait-time
+ .I seconds
]
- [
-@@ -264,6 +291,69 @@ not to exit when it doesn't find any suc
- program can then be used to notify the client when a network interface
- has been added or removed, so that the client can attempt to configure an IP
- address on that interface.
-+
-+.TP
-+.BI \-B
-+Set the BOOTP broadcast flag in request packets so servers will always
-+broadcast replies.
-+
-+.TP
-+.BI \-I\ <dhcp-client-identifier>
-+Specify the dhcp-client-identifier option to send to the DHCP server.
-+
-+.TP
-+.BI \-H\ <host-name>
-+Specify the host-name option to send to the DHCP server. The host-name
-+string only contains the client's hostname prefix, to which the server will
-+append the ddns-domainname or domain-name options, if any, to derive the
-+fully qualified domain name of the client. The
-+.B -H
-+option cannot be used with the
-+.B -F
-+option.
-+
-+.TP
-+.BI \-F\ <fqdn.fqdn>
-+Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
-+be used with the
-+.B -H
-+option. The fqdn.fqdn option must specify the complete domain name of the
-+client host, which the server may use for dynamic DNS updates.
-+
-+.TP
-+.BI \-V\ <vendor-class-identifier>
-+Specify the vendor-class-identifier option to send to the DHCP server.
-+
-+.TP
-+.BI \-R\ <option>[,<option>...]
-+Specify the list of options the client is to request from the server. The
-+option list must be a single string consisting of option names separated
-+by at least one command and optional space characters. The default option
-+list is:
-+
-+.BR
-+ subnet-mask, broadcast-address, time-offset, routers,
-+.BR
-+ domain-search, domain-name, domain-name-servers, host-name,
-+.BR
-+ nis-domain, nis-servers, ntp-servers, interface-mtu
-+
-+.TP
-+.B -R
-+option does not append options to the default request, it overrides the
-+default request list. Keep this in mind if you want to request an
-+additional option besides the default request list. You will have to
-+specify all option names for the
-+.B -R
-+parameter.
-+
-+.TP
-+.BI \-timeout\ <timeout>
-+Specify the time after which
-+.B dhclient
-+will decide that no DHCP servers can be contacted when no responses have been
-+received.
-+
- .TP
- .BI \-n
- Do not configure any interfaces. This is most likely to be useful in
-diff -up dhcp-4.2.4-P2/client/clparse.c.options dhcp-4.2.4-P2/client/clparse.c
---- dhcp-4.2.4-P2/client/clparse.c.options 2012-08-24 21:11:21.000000000 +0200
-+++ dhcp-4.2.4-P2/client/clparse.c 2012-09-26 10:34:27.140049896 +0200
-@@ -154,6 +154,7 @@ isc_result_t read_client_conf ()
- /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
- */
- top_level_config.requested_lease = 7200;
-+ top_level_config.bootp_broadcast_always = 0;
-
- group_allocate (&top_level_config.on_receipt, MDL);
- if (!top_level_config.on_receipt)
-@@ -320,7 +321,8 @@ void read_client_leases ()
- interface-declaration |
- LEASE client-lease-statement |
- ALIAS client-lease-statement |
-- KEY key-definition */
-+ KEY key-definition |
-+ BOOTP_BROADCAST_ALWAYS */
-
- void parse_client_statement (cfile, ip, config)
- struct parse *cfile;
-@@ -739,6 +741,12 @@ void parse_client_statement (cfile, ip,
- 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;
-diff -up dhcp-4.2.4-P2/client/dhclient.c.options dhcp-4.2.4-P2/client/dhclient.c
---- dhcp-4.2.4-P2/client/dhclient.c.options 2012-08-28 04:13:03.000000000 +0200
-+++ dhcp-4.2.4-P2/client/dhclient.c 2012-09-26 10:36:10.396967531 +0200
-@@ -39,6 +39,12 @@
+diff --git a/client/dhclient.c b/client/dhclient.c
+index 46dc3a7..6c1c09a 100644
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -41,6 +41,12 @@
+ #include <sys/wait.h>
#include <limits.h>
- #include <dns/result.h>
+/*
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */
-@@ -87,6 +93,9 @@ int wanted_ia_na = -1; /* the absolute
- int wanted_ia_ta = 0;
- int wanted_ia_pd = 0;
- char *mockup_relay = NULL;
+@@ -113,6 +119,10 @@ char *mockup_relay = NULL;
+
+ char *progname = NULL;
+
+int bootp_broadcast_always = 0;
+
-+extern u_int32_t default_requested_options[];
++extern struct option *default_requested_options[];
++
+ void run_stateless(int exit_mode, u_int16_t port);
- void run_stateless(int exit_mode);
+ static isc_result_t write_duid(struct data_string *duid);
+@@ -189,8 +199,12 @@ static const char use_v6command[] = "Command not used for DHCPv4: %s";
+ " [-s server-addr] [-cf config-file]\n" \
+ " [-df duid-file] [-lf lease-file]\n" \
+ " [-pf pid-file] [--no-pid] [-e VAR=val]\n" \
+-" [-sf script-file] [interface]*"
+-
++" [-sf script-file] [interface]*\n" \
++" [-C <dhcp-client-identifier>] [-B]\n" \
++" [-H <host-name> | -F <fqdn.fqdn>] [--timeout <timeout>]\n" \
++" [-V <vendor-class-identifier>]\n" \
++" [--request-options <request option list>]"
++
+ #define DHCLIENT_USAGEH "{--version|--help|-h}"
-@@ -123,6 +132,15 @@ main(int argc, char **argv) {
- int local_family_set = 0;
- #endif /* DHCPv6 */
- char *s;
-+ char *dhcp_client_identifier_arg = NULL;
-+ char *dhcp_host_name_arg = NULL;
+ static void
+@@ -249,6 +263,16 @@ main(int argc, char **argv) {
+ #else
+ progname = argv[0];
+ #endif
++ 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;
-
++
/* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid));
-@@ -310,6 +328,88 @@ main(int argc, char **argv) {
- } else if (!strcmp(argv[i], "--version")) {
- log_info("isc-dhclient-%s", PACKAGE_VERSION);
- exit(0);
-+ } else if (!strcmp(argv[i], "-I")) {
+
+@@ -564,6 +588,89 @@ main(int argc, char **argv) {
+ std_dhcid = 1;
+ } else if (!strcmp(argv[i], "-v")) {
+ quiet = 0;
++ } else if (!strcmp(argv[i], "-C")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
-+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
++ log_error("-C option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
+ bootp_broadcast_always = 1;
+ } else if (!strcmp(argv[i], "-H")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ dhcp_host_name_arg = argv[i];
+ } else if (!strcmp(argv[i], "-F")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ }
+
+ dhcp_fqdn_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-timeout")) {
++ } else if (!strcmp(argv[i], "--timeout")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ }
+ } else if (!strcmp(argv[i], "-V")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ }
+
+ dhcp_vendor_class_identifier_arg = argv[i];
-+ } else if (!strcmp(argv[i], "-R")) {
++ } else if (!strcmp(argv[i], "--request-options")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
-+ usage();
++ usage(use_noarg, argv[i-1]);
+ exit(1);
+ }
+
+ dhclient_request_options = argv[i];
++
} else if (argv[i][0] == '-') {
- usage();
+ usage("Unknown command: %s", argv[i]);
} else if (interfaces_requested < 0) {
-@@ -484,6 +584,156 @@ main(int argc, char **argv) {
+@@ -760,6 +867,156 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf();
+ 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");
++ log_fatal("Unable to send -C option dhcp-client-identifier");
+ }
+
+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
-+ log_fatal("Unable to process -timeout timeout argument");
++ log_fatal("Unable to process --timeout timeout argument");
+ } else {
+ char *last_arg_conf = arg_conf;
+ arg_conf = NULL;
+ arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
+
+ if ((arg_conf == 0) || (arg_conf_len == 0))
-+ log_fatal("Unable to process -timeout timeout argument");
++ log_fatal("Unable to process --timeout timeout argument");
+
+ free(last_arg_conf);
+ }
+ 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");
++ log_fatal("Unable to parse --request-options <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");
++ log_fatal("Unable to parse --request-options <request options list> argument");
+
+ free(last_arg_conf);
+ }
+ if (arg_conf_len == 0)
+ if ((arg_conf_len = strlen(arg_conf)) == 0)
+ /* huh ? cannot happen ! */
-+ log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
++ log_fatal("Unable to process -C/-H/-F/--timeout/-V/--request-options configuration arguments");
+
+ /* parse the extra dhclient.conf configuration arguments
+ * into top level config: */
+ const char *val = NULL;
+ int token;
+
-+ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
++ status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -C/-H/-F/--timeout/-V/--request-options configuration arguments", 0);
+
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
-+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ log_fatal("Cannot parse -C/-H/-F/--timeout/-V/--request-options configuration arguments !");
+ /* more detailed parse failures will be logged */
+
+ do {
+ } while (1);
+
+ if (cfile -> warnings_occurred)
-+ log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
++ log_fatal("Cannot parse -C/-H/-F/--timeout/-V/--request-options configuration arguments !");
+ end_parse(&cfile);
+
+ if (timeout_arg) {
/* Parse the lease database. */
read_client_leases();
-@@ -715,6 +965,10 @@ static void usage()
- " [-s server-addr] [-cf config-file] "
- "[-lf lease-file]\n"
- " [-pf pid-file] [--no-pid] [-e VAR=val]\n"
-+ " [-I <dhcp-client-identifier>] [-B]\n"
-+ " [-H <host-name> | -F <fqdn.fqdn>] [-timeout <timeout>]\n"
-+ " [-V <vendor-class-identifier>]\n"
-+ " [-R <request option list>]\n"
- " [-sf script-file] [interface]");
- }
-
-@@ -2421,7 +2675,8 @@ void make_discover (client, lease)
+@@ -3472,7 +3729,8 @@ void make_discover (client, lease)
client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2505,7 +2760,9 @@ void make_request (client, lease)
+@@ -3557,7 +3815,9 @@ void make_request (client, lease)
} else {
memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr);
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-@@ -2567,7 +2824,8 @@ void make_decline (client, lease)
+@@ -3620,7 +3880,8 @@ void make_decline (client, lease)
client -> packet.hops = 0;
client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
-diff -up dhcp-4.2.4-P2/common/conflex.c.options dhcp-4.2.4-P2/common/conflex.c
---- dhcp-4.2.4-P2/common/conflex.c.options 2012-08-28 04:13:03.000000000 +0200
-+++ dhcp-4.2.4-P2/common/conflex.c 2012-09-26 10:34:27.142049876 +0200
-@@ -808,6 +808,8 @@ intern(char *atom, enum dhcp_token dfv)
- return BALANCE;
- if (!strcasecmp (atom + 1, "ound"))
- return BOUND;
+diff --git a/common/conflex.c b/common/conflex.c
+index 8b01dfb..1fa2be3 100644
+--- a/common/conflex.c
++++ b/common/conflex.c
+@@ -832,6 +832,8 @@ intern(char *atom, enum dhcp_token dfv) {
+ if (!strcasecmp(atom+1, "ig-endian")) {
+ return TOKEN_BIG_ENDIAN;
+ }
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
+ return BOOTP_BROADCAST_ALWAYS;
break;
case 'c':
if (!strcasecmp(atom + 1, "ase"))
-diff -up dhcp-4.2.4-P2/includes/dhcpd.h.options dhcp-4.2.4-P2/includes/dhcpd.h
---- dhcp-4.2.4-P2/includes/dhcpd.h.options 2012-08-28 04:13:22.000000000 +0200
-+++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-09-26 10:34:27.143049865 +0200
-@@ -1153,6 +1153,9 @@ struct client_config {
- int do_forward_update; /* If nonzero, and if we have the
- information we need, update the
- A record for the address we get. */
+diff --git a/includes/dhcpd.h b/includes/dhcpd.h
+index f68b228..3b2e2ca 100644
+--- a/includes/dhcpd.h
++++ b/includes/dhcpd.h
+@@ -1284,6 +1284,9 @@ struct client_config {
+
+ int lease_id_format; /* format for IDs in lease file,
+ TOKEN_OCTAL or TOKEN_HEX */
+
+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
+ flag in requests */
};
/* Per-interface state used in the dhcp client... */
-diff -up dhcp-4.2.4-P2/includes/dhctoken.h.options dhcp-4.2.4-P2/includes/dhctoken.h
---- dhcp-4.2.4-P2/includes/dhctoken.h.options 2012-08-28 04:13:03.000000000 +0200
-+++ dhcp-4.2.4-P2/includes/dhctoken.h 2012-09-26 10:34:27.144049854 +0200
-@@ -364,7 +364,8 @@ enum dhcp_token {
- GETHOSTBYNAME = 665,
- PRIMARY6 = 666,
- SECONDARY6 = 667,
-- TOKEN_INFINIBAND = 668
-+ TOKEN_INFINIBAND = 668,
-+ BOOTP_BROADCAST_ALWAYS = 669
+diff --git a/includes/dhctoken.h b/includes/dhctoken.h
+index e6d125f..6daa422 100644
+--- a/includes/dhctoken.h
++++ b/includes/dhctoken.h
+@@ -377,7 +377,8 @@ enum dhcp_token {
+ TOKEN_HEX = 677,
+ TOKEN_OCTAL = 678,
+ KEY_ALGORITHM = 679,
+- DISCONNECT = 680
++ BOOTP_BROADCAST_ALWAYS = 680,
++ DISCONNECT = 681
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
+--
+2.35.1
+