Lines Matching refs:option
177 static void *d6_find_option(uint8_t *option, uint8_t *option_end, unsigned code) in d6_find_option() argument
180 int len_m4 = option_end - option - 4; in d6_find_option()
183 if (option[3] > len_m4) in d6_find_option()
189 if (option[0] != 0 || option[2] != 0) in d6_find_option()
193 if (option[1] == code) in d6_find_option()
194 return option; /* yes! */ in d6_find_option()
195 len_m4 -= option[3] + 4; in d6_find_option()
196 option += option[3] + 4; in d6_find_option()
201 static void *d6_copy_option(uint8_t *option, uint8_t *option_end, unsigned code) in d6_copy_option() argument
203 uint8_t *opt = d6_find_option(option, option_end, code); in d6_copy_option()
217 static char *string_option_to_env(const uint8_t *option, in string_option_to_env() argument
227 if (d6_optflags[i].code == option[1]) { in string_option_to_env()
234 bb_error_msg("can't find option name for 0x%x, skipping", option[1]); in string_option_to_env()
238 val_len = (option[2] << 8) | option[3]; in string_option_to_env()
239 if (val_len + &option[D6_OPT_DATA] > option_end) { in string_option_to_env()
243 return xasprintf("%s=%.*s", name, val_len, (char*)option + 4); in string_option_to_env()
247 static void option_to_env(const uint8_t *option, const uint8_t *option_end) in option_to_env() argument
253 int len_m4 = option_end - option - 4; in option_to_env()
259 if (option[0] != 0 || option[2] != 0) in option_to_env()
263 if (option[3] > len_m4) in option_to_env()
266 switch (option[1]) { in option_to_env()
271 option_to_env(option + 16, option + 4 + option[3]); in option_to_env()
291 if (option[3] < 24) in option_to_env()
294 sprint_nip6(ipv6str, option + 4); in option_to_env()
297 move_from_unaligned32(v32, option + 4 + 16 + 4); in option_to_env()
334 move_from_unaligned32(v32, option + 4 + 4); in option_to_env()
337 sprint_nip6(ipv6str, option + 4 + 4 + 4 + 1); in option_to_env()
338 *new_env() = xasprintf("ipv6prefix=%s/%u", ipv6str, (unsigned)(option[4 + 4 + 4])); in option_to_env()
345 if ((option[3] & 0x0f) != 0) in option_to_env()
349 addrs = option[3] >> 4; in option_to_env()
357 sprint_nip6(dlist, option + 4 + option_offset); in option_to_env()
369 dlist = dname_dec(option + 4, (option[2] << 8) | option[3], "search="); in option_to_env()
380 if (option[3] == 0) in option_to_env()
389 if (option[4] & 0xf8) { in option_to_env()
390 *new_env() = xasprintf("fqdn=%.*s", (int)option[3], (char*)option + 4); in option_to_env()
393 dlist = dname_dec(option + 5, (/*(option[2] << 8) |*/ option[3]) - 1, "fqdn="); in option_to_env()
403 *new_env() = xasprintf("tz=%.*s", (int)option[3], (char*)option + 4); in option_to_env()
406 *new_env() = xasprintf("tz_name=%.*s", (int)option[3], (char*)option + 4); in option_to_env()
414 char *tmp = string_option_to_env(option, option_end); in option_to_env()
420 len_m4 -= 4 + option[3]; in option_to_env()
421 option += 4 + option[3]; in option_to_env()
425 static char **fill_envp(const uint8_t *option, const uint8_t *option_end) in fill_envp() argument
434 if (option) in fill_envp()
435 option_to_env(option, option_end); in fill_envp()
445 static void d6_run_script(const uint8_t *option, const uint8_t *option_end, in d6_run_script() argument
451 envp = fill_envp(option, option_end); in d6_run_script()
512 unsigned option; in add_d6_client_options() local
516 for (option = 1; option < 256; option++) { in add_d6_client_options()
517 if (client_data.opt_mask[option >> 3] & (1 << (option & 7))) { in add_d6_client_options()
518 ptr[0] = (option >> 8); in add_d6_client_options()
519 ptr[1] = option; in add_d6_client_options()
1608 struct d6_option *option; in udhcpc6_main() local
1616 option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE); in udhcpc6_main()
1617 if (option && (option->data[0] | option->data[1]) != 0) { in udhcpc6_main()
1619 bb_info_msg("received DHCP NAK (%u)", option->data[4]); in udhcpc6_main()
1632 option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID); in udhcpc6_main()
1633 if (!option) { in udhcpc6_main()
1642 client6_data.server_id = option; in udhcpc6_main()