Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 178756 | Differences between
and this patch

Collapse All | Expand All

(-)busybox-1.5.0/networking/udhcp/dhcpc.c (-3 / +10 lines)
Lines 126-132 int udhcpc_main(int argc, char *argv[]); Link Here
126
int udhcpc_main(int argc, char *argv[])
126
int udhcpc_main(int argc, char *argv[])
127
{
127
{
128
	uint8_t *temp, *message;
128
	uint8_t *temp, *message;
129
	char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t;
129
	char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t, *str_O;
130
	unsigned long t1 = 0, t2 = 0, xid = 0;
130
	unsigned long t1 = 0, t2 = 0, xid = 0;
131
	unsigned long start = 0, lease = 0;
131
	unsigned long start = 0, lease = 0;
132
	long now;
132
	long now;
Lines 160-165 int udhcpc_main(int argc, char *argv[]) Link Here
160
		OPT_T = 1 << 15,
160
		OPT_T = 1 << 15,
161
		OPT_t = 1 << 16,
161
		OPT_t = 1 << 16,
162
		OPT_v = 1 << 17,
162
		OPT_v = 1 << 17,
163
		OPT_O = 1 << 18,
163
	};
164
	};
164
#if ENABLE_GETOPT_LONG
165
#if ENABLE_GETOPT_LONG
165
	static const struct option arg_options[] = {
166
	static const struct option arg_options[] = {
Lines 181-186 int udhcpc_main(int argc, char *argv[]) Link Here
181
		{ "timeout",    required_argument,      0, 'T' },
182
		{ "timeout",    required_argument,      0, 'T' },
182
		{ "version",    no_argument,            0, 'v' },
183
		{ "version",    no_argument,            0, 'v' },
183
		{ "retries",    required_argument,      0, 't' },
184
		{ "retries",    required_argument,      0, 't' },
185
		{ "request-option", required_argument,  0, 'O' },
184
		{ 0, 0, 0, 0 }
186
		{ 0, 0, 0, 0 }
185
	};
187
	};
186
#endif
188
#endif
Lines 196-205 int udhcpc_main(int argc, char *argv[]) Link Here
196
#if ENABLE_GETOPT_LONG
198
#if ENABLE_GETOPT_LONG
197
	applet_long_options = arg_options;
199
	applet_long_options = arg_options;
198
#endif
200
#endif
199
	opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
201
	opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vO:",
200
		&str_c, &str_V, &str_h, &str_h, &str_F,
202
		&str_c, &str_V, &str_h, &str_h, &str_F,
201
		&client_config.interface, &client_config.pidfile, &str_r,
203
		&client_config.interface, &client_config.pidfile, &str_r,
202
		&client_config.script, &str_T, &str_t
204
		&client_config.script, &str_T, &str_t, &str_O
203
		);
205
		);
204
206
205
	if (opt & OPT_c)
207
	if (opt & OPT_c)
Lines 245-250 int udhcpc_main(int argc, char *argv[]) Link Here
245
		printf("version %s\n\n", BB_VER);
247
		printf("version %s\n\n", BB_VER);
246
		return 0;
248
		return 0;
247
	}
249
	}
250
	if (opt & OPT_O)
251
		if (require_option(str_O)) {
252
			printf("Option: %s unknown/not-supported\n", str_O);
253
			return 1;
254
		}
248
255
249
	/* Start the log, sanitize fd's, and write a pid file */
256
	/* Start the log, sanitize fd's, and write a pid file */
250
	udhcp_start_log_and_pid(client_config.pidfile);
257
	udhcp_start_log_and_pid(client_config.pidfile);
(-)busybox-1.5.0/networking/udhcp/options.c (-2 / +13 lines)
Lines 10-16 Link Here
10
10
11
11
12
/* supported options are easily added here */
12
/* supported options are easily added here */
13
const struct dhcp_option dhcp_options[] = {
13
struct dhcp_option dhcp_options[] = {
14
	/* name[12]     flags                                   code */
14
	/* name[12]     flags                                   code */
15
	{"subnet",      OPTION_IP | OPTION_REQ,                 0x01},
15
	{"subnet",      OPTION_IP | OPTION_REQ,                 0x01},
16
	{"timezone",    OPTION_S32,                             0x02},
16
	{"timezone",    OPTION_S32,                             0x02},
Lines 67-73 const unsigned char option_lengths[] = { Link Here
67
	[OPTION_S32] =     4
67
	[OPTION_S32] =     4
68
};
68
};
69
69
70
70
/* find and mark requested item as required */
71
int require_option(char *name)
72
{
73
	int i;
74
	for (i = 0; dhcp_options[i].code; i++)
75
		if( strcmp( name, dhcp_options[i].name ) == 0 ){
76
			dhcp_options[i].flags |= OPTION_REQ;
77
			return 0;
78
		}
79
	return 1;
80
}
81
  
71
/* get an option with bounds checking (warning, not aligned). */
82
/* get an option with bounds checking (warning, not aligned). */
72
uint8_t *get_option(struct dhcpMessage *packet, int code)
83
uint8_t *get_option(struct dhcpMessage *packet, int code)
73
{
84
{
(-)busybox-1.5.0/networking/udhcp/options.h (-1 / +2 lines)
Lines 29-37 struct dhcp_option { Link Here
29
	uint8_t code;
29
	uint8_t code;
30
};
30
};
31
31
32
extern const struct dhcp_option dhcp_options[];
32
extern struct dhcp_option dhcp_options[];
33
extern const unsigned char option_lengths[];
33
extern const unsigned char option_lengths[];
34
34
35
int require_option(char *name);
35
uint8_t *get_option(struct dhcpMessage *packet, int code);
36
uint8_t *get_option(struct dhcpMessage *packet, int code);
36
int end_option(uint8_t *optionptr);
37
int end_option(uint8_t *optionptr);
37
int add_option_string(uint8_t *optionptr, uint8_t *string);
38
int add_option_string(uint8_t *optionptr, uint8_t *string);
(-)busybox-1.5.0/include/usage.h (-2 / +3 lines)
Lines 3410-3416 Link Here
3410
       "Adjust filesystem options on ext[23] filesystems"
3410
       "Adjust filesystem options on ext[23] filesystems"
3411
3411
3412
#define udhcpc_trivial_usage \
3412
#define udhcpc_trivial_usage \
3413
       "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
3413
       "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script] [-O dhcp-option]"
3414
#define udhcpc_full_usage \
3414
#define udhcpc_full_usage \
3415
       "	-V,--vendorclass=CLASSID	Set vendor class identifier\n" \
3415
       "	-V,--vendorclass=CLASSID	Set vendor class identifier\n" \
3416
       "	-i,--interface=INTERFACE	Interface to use (default: eth0)\n" \
3416
       "	-i,--interface=INTERFACE	Interface to use (default: eth0)\n" \
Lines 3426-3432 Link Here
3426
       "	-n,--now	Exit with failure if lease cannot be immediately negotiated\n" \
3426
       "	-n,--now	Exit with failure if lease cannot be immediately negotiated\n" \
3427
       "	-q,--quit	Quit after obtaining lease\n" \
3427
       "	-q,--quit	Quit after obtaining lease\n" \
3428
       "	-R,--release	Release IP on quit\n" \
3428
       "	-R,--release	Release IP on quit\n" \
3429
       "	-v,--version	Display version" \
3429
       "	-v,--version	Display version\n" \
3430
       "	-O,--request-option=NAME	Request also NAME DHCP-Option" \
3430
3431
3431
#define udhcpd_trivial_usage \
3432
#define udhcpd_trivial_usage \
3432
       "[configfile]\n" \
3433
       "[configfile]\n" \

Return to bug 178756