diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-20 18:06:23 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-20 18:06:23 +0100 |
commit | 87fa216e1e388c537cda2cff126eea816a4135ac (patch) | |
tree | bfbf5781bd9b33525029c162d59902ac438ea2a4 | |
parent | 0f62c4d065bc7fa9d3de52a8482bf48ecfd18ecf (diff) | |
download | busybox-w32-87fa216e1e388c537cda2cff126eea816a4135ac.tar.gz busybox-w32-87fa216e1e388c537cda2cff126eea816a4135ac.tar.bz2 busybox-w32-87fa216e1e388c537cda2cff126eea816a4135ac.zip |
udhcpc: make it possible to disable vendor id; improve help text
function old new delta
init_packet 135 139 +4
packed_usage 26789 26786 -3
alloc_dhcp_option 67 63 -4
udhcpc_main 2467 2447 -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 4/-27) Total: -23 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/udhcp/udhcpd.conf | 22 | ||||
-rw-r--r-- | include/usage.h | 80 | ||||
-rw-r--r-- | networking/udhcp/clientpacket.c | 6 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 49 | ||||
-rw-r--r-- | networking/udhcp/options.c | 1 | ||||
-rw-r--r-- | networking/udhcp/options.h | 12 |
6 files changed, 88 insertions, 82 deletions
diff --git a/examples/udhcp/udhcpd.conf b/examples/udhcp/udhcpd.conf index 7fc37ab00..0ad982b55 100644 --- a/examples/udhcp/udhcpd.conf +++ b/examples/udhcp/udhcpd.conf | |||
@@ -20,18 +20,18 @@ interface eth0 | |||
20 | #auto_time 7200 | 20 | #auto_time 7200 |
21 | 21 | ||
22 | # The amount of time that an IP will be reserved (leased to nobody) | 22 | # The amount of time that an IP will be reserved (leased to nobody) |
23 | # if a DHCP decline message is received (seconds). | 23 | # if a DHCP decline message is received (seconds) |
24 | #decline_time 3600 | 24 | #decline_time 3600 |
25 | 25 | ||
26 | # The amount of time that an IP will be reserved | 26 | # The amount of time that an IP will be reserved |
27 | # if an ARP conflict occurs (seconds). | 27 | # if an ARP conflict occurs (seconds) |
28 | #conflict_time 3600 | 28 | #conflict_time 3600 |
29 | 29 | ||
30 | # How long an offered address is reserved (seconds). | 30 | # How long an offered address is reserved (seconds) |
31 | #offer_time 60 | 31 | #offer_time 60 |
32 | 32 | ||
33 | # If client asks for lease below this value, it will be rounded up | 33 | # If client asks for lease below this value, it will be rounded up |
34 | # to this value (seconds). | 34 | # to this value (seconds) |
35 | #min_lease 60 | 35 | #min_lease 60 |
36 | 36 | ||
37 | # The location of the leases file | 37 | # The location of the leases file |
@@ -40,15 +40,19 @@ interface eth0 | |||
40 | # The location of the pid file | 40 | # The location of the pid file |
41 | #pidfile /var/run/udhcpd.pid | 41 | #pidfile /var/run/udhcpd.pid |
42 | 42 | ||
43 | # Every time udhcpd writes a leases file, the below script will be called. | 43 | # Every time udhcpd writes a leases file, the below script will be called |
44 | #notify_file # default: no script | 44 | #notify_file # default: no script |
45 | #notify_file dumpleases # useful for debugging | 45 | #notify_file dumpleases # useful for debugging |
46 | 46 | ||
47 | # The following are bootp specific options, settable by udhcpd. | 47 | # The following are bootp specific options |
48 | #siaddr 192.168.0.22 #default: 0.0.0.0 | 48 | #siaddr 192.168.0.22 #default: 0.0.0.0 |
49 | #sname zorak #default: none | 49 | #sname zorak #default: none |
50 | #boot_file /var/nfs_root #default: none | 50 | #boot_file /var/nfs_root #default: none |
51 | 51 | ||
52 | # Static leases map | ||
53 | #static_lease 00:60:08:11:CE:4E 192.168.0.54 | ||
54 | #static_lease 00:60:08:11:CE:3E 192.168.0.44 | ||
55 | |||
52 | # The remainder of options are DHCP options and can be specified with the | 56 | # The remainder of options are DHCP options and can be specified with the |
53 | # keyword 'opt' or 'option'. If an option can take multiple items, such | 57 | # keyword 'opt' or 'option'. If an option can take multiple items, such |
54 | # as the dns option, they can be listed on the same line, or multiple | 58 | # as the dns option, they can be listed on the same line, or multiple |
@@ -60,7 +64,7 @@ opt router 192.168.10.2 | |||
60 | opt wins 192.168.10.10 | 64 | opt wins 192.168.10.10 |
61 | option dns 129.219.13.81 # appended to above DNS servers for a total of 3 | 65 | option dns 129.219.13.81 # appended to above DNS servers for a total of 3 |
62 | option domain local | 66 | option domain local |
63 | option lease 864000 # 10 days of seconds | 67 | option lease 864000 # 10 days |
64 | 68 | ||
65 | # Currently supported options (for more info, see options.c): | 69 | # Currently supported options (for more info, see options.c): |
66 | #opt lease NUM | 70 | #opt lease NUM |
@@ -92,7 +96,3 @@ option lease 864000 # 10 days of seconds | |||
92 | #opt swapsrv IP | 96 | #opt swapsrv IP |
93 | #opt timesrv IP_LIST | 97 | #opt timesrv IP_LIST |
94 | #opt ntpsrv IP_LIST | 98 | #opt ntpsrv IP_LIST |
95 | |||
96 | # Static leases map | ||
97 | #static_lease 00:60:08:11:CE:4E 192.168.0.54 | ||
98 | #static_lease 00:60:08:11:CE:3E 192.168.0.44 | ||
diff --git a/include/usage.h b/include/usage.h index 093efc8c4..a7855cdf4 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -4810,66 +4810,68 @@ | |||
4810 | "Adjust filesystem options on ext[23] filesystems" | 4810 | "Adjust filesystem options on ext[23] filesystems" |
4811 | 4811 | ||
4812 | #define udhcpc_trivial_usage \ | 4812 | #define udhcpc_trivial_usage \ |
4813 | "[-Cfbnqtvo] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n" \ | 4813 | "[-fbnqvoCR] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]\n" \ |
4814 | " [-p pidfile] [-r IP] [-s script] [-O dhcp-option]..." IF_FEATURE_UDHCP_PORT(" [-P N]") | 4814 | " [-H HOSTNAME] [-c CID] [-V VENDOR] [-O DHCP_OPT]..." IF_FEATURE_UDHCP_PORT(" [-P N]") |
4815 | #define udhcpc_full_usage "\n\n" \ | 4815 | #define udhcpc_full_usage "\n" \ |
4816 | IF_LONG_OPTS( \ | 4816 | IF_LONG_OPTS( \ |
4817 | " -V,--vendorclass=CLASSID Vendor class identifier" \ | 4817 | "\n -i,--interface IFACE Interface to use (default eth0)" \ |
4818 | "\n -i,--interface=INTERFACE Interface to use (default eth0)" \ | 4818 | "\n -p,--pidfile FILE Create pidfile" \ |
4819 | "\n -H,-h,--hostname=HOSTNAME Client hostname" \ | 4819 | "\n -r,--request IP IP address to request" \ |
4820 | "\n -c,--clientid=CLIENTID Client identifier" \ | 4820 | "\n -s,--script PROG Run PROG at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ |
4821 | "\n -C,--clientid-none Suppress default client identifier" \ | 4821 | "\n -t,--retries N Send up to N discover packets" \ |
4822 | "\n -p,--pidfile=FILE Create pidfile" \ | 4822 | "\n -T,--timeout N Pause between packets (default 3 seconds)" \ |
4823 | "\n -r,--request=IP IP address to request" \ | 4823 | "\n -A,--tryagain N Wait N seconds (default 20) after failure" \ |
4824 | "\n -s,--script=FILE Run FILE at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ | 4824 | "\n -O,--request-option OPT Request DHCP option OPT (cumulative)" \ |
4825 | "\n -t,--retries=N Send up to N discover packets" \ | 4825 | "\n -o,--no-default-options Don't request any options (unless -O is given)" \ |
4826 | "\n -T,--timeout=N Pause between packets (default 3 seconds)" \ | 4826 | "\n -f,--foreground Run in foreground" \ |
4827 | "\n -A,--tryagain=N Wait N seconds (default 20) after failure" \ | ||
4828 | "\n -O,--request-option=OPT Request DHCP option OPT (cumulative)" \ | ||
4829 | "\n -o,--no-default-options Don't request any options (unless -O is also given)" \ | ||
4830 | "\n -f,--foreground Run in foreground" \ | ||
4831 | USE_FOR_MMU( \ | 4827 | USE_FOR_MMU( \ |
4832 | "\n -b,--background Background if lease is not immediately obtained" \ | 4828 | "\n -b,--background Background if lease is not obtained" \ |
4833 | ) \ | 4829 | ) \ |
4834 | "\n -S,--syslog Log to syslog too" \ | 4830 | "\n -S,--syslog Log to syslog too" \ |
4835 | "\n -n,--now Exit with failure if lease is not immediately obtained" \ | 4831 | "\n -n,--now Exit if lease is not obtained" \ |
4836 | "\n -q,--quit Quit after obtaining lease" \ | 4832 | "\n -q,--quit Exit after obtaining lease" \ |
4837 | "\n -R,--release Release IP on quit" \ | 4833 | "\n -R,--release Release IP on exit" \ |
4838 | IF_FEATURE_UDHCP_PORT( \ | 4834 | IF_FEATURE_UDHCP_PORT( \ |
4839 | "\n -P,--client-port N Use port N instead of default 68" \ | 4835 | "\n -P,--client-port N Use port N (default 68)" \ |
4840 | ) \ | 4836 | ) \ |
4841 | IF_FEATURE_UDHCPC_ARPING( \ | 4837 | IF_FEATURE_UDHCPC_ARPING( \ |
4842 | "\n -a,--arping Use arping to validate offered address" \ | 4838 | "\n -a,--arping Use arping to validate offered address" \ |
4843 | ) \ | 4839 | ) \ |
4840 | "\n -F,--fqdn NAME Ask server to update DNS mapping for NAME" \ | ||
4841 | "\n -H,-h,--hostname NAME Send NAME as client hostname (default none)" \ | ||
4842 | "\n -V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION')" \ | ||
4843 | "\n -c,--clientid CLIENTID Client identifier (default own MAC)" \ | ||
4844 | "\n -C,--clientid-none Don't send client identifier" \ | ||
4844 | ) \ | 4845 | ) \ |
4845 | IF_NOT_LONG_OPTS( \ | 4846 | IF_NOT_LONG_OPTS( \ |
4846 | " -V CLASSID Vendor class identifier" \ | 4847 | "\n -i IFACE Interface to use (default eth0)" \ |
4847 | "\n -i INTERFACE Interface to use (default: eth0)" \ | ||
4848 | "\n -H,-h HOSTNAME Client hostname" \ | ||
4849 | "\n -c CLIENTID Client identifier" \ | ||
4850 | "\n -C Suppress default client identifier" \ | ||
4851 | "\n -p FILE Create pidfile" \ | 4848 | "\n -p FILE Create pidfile" \ |
4852 | "\n -r IP IP address to request" \ | 4849 | "\n -r IP IP address to request" \ |
4853 | "\n -s FILE Run FILE at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ | 4850 | "\n -s PROG Run PROG at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")" \ |
4854 | "\n -t N Send up to N request packets" \ | 4851 | "\n -t N Send up to N discover packets" \ |
4855 | "\n -T N Try to get a lease for N seconds (default 3)" \ | 4852 | "\n -T N Pause between packets (default 3 seconds)" \ |
4856 | "\n -A N Wait N seconds (default 20) after failure" \ | 4853 | "\n -A N Wait N seconds (default 20) after failure" \ |
4857 | "\n -O OPT Request DHCP option OPT (cumulative)" \ | 4854 | "\n -O OPT Request DHCP option OPT (cumulative)" \ |
4858 | "\n -o Don't request any options (unless -O is also given)" \ | 4855 | "\n -o Don't request any options (unless -O is given)" \ |
4859 | "\n -f Run in foreground" \ | 4856 | "\n -f Run in foreground" \ |
4860 | USE_FOR_MMU( \ | 4857 | USE_FOR_MMU( \ |
4861 | "\n -b Background if lease is not immediately obtained" \ | 4858 | "\n -b Background if lease is not obtained" \ |
4862 | ) \ | 4859 | ) \ |
4863 | "\n -S Log to syslog too" \ | 4860 | "\n -S Log to syslog too" \ |
4864 | "\n -n Exit with failure if lease is not immediately obtained" \ | 4861 | "\n -n Exit if lease is not obtained" \ |
4865 | "\n -q Quit after obtaining lease" \ | 4862 | "\n -q Exit after obtaining lease" \ |
4866 | "\n -R Release IP on quit" \ | 4863 | "\n -R Release IP on exit" \ |
4867 | IF_FEATURE_UDHCP_PORT( \ | 4864 | IF_FEATURE_UDHCP_PORT( \ |
4868 | "\n -P N Use port N instead of default 68" \ | 4865 | "\n -P N Use port N (default 68)" \ |
4869 | ) \ | 4866 | ) \ |
4870 | IF_FEATURE_UDHCPC_ARPING( \ | 4867 | IF_FEATURE_UDHCPC_ARPING( \ |
4871 | "\n -a Use arping to validate offered address" \ | 4868 | "\n -a Use arping to validate offered address" \ |
4872 | ) \ | 4869 | ) \ |
4870 | "\n -F NAME Ask server to update DNS mapping for NAME" \ | ||
4871 | "\n -H,-h NAME Send NAME as client hostname (default none)" \ | ||
4872 | "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')" \ | ||
4873 | "\n -c CLIENTID Client identifier (default own MAC)" \ | ||
4874 | "\n -C Don't send client identifier" \ | ||
4873 | ) | 4875 | ) |
4874 | 4876 | ||
4875 | #define udhcpd_trivial_usage \ | 4877 | #define udhcpd_trivial_usage \ |
@@ -4880,7 +4882,7 @@ | |||
4880 | "\n -f Run in foreground" \ | 4882 | "\n -f Run in foreground" \ |
4881 | "\n -S Log to syslog too" \ | 4883 | "\n -S Log to syslog too" \ |
4882 | IF_FEATURE_UDHCP_PORT( \ | 4884 | IF_FEATURE_UDHCP_PORT( \ |
4883 | "\n -P N Use port N instead of default 67" \ | 4885 | "\n -P N Use port N (default 67)" \ |
4884 | ) | 4886 | ) |
4885 | 4887 | ||
4886 | #define umount_trivial_usage \ | 4888 | #define umount_trivial_usage \ |
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index f091d8067..a255d6e84 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -47,8 +47,12 @@ static void init_packet(struct dhcp_packet *packet, char type) | |||
47 | add_option_string(packet->options, client_config.hostname); | 47 | add_option_string(packet->options, client_config.hostname); |
48 | if (client_config.fqdn) | 48 | if (client_config.fqdn) |
49 | add_option_string(packet->options, client_config.fqdn); | 49 | add_option_string(packet->options, client_config.fqdn); |
50 | if ((type != DHCPDECLINE) && (type != DHCPRELEASE)) | 50 | if (type != DHCPDECLINE |
51 | && type != DHCPRELEASE | ||
52 | && client_config.vendorclass | ||
53 | ) { | ||
51 | add_option_string(packet->options, client_config.vendorclass); | 54 | add_option_string(packet->options, client_config.vendorclass); |
55 | } | ||
52 | } | 56 | } |
53 | 57 | ||
54 | 58 | ||
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 9a2fe35e4..3e2cd1217 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -125,8 +125,7 @@ static void client_background(void) | |||
125 | static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) | 125 | static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) |
126 | { | 126 | { |
127 | uint8_t *storage; | 127 | uint8_t *storage; |
128 | int len = strlen(str); | 128 | int len = strnlen(str, 255); |
129 | if (len > 255) len = 255; | ||
130 | storage = xzalloc(len + extra + OPT_DATA); | 129 | storage = xzalloc(len + extra + OPT_DATA); |
131 | storage[OPT_CODE] = code; | 130 | storage[OPT_CODE] = code; |
132 | storage[OPT_LEN] = len + extra; | 131 | storage[OPT_LEN] = len + extra; |
@@ -139,7 +138,7 @@ int udhcpc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
139 | int udhcpc_main(int argc UNUSED_PARAM, char **argv) | 138 | int udhcpc_main(int argc UNUSED_PARAM, char **argv) |
140 | { | 139 | { |
141 | uint8_t *temp, *message; | 140 | uint8_t *temp, *message; |
142 | char *str_c, *str_V, *str_h, *str_F, *str_r; | 141 | const char *str_c, *str_V, *str_h, *str_F, *str_r; |
143 | IF_FEATURE_UDHCP_PORT(char *str_P;) | 142 | IF_FEATURE_UDHCP_PORT(char *str_P;) |
144 | llist_t *list_O = NULL; | 143 | llist_t *list_O = NULL; |
145 | int tryagain_timeout = 20; | 144 | int tryagain_timeout = 20; |
@@ -222,6 +221,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
222 | IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;) | 221 | IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;) |
223 | client_config.interface = "eth0"; | 222 | client_config.interface = "eth0"; |
224 | client_config.script = DEFAULT_SCRIPT; | 223 | client_config.script = DEFAULT_SCRIPT; |
224 | str_V = "udhcp "BB_VER; | ||
225 | 225 | ||
226 | /* Parse command line */ | 226 | /* Parse command line */ |
227 | /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */ | 227 | /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */ |
@@ -246,23 +246,22 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
246 | , &dhcp_verbose | 246 | , &dhcp_verbose |
247 | #endif | 247 | #endif |
248 | ); | 248 | ); |
249 | if (opt & OPT_c) | ||
250 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0); | ||
251 | if (opt & OPT_V) | ||
252 | client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0); | ||
253 | if (opt & (OPT_h|OPT_H)) | 249 | if (opt & (OPT_h|OPT_H)) |
254 | client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); | 250 | client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); |
255 | if (opt & OPT_F) { | 251 | if (opt & OPT_F) { |
252 | /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */ | ||
256 | client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); | 253 | client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); |
257 | /* Flags: 0000NEOS | 254 | /* Flag bits: 0000NEOS |
258 | S: 1 => Client requests Server to update A RR in DNS as well as PTR | 255 | * S: 1 = Client requests server to update A RR in DNS as well as PTR |
259 | O: 1 => Server indicates to client that DNS has been updated regardless | 256 | * O: 1 = Server indicates to client that DNS has been updated regardless |
260 | E: 1 => Name data is DNS format, i.e. <4>host<6>domain<3>com<0> not "host.domain.com" | 257 | * E: 1 = Name is in DNS format, i.e. <4>host<6>domain<3>com<0>, |
261 | N: 1 => Client requests Server to not update DNS | 258 | * not "host.domain.com". Format 0 is obsolete. |
262 | */ | 259 | * N: 1 = Client requests server to not update DNS (S must be 0 then) |
260 | * Two [0] bytes which follow are deprecated and must be 0. | ||
261 | */ | ||
263 | client_config.fqdn[OPT_DATA + 0] = 0x1; | 262 | client_config.fqdn[OPT_DATA + 0] = 0x1; |
264 | /* client_config.fqdn[OPT_DATA + 1] = 0; - redundant */ | 263 | /*client_config.fqdn[OPT_DATA + 1] = 0; - xzalloc did it */ |
265 | /* client_config.fqdn[OPT_DATA + 2] = 0; - redundant */ | 264 | /*client_config.fqdn[OPT_DATA + 2] = 0; */ |
266 | } | 265 | } |
267 | if (opt & OPT_r) | 266 | if (opt & OPT_r) |
268 | requested_ip = inet_addr(str_r); | 267 | requested_ip = inet_addr(str_r); |
@@ -291,6 +290,16 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
291 | return 1; | 290 | return 1; |
292 | } | 291 | } |
293 | 292 | ||
293 | if (opt & OPT_c) { | ||
294 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0); | ||
295 | } else if (!(opt & OPT_C)) { | ||
296 | /* not set and not suppressed, set the default client ID */ | ||
297 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); | ||
298 | client_config.clientid[OPT_DATA] = 1; /* type: ethernet */ | ||
299 | memcpy(client_config.clientid + OPT_DATA+1, client_config.client_mac, 6); | ||
300 | } | ||
301 | if (str_V[0] != '\0') | ||
302 | client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0); | ||
294 | #if !BB_MMU | 303 | #if !BB_MMU |
295 | /* on NOMMU reexec (i.e., background) early */ | 304 | /* on NOMMU reexec (i.e., background) early */ |
296 | if (!(opt & OPT_f)) { | 305 | if (!(opt & OPT_f)) { |
@@ -314,16 +323,6 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
314 | /* Goes to stdout (unless NOMMU) and possibly syslog */ | 323 | /* Goes to stdout (unless NOMMU) and possibly syslog */ |
315 | bb_info_msg("%s (v"BB_VER") started", applet_name); | 324 | bb_info_msg("%s (v"BB_VER") started", applet_name); |
316 | 325 | ||
317 | /* If not set, and not suppressed, set up the default client ID */ | ||
318 | if (!client_config.clientid && !(opt & OPT_C)) { | ||
319 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); | ||
320 | client_config.clientid[OPT_DATA] = 1; | ||
321 | memcpy(client_config.clientid + OPT_DATA+1, client_config.client_mac, 6); | ||
322 | } | ||
323 | |||
324 | if (!client_config.vendorclass) | ||
325 | client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, "udhcp "BB_VER, 0); | ||
326 | |||
327 | /* Set up the signal pipe */ | 326 | /* Set up the signal pipe */ |
328 | udhcp_sp_setup(); | 327 | udhcp_sp_setup(); |
329 | 328 | ||
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index c2a230527..09d31c69b 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | /* Supported options are easily added here. | 14 | /* Supported options are easily added here. |
15 | * See RFC2132 for more options. | 15 | * See RFC2132 for more options. |
16 | * OPTION_REQ: these options are requested by udhcpc (unless -o). | ||
16 | */ | 17 | */ |
17 | const struct dhcp_option dhcp_options[] = { | 18 | const struct dhcp_option dhcp_options[] = { |
18 | /* flags code */ | 19 | /* flags code */ |
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index 2d9c15f8a..75087fa35 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h | |||
@@ -46,9 +46,9 @@ enum { | |||
46 | #define DHCP_LOG_SERVER 0x07 | 46 | #define DHCP_LOG_SERVER 0x07 |
47 | //#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" server */ | 47 | //#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" server */ |
48 | #define DHCP_LPR_SERVER 0x09 | 48 | #define DHCP_LPR_SERVER 0x09 |
49 | #define DHCP_HOST_NAME 0x0c | 49 | #define DHCP_HOST_NAME 0x0c /* either client informs server or server gives name to client */ |
50 | #define DHCP_BOOT_SIZE 0x0d | 50 | #define DHCP_BOOT_SIZE 0x0d |
51 | #define DHCP_DOMAIN_NAME 0x0f | 51 | #define DHCP_DOMAIN_NAME 0x0f /* server gives domain suffix */ |
52 | #define DHCP_SWAP_SERVER 0x10 | 52 | #define DHCP_SWAP_SERVER 0x10 |
53 | #define DHCP_ROOT_PATH 0x11 | 53 | #define DHCP_ROOT_PATH 0x11 |
54 | #define DHCP_IP_TTL 0x17 | 54 | #define DHCP_IP_TTL 0x17 |
@@ -61,14 +61,14 @@ enum { | |||
61 | #define DHCP_OPTION_OVERLOAD 0x34 | 61 | #define DHCP_OPTION_OVERLOAD 0x34 |
62 | #define DHCP_MESSAGE_TYPE 0x35 | 62 | #define DHCP_MESSAGE_TYPE 0x35 |
63 | #define DHCP_SERVER_ID 0x36 /* by default server's IP */ | 63 | #define DHCP_SERVER_ID 0x36 /* by default server's IP */ |
64 | #define DHCP_PARAM_REQ 0x37 | 64 | #define DHCP_PARAM_REQ 0x37 /* list of options client wants */ |
65 | #define DHCP_MESSAGE 0x38 /* error message when sending NAK etc */ | 65 | #define DHCP_MESSAGE 0x38 /* error message when sending NAK etc */ |
66 | #define DHCP_MAX_SIZE 0x39 | 66 | #define DHCP_MAX_SIZE 0x39 |
67 | //#define DHCP_T1 0x3a | 67 | //#define DHCP_T1 0x3a |
68 | //#define DHCP_T2 0x3b | 68 | //#define DHCP_T2 0x3b |
69 | #define DHCP_VENDOR 0x3c /* client's vendor */ | 69 | #define DHCP_VENDOR 0x3c /* client's vendor (a string) */ |
70 | #define DHCP_CLIENT_ID 0x3d /* by default client's MAC addr */ | 70 | #define DHCP_CLIENT_ID 0x3d /* by default client's MAC addr, but may be arbitrarily long */ |
71 | #define DHCP_FQDN 0x51 | 71 | #define DHCP_FQDN 0x51 /* client asks to update DNS to map its FQDN to its new IP */ |
72 | #define DHCP_STATIC_ROUTES 0x79 | 72 | #define DHCP_STATIC_ROUTES 0x79 |
73 | #define DHCP_END 0xFF | 73 | #define DHCP_END 0xFF |
74 | /* Offsets in option byte sequence */ | 74 | /* Offsets in option byte sequence */ |