diff options
Diffstat (limited to 'networking/udhcp/options.c')
-rw-r--r-- | networking/udhcp/options.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index 6ab5708e6..c2a230527 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c | |||
@@ -11,7 +11,9 @@ | |||
11 | #include "options.h" | 11 | #include "options.h" |
12 | 12 | ||
13 | 13 | ||
14 | /* Supported options are easily added here. See RFC2132 */ | 14 | /* Supported options are easily added here. |
15 | * See RFC2132 for more options. | ||
16 | */ | ||
15 | const struct dhcp_option dhcp_options[] = { | 17 | const struct dhcp_option dhcp_options[] = { |
16 | /* flags code */ | 18 | /* flags code */ |
17 | { OPTION_IP | OPTION_REQ, 0x01 }, /* DHCP_SUBNET */ | 19 | { OPTION_IP | OPTION_REQ, 0x01 }, /* DHCP_SUBNET */ |
@@ -25,7 +27,7 @@ const struct dhcp_option dhcp_options[] = { | |||
25 | { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ | 27 | { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ |
26 | { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ | 28 | { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ |
27 | { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ | 29 | { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ |
28 | { OPTION_STRING | OPTION_LIST | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */ | 30 | { OPTION_STRING | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */ |
29 | { OPTION_IP , 0x10 }, /* DHCP_SWAP_SERVER */ | 31 | { OPTION_IP , 0x10 }, /* DHCP_SWAP_SERVER */ |
30 | { OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */ | 32 | { OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */ |
31 | { OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */ | 33 | { OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */ |
@@ -35,16 +37,13 @@ const struct dhcp_option dhcp_options[] = { | |||
35 | { OPTION_IP | OPTION_LIST , 0x29 }, /* nissrv */ | 37 | { OPTION_IP | OPTION_LIST , 0x29 }, /* nissrv */ |
36 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a }, /* DHCP_NTP_SERVER */ | 38 | { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a }, /* DHCP_NTP_SERVER */ |
37 | { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ | 39 | { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ |
38 | { OPTION_IP , 0x32 }, /* DHCP_REQUESTED_IP */ | ||
39 | { OPTION_U32 , 0x33 }, /* DHCP_LEASE_TIME */ | 40 | { OPTION_U32 , 0x33 }, /* DHCP_LEASE_TIME */ |
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 */ | ||
44 | { OPTION_STRING , 0x3D }, /* DHCP_CLIENT_ID */ | ||
45 | { OPTION_STRING , 0x42 }, /* tftp */ | 43 | { OPTION_STRING , 0x42 }, /* tftp */ |
46 | { OPTION_STRING , 0x43 }, /* bootfile */ | 44 | { OPTION_STRING , 0x43 }, /* bootfile */ |
47 | { OPTION_STRING , 0x4D }, /* userclass */ | 45 | //TODO: not a string, but a set of LASCII strings: |
46 | // { OPTION_STRING , 0x4D }, /* userclass */ | ||
48 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 47 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
49 | { OPTION_STR1035 | OPTION_LIST , 0x77 }, /* search */ | 48 | { OPTION_STR1035 | OPTION_LIST , 0x77 }, /* search */ |
50 | #endif | 49 | #endif |
@@ -54,14 +53,23 @@ const struct dhcp_option dhcp_options[] = { | |||
54 | 53 | ||
55 | /* Options below have no match in dhcp_option_strings[], | 54 | /* Options below have no match in dhcp_option_strings[], |
56 | * are not passed to dhcpc scripts, and cannot be specified | 55 | * are not passed to dhcpc scripts, and cannot be specified |
57 | * with "option XXX YYY" syntax in dhcpd config file. */ | 56 | * with "option XXX YYY" syntax in dhcpd config file. |
57 | * These entries are only used internally by udhcp[cd] | ||
58 | * to correctly encode options into packets. | ||
59 | */ | ||
58 | 60 | ||
61 | { OPTION_IP , 0x32 }, /* DHCP_REQUESTED_IP */ | ||
62 | { OPTION_U8 , 0x35 }, /* DHCP_MESSAGE_TYPE */ | ||
59 | { OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */ | 63 | { OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */ |
64 | { OPTION_STRING , 0x3C }, /* DHCP_VENDOR */ | ||
65 | { OPTION_STRING , 0x3D }, /* DHCP_CLIENT_ID */ | ||
60 | { 0, 0 } /* zeroed terminating entry */ | 66 | { 0, 0 } /* zeroed terminating entry */ |
61 | }; | 67 | }; |
62 | 68 | ||
63 | /* Used for converting options from incoming packets to env variables | 69 | /* Used for converting options from incoming packets to env variables |
64 | * for udhcpc stript */ | 70 | * for udhcpc stript, and for setting options for udhcpd via |
71 | * "opt OPTION_NAME OPTION_VALUE" directives in udhcpd.conf file. | ||
72 | */ | ||
65 | /* Must match dhcp_options[] order */ | 73 | /* Must match dhcp_options[] order */ |
66 | const char dhcp_option_strings[] ALIGN1 = | 74 | const char dhcp_option_strings[] ALIGN1 = |
67 | "subnet" "\0" /* DHCP_SUBNET */ | 75 | "subnet" "\0" /* DHCP_SUBNET */ |
@@ -85,19 +93,17 @@ const char dhcp_option_strings[] ALIGN1 = | |||
85 | "nissrv" "\0" /* */ | 93 | "nissrv" "\0" /* */ |
86 | "ntpsrv" "\0" /* DHCP_NTP_SERVER */ | 94 | "ntpsrv" "\0" /* DHCP_NTP_SERVER */ |
87 | "wins" "\0" /* DHCP_WINS_SERVER */ | 95 | "wins" "\0" /* DHCP_WINS_SERVER */ |
88 | "requestip" "\0" /* DHCP_REQUESTED_IP */ | ||
89 | "lease" "\0" /* DHCP_LEASE_TIME */ | 96 | "lease" "\0" /* DHCP_LEASE_TIME */ |
90 | "dhcptype" "\0" /* */ | ||
91 | "serverid" "\0" /* DHCP_SERVER_ID */ | 97 | "serverid" "\0" /* DHCP_SERVER_ID */ |
92 | "message" "\0" /* DHCP_MESSAGE */ | 98 | "message" "\0" /* DHCP_MESSAGE */ |
93 | "vendorclass" "\0" /* DHCP_VENDOR */ | ||
94 | "clientid" "\0" /* DHCP_CLIENT_ID */ | ||
95 | "tftp" "\0" | 99 | "tftp" "\0" |
96 | "bootfile" "\0" | 100 | "bootfile" "\0" |
97 | "userclass" "\0" | 101 | // "userclass" "\0" |
98 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 102 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
99 | "search" "\0" | 103 | "search" "\0" |
100 | #endif | 104 | #endif |
105 | // "staticroutes" is only used to set udhcpc environment, it doesn't work | ||
106 | // in udhcpd.conf since OPTION_STATIC_ROUTES is not handled yet: | ||
101 | "staticroutes" "\0" /* DHCP_STATIC_ROUTES */ | 107 | "staticroutes" "\0" /* DHCP_STATIC_ROUTES */ |
102 | /* MSIE's "Web Proxy Autodiscovery Protocol" support */ | 108 | /* MSIE's "Web Proxy Autodiscovery Protocol" support */ |
103 | "wpad" "\0" | 109 | "wpad" "\0" |