blob: 933be2ad4bc8465316098edca10a2da344d47d34 [file] [log] [blame]
Glenn L McGrathec58bce2004-03-05 14:35:00 +00001Index: include/usage.h
2===================================================================
3RCS file: /var/cvs/busybox/include/usage.h,v
4retrieving revision 1.191
5diff -u -r1.191 usage.h
6--- a/include/usage.h 25 Feb 2004 10:35:55 -0000 1.191
7+++ b/include/usage.h 5 Mar 2004 14:32:45 -0000
8@@ -2606,6 +2606,7 @@
9 "\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \
10 "\t-q,\t--quit\tQuit after obtaining lease\n" \
11 "\t-r,\t--request=IP\tIP address to request (default: none)\n" \
12+ "\t-R,\t--require=NAME\tAdd NAME to request\n" \
13 "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
14 "\t-v,\t--version\tDisplay version"
Eric Andersenc7bda1c2004-03-15 08:29:22 +000015
Glenn L McGrathec58bce2004-03-05 14:35:00 +000016Index: networking/udhcp/README.udhcpc
17===================================================================
18RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v
19retrieving revision 1.3
20diff -u -r1.3 README.udhcpc
21--- a/networking/udhcp/README.udhcpc 11 Dec 2002 21:12:44 -0000 1.3
22+++ b/networking/udhcp/README.udhcpc 5 Mar 2004 14:32:46 -0000
23@@ -22,6 +22,7 @@
24 -p, --pidfile=file Store process ID of daemon in file
25 -q, --quit Quit after obtaining lease
26 -r, --request=IP IP address to request (default: none)
27+-R, --require=NAME Add NAME to request
28 -s, --script=file Run file at dhcp events (default:
29 /usr/share/udhcpc/default.script)
30 -v, --version Display version
31@@ -101,6 +102,8 @@
Eric Andersenc7bda1c2004-03-15 08:29:22 +000032
Glenn L McGrathec58bce2004-03-05 14:35:00 +000033 additional options are easily added in options.c.
Eric Andersenc7bda1c2004-03-15 08:29:22 +000034
Glenn L McGrathec58bce2004-03-05 14:35:00 +000035+By default, only a few basic items are requested. To request additional
36+items use the -R option. Example: "-R rootpath"
Eric Andersenc7bda1c2004-03-15 08:29:22 +000037
Glenn L McGrathec58bce2004-03-05 14:35:00 +000038 note on udhcpc's random seed
39 ---------------------------
40Index: networking/udhcp/dhcpc.c
41===================================================================
42RCS file: /var/cvs/busybox/networking/udhcp/dhcpc.c,v
43retrieving revision 1.16
44diff -u -r1.16 dhcpc.c
45--- a/networking/udhcp/dhcpc.c 30 Jan 2004 23:45:12 -0000 1.16
46+++ b/networking/udhcp/dhcpc.c 5 Mar 2004 14:32:46 -0000
47@@ -88,6 +88,7 @@
48 " -p, --pidfile=file Store process ID of daemon in file\n"
49 " -q, --quit Quit after obtaining lease\n"
50 " -r, --request=IP IP address to request (default: none)\n"
51+" -R, --require=NAME Add NAME to the request\n"
52 " -s, --script=file Run file at dhcp events (default:\n"
53 " " DEFAULT_SCRIPT ")\n"
54 " -v, --version Display version\n"
55@@ -203,6 +204,7 @@
56 {"pidfile", required_argument, 0, 'p'},
57 {"quit", no_argument, 0, 'q'},
58 {"request", required_argument, 0, 'r'},
59+ {"require", required_argument, 0, 'R'},
60 {"script", required_argument, 0, 's'},
61 {"version", no_argument, 0, 'v'},
62 {0, 0, 0, 0}
63@@ -211,7 +213,7 @@
64 /* get options */
65 while (1) {
66 int option_index = 0;
67- c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
68+ c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:R:s:v", arg_options, &option_index);
69 if (c == -1) break;
Eric Andersenc7bda1c2004-03-15 08:29:22 +000070
Glenn L McGrathec58bce2004-03-05 14:35:00 +000071 switch (c) {
72@@ -254,6 +256,11 @@
73 case 'r':
74 requested_ip = inet_addr(optarg);
75 break;
76+ case 'R':
77+ if (require_option(optarg)) {
78+ fprintf(stderr,"WARNING: %s unknown/not-supported (Ignored)\n", optarg );
79+ }
80+ break;
81 case 's':
82 client_config.script = optarg;
83 break;
84Index: networking/udhcp/options.c
85===================================================================
86RCS file: /var/cvs/busybox/networking/udhcp/options.c,v
87retrieving revision 1.7
88diff -u -r1.7 options.c
89--- a/networking/udhcp/options.c 30 Jan 2004 23:45:12 -0000 1.7
90+++ b/networking/udhcp/options.c 5 Mar 2004 14:32:46 -0000
91@@ -57,7 +57,19 @@
92 [OPTION_S32] = 4
93 };
Eric Andersenc7bda1c2004-03-15 08:29:22 +000094
Glenn L McGrathec58bce2004-03-05 14:35:00 +000095-
96+/* find and mark requested item as required */
97+int require_option(char *name)
98+{
99+ int i;
100+ for (i = 0; dhcp_options[i].code; i++) {
101+ if (strcmp(name, dhcp_options[i].name) == 0 ){
102+ dhcp_options[i].flags |= OPTION_REQ;
103+ return 0;
104+ }
105+ }
106+ return 1;
107+}
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000108+
Glenn L McGrathec58bce2004-03-05 14:35:00 +0000109 /* get an option with bounds checking (warning, not aligned). */
110 uint8_t *get_option(struct dhcpMessage *packet, int code)
111 {
112Index: networking/udhcp/options.h
113===================================================================
114RCS file: /var/cvs/busybox/networking/udhcp/options.h,v
115retrieving revision 1.5
116diff -u -r1.5 options.h
117--- a/networking/udhcp/options.h 30 Jan 2004 23:45:12 -0000 1.5
118+++ b/networking/udhcp/options.h 5 Mar 2004 14:32:46 -0000
119@@ -30,6 +30,7 @@
120 extern struct dhcp_option dhcp_options[];
121 extern int option_lengths[];
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000122
Glenn L McGrathec58bce2004-03-05 14:35:00 +0000123+int require_option(char *name);
124 uint8_t *get_option(struct dhcpMessage *packet, int code);
125 int end_option(uint8_t *optionptr);
126 int add_option_string(uint8_t *optionptr, uint8_t *string);