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) |
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 # The interface that udhcpd will use interface eth0 -# The maximim number of leases (includes addresses reserved -# by OFFER's, DECLINE's, and ARP conficts). Will be corrected +# The maximum number of leases (includes addresses reserved +# by OFFER's, DECLINE's, and ARP conflicts). Will be corrected # if it's bigger than IP lease block, but it ok to make it # smaller than lease block. #max_leases 254 @@ -24,7 +24,7 @@ interface eth0 #decline_time 3600 # The amount of time that an IP will be reserved -# if an ARP conflct occurs (seconds). +# if an ARP conflict occurs (seconds). #conflict_time 3600 # How long an offered address is reserved (seconds). @@ -40,7 +40,7 @@ interface eth0 # The location of the pid file #pidfile /var/run/udhcpd.pid -# Everytime udhcpd writes a leases file, the below script will be called. +# Every time udhcpd writes a leases file, the below script will be called. #notify_file # default: no script #notify_file dumpleases # useful for debugging @@ -49,7 +49,7 @@ interface eth0 #sname zorak #default: none #boot_file /var/nfs_root #default: none -# The remainer of options are DHCP options and can be specifed with the +# The remainder of options are DHCP options and can be specified with the # keyword 'opt' or 'option'. If an option can take multiple items, such # as the dns option, they can be listed on the same line, or multiple # lines. The only option with a default is 'lease'. @@ -58,7 +58,7 @@ opt dns 192.168.10.2 192.168.10.10 option subnet 255.255.255.0 opt router 192.168.10.2 opt wins 192.168.10.10 -option dns 129.219.13.81 # appened to above DNS servers for a total of 3 +option dns 129.219.13.81 # appended to above DNS servers for a total of 3 option domain local option lease 864000 # 10 days of seconds @@ -67,10 +67,10 @@ option lease 864000 # 10 days of seconds #opt timezone #opt router #opt timesrv -#opt namesrv +#opt namesrv - obsolete, disabled #opt dns #opt logsrv -#opt cookiesrv +#opt cookiesrv - rarely (never?) used, disabled #opt lprsrv #opt bootsize #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) int i, len = 0; for (i = 0; (c = dhcp_options[i].code) != 0; i++) { - if (((dhcp_options[i].flags & OPTION_REQ) - && !client_config.no_default_options) + if (( (dhcp_options[i].flags & OPTION_REQ) + && !client_config.no_default_options + ) || (client_config.opt_mask[c >> 3] & (1 << (c & 7))) ) { 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 @@ #include "options.h" -/* Supported options are easily added here */ +/* Supported options are easily added here. See RFC2132 */ const struct dhcp_option dhcp_options[] = { /* flags code */ { OPTION_IP | OPTION_REQ, 0x01 }, /* DHCP_SUBNET */ { OPTION_S32 , 0x02 }, /* DHCP_TIME_OFFSET */ { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x03 }, /* DHCP_ROUTER */ { OPTION_IP | OPTION_LIST , 0x04 }, /* DHCP_TIME_SERVER */ - { OPTION_IP | OPTION_LIST , 0x05 }, /* DHCP_NAME_SERVER */ +// { OPTION_IP | OPTION_LIST , 0x05 }, /* DHCP_NAME_SERVER */ { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x06 }, /* DHCP_DNS_SERVER */ { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */ - { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */ +// { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */ { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ @@ -37,7 +37,7 @@ const struct dhcp_option dhcp_options[] = { { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ { OPTION_IP , 0x32 }, /* DHCP_REQUESTED_IP */ { OPTION_U32 , 0x33 }, /* DHCP_LEASE_TIME */ - { OPTION_U8 , 0x35 }, /* dhcptype */ + { OPTION_U8 , 0x35 }, /* DHCP_MESSAGE_TYPE */ { OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */ { OPTION_STRING , 0x38 }, /* DHCP_MESSAGE */ { OPTION_STRING , 0x3C }, /* DHCP_VENDOR */ @@ -68,10 +68,10 @@ const char dhcp_option_strings[] ALIGN1 = "timezone" "\0" /* DHCP_TIME_OFFSET */ "router" "\0" /* DHCP_ROUTER */ "timesrv" "\0" /* DHCP_TIME_SERVER */ - "namesrv" "\0" /* DHCP_NAME_SERVER */ +// "namesrv" "\0" /* DHCP_NAME_SERVER */ "dns" "\0" /* DHCP_DNS_SERVER */ "logsrv" "\0" /* DHCP_LOG_SERVER */ - "cookiesrv" "\0" /* DHCP_COOKIE_SERVER */ +// "cookiesrv" "\0" /* DHCP_COOKIE_SERVER */ "lprsrv" "\0" /* DHCP_LPR_SERVER */ "hostname" "\0" /* DHCP_HOST_NAME */ "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 { #define DHCP_TIME_OFFSET 0x02 #define DHCP_ROUTER 0x03 #define DHCP_TIME_SERVER 0x04 -#define DHCP_NAME_SERVER 0x05 +//#define DHCP_NAME_SERVER 0x05 /* _really_ ancient */ #define DHCP_DNS_SERVER 0x06 #define DHCP_LOG_SERVER 0x07 -#define DHCP_COOKIE_SERVER 0x08 +//#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" */ #define DHCP_LPR_SERVER 0x09 #define DHCP_HOST_NAME 0x0c #define DHCP_BOOT_SIZE 0x0d @@ -64,8 +64,8 @@ enum { #define DHCP_PARAM_REQ 0x37 #define DHCP_MESSAGE 0x38 #define DHCP_MAX_SIZE 0x39 -#define DHCP_T1 0x3a -#define DHCP_T2 0x3b +//#define DHCP_T1 0x3a +//#define DHCP_T2 0x3b #define DHCP_VENDOR 0x3c #define DHCP_CLIENT_ID 0x3d #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_ *dest++ = '/'; option += 4; optlen = 4; - case OPTION_IP: /* Works regardless of host byte order. */ + case OPTION_IP: dest += sprint_nip(dest, "", option); +// TODO: it can be a list only if (type_p->flags & OPTION_LIST). +// Should we bail out/warn if we see multi-ip option which is +// not allowed to be such? For example, DHCP_BROADCAST... break; case OPTION_BOOLEAN: dest += sprintf(dest, *option ? "yes" : "no"); |