diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-19 23:42:23 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-19 23:42:23 +0100 |
commit | 777706cb2352c02602842f89d916a0e18ce6bd91 (patch) | |
tree | 75596b337731c87718c9015eb9eb6730183824dd | |
parent | 77a2c51e79eb54c8f5cc8903465223cbac6e8d50 (diff) | |
download | busybox-w32-777706cb2352c02602842f89d916a0e18ce6bd91.tar.gz busybox-w32-777706cb2352c02602842f89d916a0e18ce6bd91.tar.bz2 busybox-w32-777706cb2352c02602842f89d916a0e18ce6bd91.zip |
udhcp: remove support for some really old and odd options
function old new delta
dhcp_options 72 68 -4
dhcp_option_strings 271 253 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/udhcp/udhcpd.conf | 16 | ||||
-rw-r--r-- | networking/udhcp/clientpacket.c | 5 | ||||
-rw-r--r-- | networking/udhcp/options.c | 12 | ||||
-rw-r--r-- | networking/udhcp/options.h | 8 | ||||
-rw-r--r-- | networking/udhcp/script.c | 5 |
5 files changed, 25 insertions, 21 deletions
diff --git a/examples/udhcp/udhcpd.conf b/examples/udhcp/udhcpd.conf index 6550cab08..1e05435d4 100644 --- a/examples/udhcp/udhcpd.conf +++ b/examples/udhcp/udhcpd.conf | |||
@@ -8,8 +8,8 @@ end 192.168.0.254 | |||
8 | # The interface that udhcpd will use | 8 | # The interface that udhcpd will use |
9 | interface eth0 | 9 | interface eth0 |
10 | 10 | ||
11 | # The maximim number of leases (includes addresses reserved | 11 | # The maximum number of leases (includes addresses reserved |
12 | # by OFFER's, DECLINE's, and ARP conficts). Will be corrected | 12 | # by OFFER's, DECLINE's, and ARP conflicts). Will be corrected |
13 | # if it's bigger than IP lease block, but it ok to make it | 13 | # if it's bigger than IP lease block, but it ok to make it |
14 | # smaller than lease block. | 14 | # smaller than lease block. |
15 | #max_leases 254 | 15 | #max_leases 254 |
@@ -24,7 +24,7 @@ interface eth0 | |||
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 conflct 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). |
@@ -40,7 +40,7 @@ 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 | # Everytime 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 | ||
@@ -49,7 +49,7 @@ interface eth0 | |||
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 | # The remainer of options are DHCP options and can be specifed with the | 52 | # 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 | 53 | # 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 | 54 | # as the dns option, they can be listed on the same line, or multiple |
55 | # lines. The only option with a default is 'lease'. | 55 | # lines. The only option with a default is 'lease'. |
@@ -58,7 +58,7 @@ opt dns 192.168.10.2 192.168.10.10 | |||
58 | option subnet 255.255.255.0 | 58 | option subnet 255.255.255.0 |
59 | opt router 192.168.10.2 | 59 | opt router 192.168.10.2 |
60 | opt wins 192.168.10.10 | 60 | opt wins 192.168.10.10 |
61 | option dns 129.219.13.81 # appened to above DNS servers for a total of 3 | 61 | option dns 129.219.13.81 # appended to above DNS servers for a total of 3 |
62 | option domain local | 62 | option domain local |
63 | option lease 864000 # 10 days of seconds | 63 | option lease 864000 # 10 days of seconds |
64 | 64 | ||
@@ -67,10 +67,10 @@ option lease 864000 # 10 days of seconds | |||
67 | #opt timezone | 67 | #opt timezone |
68 | #opt router | 68 | #opt router |
69 | #opt timesrv | 69 | #opt timesrv |
70 | #opt namesrv | 70 | #opt namesrv - obsolete, disabled |
71 | #opt dns | 71 | #opt dns |
72 | #opt logsrv | 72 | #opt logsrv |
73 | #opt cookiesrv | 73 | #opt cookiesrv - rarely (never?) used, disabled |
74 | #opt lprsrv | 74 | #opt lprsrv |
75 | #opt bootsize | 75 | #opt bootsize |
76 | #opt domain | 76 | #opt domain |
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 8ccdfcca2..f091d8067 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -62,8 +62,9 @@ static void add_param_req_option(struct dhcp_packet *packet) | |||
62 | int i, len = 0; | 62 | int i, len = 0; |
63 | 63 | ||
64 | for (i = 0; (c = dhcp_options[i].code) != 0; i++) { | 64 | for (i = 0; (c = dhcp_options[i].code) != 0; i++) { |
65 | if (((dhcp_options[i].flags & OPTION_REQ) | 65 | if (( (dhcp_options[i].flags & OPTION_REQ) |
66 | && !client_config.no_default_options) | 66 | && !client_config.no_default_options |
67 | ) | ||
67 | || (client_config.opt_mask[c >> 3] & (1 << (c & 7))) | 68 | || (client_config.opt_mask[c >> 3] & (1 << (c & 7))) |
68 | ) { | 69 | ) { |
69 | packet->options[end + OPT_DATA + len] = c; | 70 | packet->options[end + OPT_DATA + len] = c; |
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index 10ec4597f..6ab5708e6 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c | |||
@@ -11,17 +11,17 @@ | |||
11 | #include "options.h" | 11 | #include "options.h" |
12 | 12 | ||
13 | 13 | ||
14 | /* Supported options are easily added here */ | 14 | /* Supported options are easily added here. See RFC2132 */ |
15 | const struct dhcp_option dhcp_options[] = { | 15 | const struct dhcp_option dhcp_options[] = { |
16 | /* flags code */ | 16 | /* flags code */ |
17 | { OPTION_IP | OPTION_REQ, 0x01 }, /* DHCP_SUBNET */ | 17 | { OPTION_IP | OPTION_REQ, 0x01 }, /* DHCP_SUBNET */ |
18 | { OPTION_S32 , 0x02 }, /* DHCP_TIME_OFFSET */ | 18 | { OPTION_S32 , 0x02 }, /* DHCP_TIME_OFFSET */ |
19 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x03 }, /* DHCP_ROUTER */ | 19 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x03 }, /* DHCP_ROUTER */ |
20 | { OPTION_IP | OPTION_LIST , 0x04 }, /* DHCP_TIME_SERVER */ | 20 | { OPTION_IP | OPTION_LIST , 0x04 }, /* DHCP_TIME_SERVER */ |
21 | { OPTION_IP | OPTION_LIST , 0x05 }, /* DHCP_NAME_SERVER */ | 21 | // { OPTION_IP | OPTION_LIST , 0x05 }, /* DHCP_NAME_SERVER */ |
22 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x06 }, /* DHCP_DNS_SERVER */ | 22 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x06 }, /* DHCP_DNS_SERVER */ |
23 | { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */ | 23 | { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */ |
24 | { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */ | 24 | // { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */ |
25 | { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ | 25 | { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ |
26 | { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ | 26 | { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ |
27 | { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ | 27 | { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ |
@@ -37,7 +37,7 @@ const struct dhcp_option dhcp_options[] = { | |||
37 | { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ | 37 | { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ |
38 | { OPTION_IP , 0x32 }, /* DHCP_REQUESTED_IP */ | 38 | { OPTION_IP , 0x32 }, /* DHCP_REQUESTED_IP */ |
39 | { OPTION_U32 , 0x33 }, /* DHCP_LEASE_TIME */ | 39 | { OPTION_U32 , 0x33 }, /* DHCP_LEASE_TIME */ |
40 | { OPTION_U8 , 0x35 }, /* dhcptype */ | 40 | { OPTION_U8 , 0x35 }, /* DHCP_MESSAGE_TYPE */ |
41 | { OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */ | 41 | { OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */ |
42 | { OPTION_STRING , 0x38 }, /* DHCP_MESSAGE */ | 42 | { OPTION_STRING , 0x38 }, /* DHCP_MESSAGE */ |
43 | { OPTION_STRING , 0x3C }, /* DHCP_VENDOR */ | 43 | { OPTION_STRING , 0x3C }, /* DHCP_VENDOR */ |
@@ -68,10 +68,10 @@ const char dhcp_option_strings[] ALIGN1 = | |||
68 | "timezone" "\0" /* DHCP_TIME_OFFSET */ | 68 | "timezone" "\0" /* DHCP_TIME_OFFSET */ |
69 | "router" "\0" /* DHCP_ROUTER */ | 69 | "router" "\0" /* DHCP_ROUTER */ |
70 | "timesrv" "\0" /* DHCP_TIME_SERVER */ | 70 | "timesrv" "\0" /* DHCP_TIME_SERVER */ |
71 | "namesrv" "\0" /* DHCP_NAME_SERVER */ | 71 | // "namesrv" "\0" /* DHCP_NAME_SERVER */ |
72 | "dns" "\0" /* DHCP_DNS_SERVER */ | 72 | "dns" "\0" /* DHCP_DNS_SERVER */ |
73 | "logsrv" "\0" /* DHCP_LOG_SERVER */ | 73 | "logsrv" "\0" /* DHCP_LOG_SERVER */ |
74 | "cookiesrv" "\0" /* DHCP_COOKIE_SERVER */ | 74 | // "cookiesrv" "\0" /* DHCP_COOKIE_SERVER */ |
75 | "lprsrv" "\0" /* DHCP_LPR_SERVER */ | 75 | "lprsrv" "\0" /* DHCP_LPR_SERVER */ |
76 | "hostname" "\0" /* DHCP_HOST_NAME */ | 76 | "hostname" "\0" /* DHCP_HOST_NAME */ |
77 | "bootsize" "\0" /* DHCP_BOOT_SIZE */ | 77 | "bootsize" "\0" /* DHCP_BOOT_SIZE */ |
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index aeed36907..8f6ab0f15 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h | |||
@@ -41,10 +41,10 @@ enum { | |||
41 | #define DHCP_TIME_OFFSET 0x02 | 41 | #define DHCP_TIME_OFFSET 0x02 |
42 | #define DHCP_ROUTER 0x03 | 42 | #define DHCP_ROUTER 0x03 |
43 | #define DHCP_TIME_SERVER 0x04 | 43 | #define DHCP_TIME_SERVER 0x04 |
44 | #define DHCP_NAME_SERVER 0x05 | 44 | //#define DHCP_NAME_SERVER 0x05 /* _really_ ancient */ |
45 | #define DHCP_DNS_SERVER 0x06 | 45 | #define DHCP_DNS_SERVER 0x06 |
46 | #define DHCP_LOG_SERVER 0x07 | 46 | #define DHCP_LOG_SERVER 0x07 |
47 | #define DHCP_COOKIE_SERVER 0x08 | 47 | //#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" */ |
48 | #define DHCP_LPR_SERVER 0x09 | 48 | #define DHCP_LPR_SERVER 0x09 |
49 | #define DHCP_HOST_NAME 0x0c | 49 | #define DHCP_HOST_NAME 0x0c |
50 | #define DHCP_BOOT_SIZE 0x0d | 50 | #define DHCP_BOOT_SIZE 0x0d |
@@ -64,8 +64,8 @@ enum { | |||
64 | #define DHCP_PARAM_REQ 0x37 | 64 | #define DHCP_PARAM_REQ 0x37 |
65 | #define DHCP_MESSAGE 0x38 | 65 | #define DHCP_MESSAGE 0x38 |
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 | 69 | #define DHCP_VENDOR 0x3c |
70 | #define DHCP_CLIENT_ID 0x3d | 70 | #define DHCP_CLIENT_ID 0x3d |
71 | #define DHCP_FQDN 0x51 | 71 | #define DHCP_FQDN 0x51 |
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c index a74697c90..dc658ada8 100644 --- a/networking/udhcp/script.c +++ b/networking/udhcp/script.c | |||
@@ -78,8 +78,11 @@ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_ | |||
78 | *dest++ = '/'; | 78 | *dest++ = '/'; |
79 | option += 4; | 79 | option += 4; |
80 | optlen = 4; | 80 | optlen = 4; |
81 | case OPTION_IP: /* Works regardless of host byte order. */ | 81 | case OPTION_IP: |
82 | dest += sprint_nip(dest, "", option); | 82 | dest += sprint_nip(dest, "", option); |
83 | // TODO: it can be a list only if (type_p->flags & OPTION_LIST). | ||
84 | // Should we bail out/warn if we see multi-ip option which is | ||
85 | // not allowed to be such? For example, DHCP_BROADCAST... | ||
83 | break; | 86 | break; |
84 | case OPTION_BOOLEAN: | 87 | case OPTION_BOOLEAN: |
85 | dest += sprintf(dest, *option ? "yes" : "no"); | 88 | dest += sprintf(dest, *option ? "yes" : "no"); |