aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/common.c')
-rw-r--r--networking/udhcp/common.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index a89dce3ae..cf6b1ca91 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -29,9 +29,9 @@ const struct dhcp_optflag dhcp_optflags[] = {
29// { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */ 29// { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */
30// { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */ 30// { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */
31 { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */ 31 { OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */
32 { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */ 32 { OPTION_STRING_HOST | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */
33 { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */ 33 { OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */
34 { OPTION_STRING | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */ 34 { OPTION_STRING_HOST | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */
35 { OPTION_IP , 0x10 }, /* DHCP_SWAP_SERVER */ 35 { OPTION_IP , 0x10 }, /* DHCP_SWAP_SERVER */
36 { OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */ 36 { OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */
37 { OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */ 37 { OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */
@@ -41,7 +41,7 @@ const struct dhcp_optflag dhcp_optflags[] = {
41//server would let us know anyway? 41//server would let us know anyway?
42 { OPTION_IP | OPTION_REQ, 0x1c }, /* DHCP_BROADCAST */ 42 { OPTION_IP | OPTION_REQ, 0x1c }, /* DHCP_BROADCAST */
43 { OPTION_IP_PAIR | OPTION_LIST , 0x21 }, /* DHCP_ROUTES */ 43 { OPTION_IP_PAIR | OPTION_LIST , 0x21 }, /* DHCP_ROUTES */
44 { OPTION_STRING , 0x28 }, /* DHCP_NIS_DOMAIN */ 44 { OPTION_STRING_HOST , 0x28 }, /* DHCP_NIS_DOMAIN */
45 { OPTION_IP | OPTION_LIST , 0x29 }, /* DHCP_NIS_SERVER */ 45 { OPTION_IP | OPTION_LIST , 0x29 }, /* DHCP_NIS_SERVER */
46 { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a }, /* DHCP_NTP_SERVER */ 46 { OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a }, /* DHCP_NTP_SERVER */
47 { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */ 47 { OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */
@@ -49,7 +49,7 @@ const struct dhcp_optflag dhcp_optflags[] = {
49 { OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */ 49 { OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */
50 { OPTION_STRING , 0x38 }, /* DHCP_ERR_MESSAGE */ 50 { OPTION_STRING , 0x38 }, /* DHCP_ERR_MESSAGE */
51//TODO: must be combined with 'sname' and 'file' handling: 51//TODO: must be combined with 'sname' and 'file' handling:
52 { OPTION_STRING , 0x42 }, /* DHCP_TFTP_SERVER_NAME */ 52 { OPTION_STRING_HOST , 0x42 }, /* DHCP_TFTP_SERVER_NAME */
53 { OPTION_STRING , 0x43 }, /* DHCP_BOOT_FILE */ 53 { OPTION_STRING , 0x43 }, /* DHCP_BOOT_FILE */
54//TODO: not a string, but a set of LASCII strings: 54//TODO: not a string, but a set of LASCII strings:
55// { OPTION_STRING , 0x4D }, /* DHCP_USER_CLASS */ 55// { OPTION_STRING , 0x4D }, /* DHCP_USER_CLASS */
@@ -148,6 +148,7 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = {
148 [OPTION_IP_PAIR] = 8, 148 [OPTION_IP_PAIR] = 8,
149// [OPTION_BOOLEAN] = 1, 149// [OPTION_BOOLEAN] = 1,
150 [OPTION_STRING] = 1, /* ignored by udhcp_str2optset */ 150 [OPTION_STRING] = 1, /* ignored by udhcp_str2optset */
151 [OPTION_STRING_HOST] = 1, /* ignored by udhcp_str2optset */
151#if ENABLE_FEATURE_UDHCP_RFC3397 152#if ENABLE_FEATURE_UDHCP_RFC3397
152 [OPTION_DNS_STRING] = 1, /* ignored by both udhcp_str2optset and xmalloc_optname_optval */ 153 [OPTION_DNS_STRING] = 1, /* ignored by both udhcp_str2optset and xmalloc_optname_optval */
153 [OPTION_SIP_SERVERS] = 1, 154 [OPTION_SIP_SERVERS] = 1,
@@ -417,7 +418,9 @@ static NOINLINE void attach_option(
417 /* actually 255 is ok too, but adding a space can overlow it */ 418 /* actually 255 is ok too, but adding a space can overlow it */
418 419
419 existing->data = xrealloc(existing->data, OPT_DATA + 1 + old_len + length); 420 existing->data = xrealloc(existing->data, OPT_DATA + 1 + old_len + length);
420 if ((optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING) { 421 if ((optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING
422 || (optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING_HOST
423 ) {
421 /* add space separator between STRING options in a list */ 424 /* add space separator between STRING options in a list */
422 existing->data[OPT_DATA + old_len] = ' '; 425 existing->data[OPT_DATA + old_len] = ' ';
423 old_len++; 426 old_len++;
@@ -481,6 +484,7 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg)
481 retval = udhcp_str2nip(val, buffer + 4); 484 retval = udhcp_str2nip(val, buffer + 4);
482 break; 485 break;
483 case OPTION_STRING: 486 case OPTION_STRING:
487 case OPTION_STRING_HOST:
484#if ENABLE_FEATURE_UDHCP_RFC3397 488#if ENABLE_FEATURE_UDHCP_RFC3397
485 case OPTION_DNS_STRING: 489 case OPTION_DNS_STRING:
486#endif 490#endif