aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/options.c')
-rw-r--r--networking/udhcp/options.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 02c251083..652647229 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -73,12 +73,12 @@ uint8_t *get_option(struct dhcpMessage *packet, int code)
73 length = 308; 73 length = 308;
74 while (!done) { 74 while (!done) {
75 if (i >= length) { 75 if (i >= length) {
76 LOG(LOG_WARNING, "bogus packet, option fields too long."); 76 bb_error_msg("Bogus packet, option fields too long");
77 return NULL; 77 return NULL;
78 } 78 }
79 if (optionptr[i + OPT_CODE] == code) { 79 if (optionptr[i + OPT_CODE] == code) {
80 if (i + 1 + optionptr[i + OPT_LEN] >= length) { 80 if (i + 1 + optionptr[i + OPT_LEN] >= length) {
81 LOG(LOG_WARNING, "bogus packet, option fields too long."); 81 bb_error_msg("Bogus packet, option fields too long");
82 return NULL; 82 return NULL;
83 } 83 }
84 return optionptr + i + 2; 84 return optionptr + i + 2;
@@ -89,7 +89,7 @@ uint8_t *get_option(struct dhcpMessage *packet, int code)
89 break; 89 break;
90 case DHCP_OPTION_OVER: 90 case DHCP_OPTION_OVER:
91 if (i + 1 + optionptr[i + OPT_LEN] >= length) { 91 if (i + 1 + optionptr[i + OPT_LEN] >= length) {
92 LOG(LOG_WARNING, "bogus packet, option fields too long."); 92 bb_error_msg("Bogus packet, option fields too long");
93 return NULL; 93 return NULL;
94 } 94 }
95 over = optionptr[i + 3]; 95 over = optionptr[i + 3];
@@ -137,10 +137,11 @@ int add_option_string(uint8_t *optionptr, uint8_t *string)
137 137
138 /* end position + string length + option code/length + end option */ 138 /* end position + string length + option code/length + end option */
139 if (end + string[OPT_LEN] + 2 + 1 >= 308) { 139 if (end + string[OPT_LEN] + 2 + 1 >= 308) {
140 LOG(LOG_ERR, "Option 0x%02x did not fit into the packet!", string[OPT_CODE]); 140 bb_error_msg("Option 0x%02x did not fit into the packet",
141 string[OPT_CODE]);
141 return 0; 142 return 0;
142 } 143 }
143 DEBUG(LOG_INFO, "adding option 0x%02x", string[OPT_CODE]); 144 DEBUG("adding option 0x%02x", string[OPT_CODE]);
144 memcpy(optionptr + end, string, string[OPT_LEN] + 2); 145 memcpy(optionptr + end, string, string[OPT_LEN] + 2);
145 optionptr[end + string[OPT_LEN] + 2] = DHCP_END; 146 optionptr[end + string[OPT_LEN] + 2] = DHCP_END;
146 return string[OPT_LEN] + 2; 147 return string[OPT_LEN] + 2;
@@ -167,6 +168,6 @@ int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data)
167 } 168 }
168 } 169 }
169 170
170 DEBUG(LOG_ERR, "Could not add option 0x%02x", code); 171 bb_error_msg("Could not add option 0x%02x", code);
171 return 0; 172 return 0;
172} 173}