View | Details | Raw Unified | Return to bug 139532
Collapse All | Expand All

(-)dhcp-3.0.3/client/dhclient.8 (+8 lines)
Lines 33-38 Link Here
33
.I port
33
.I port
34
]
34
]
35
[
35
[
36
.B -H hostname
37
]
38
[
36
.B -d
39
.B -d
37
]
40
]
38
[
41
[
Lines 165-170 Link Here
165
transmit on, the client will also use a different destination port -
168
transmit on, the client will also use a different destination port -
166
one greater than the specified destination port.
169
one greater than the specified destination port.
167
.PP
170
.PP
171
The
172
.B -H
173
flag may be used to specify a client hostname that should be sent to
174
the DHCP server.
175
.PP
168
The DHCP client normally transmits any protocol messages it sends
176
The DHCP client normally transmits any protocol messages it sends
169
before acquiring an IP address to, 255.255.255.255, the IP limited
177
before acquiring an IP address to, 255.255.255.255, the IP limited
170
broadcast address.   For debugging purposes, it may be useful to have
178
broadcast address.   For debugging purposes, it may be useful to have
(-)dhcp-3.0.3/client/dhclient.c (-2 / +39 lines)
Lines 104-109 Link Here
104
	int no_dhclient_db = 0;
104
	int no_dhclient_db = 0;
105
	int no_dhclient_pid = 0;
105
	int no_dhclient_pid = 0;
106
	int no_dhclient_script = 0;
106
	int no_dhclient_script = 0;
107
	char *dhclient_hostname = NULL;
107
	char *s;
108
	char *s;
108
109
109
	/* Make sure we have stdin, stdout and stderr. */
110
	/* Make sure we have stdin, stdout and stderr. */
Lines 186-191 Link Here
186
			if (++i == argc)
187
			if (++i == argc)
187
				usage ();
188
				usage ();
188
			relay = argv [i];
189
			relay = argv [i];
190
		} else if (!strcmp (argv [i], "-H")) {
191
			if (++i == argc || !argv[i] || *(argv[i]) == '\0')
192
				usage ();
193
			if (strlen (argv[i]) >= DHCP_OPTION_LEN) {
194
				log_error("-H option host-name string \"%s\" is too long:"
195
					  "maximum length is %d characters",  argv[i], DHCP_OPTION_LEN-1);
196
				exit(1);
197
			}
198
			dhclient_hostname = argv [i];
189
		} else if (!strcmp (argv [i], "-nw")) {
199
		} else if (!strcmp (argv [i], "-nw")) {
190
			nowait = 1;
200
			nowait = 1;
191
		} else if (!strcmp (argv [i], "-n")) {
201
		} else if (!strcmp (argv [i], "-n")) {
Lines 350-355 Link Here
350
	/* Parse the dhclient.conf file. */
360
	/* Parse the dhclient.conf file. */
351
	read_client_conf ();
361
	read_client_conf ();
352
362
363
	/* If the user specified a hostname, send it here and now */
364
	if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) { 
365
		struct parse *cfile = NULL;
366
		char buf[DHCP_OPTION_LEN + 40];
367
		int len;
368
369
		len = sprintf (buf, "send host-name \"%s\";", dhclient_hostname);
370
371
		status = new_parse (&cfile, -1, buf, len, "host-name option", 0);
372
373
		if (status != ISC_R_SUCCESS)
374
			log_fatal ("Cannot parse dhcp-client-identifier send statement!");
375
376
		for (;;) {
377
			const char *val = NULL;
378
			int token;
379
380
			token = peek_token (&val, (unsigned *)0, cfile);
381
			if (token == END_OF_FILE)
382
				break;
383
384
			parse_client_statement (cfile, NULL, &top_level_config);
385
386
		}
387
		end_parse (&cfile);
388
	}
389
353
	/* Parse the lease database. */
390
	/* Parse the lease database. */
354
	read_client_leases ();
391
	read_client_leases ();
355
392
Lines 487-495 Link Here
487
	log_info (url);
524
	log_info (url);
488
525
489
#ifdef EXTENDED_NEW_OPTION_INFO
526
#ifdef EXTENDED_NEW_OPTION_INFO
490
	log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
527
	log_error ("Usage: dhclient [-1dqr] [-nwx] [-H <hostname>] [-p <port>] %s",
491
#else
528
#else
492
	log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
529
	log_error ("Usage: dhclient [-1dqr] [-nw] [-H <hostname>] [-p <port>] %s",
493
#endif
530
#endif
494
		   "[-s server]");
531
		   "[-s server]");
495
	log_error ("                [-cf config-file] [-lf lease-file]%s",
532
	log_error ("                [-cf config-file] [-lf lease-file]%s",

Return to bug 139532