From 6027597fd1a1a9293818db4729625fff375bf907 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 May 2018 11:06:35 +0200 Subject: udhcpc6: set -x options in request Last foru commits: function old new delta option_to_env 621 791 +170 .rodata 168351 168505 +154 attach_option 431 506 +75 add_d6_client_options 112 167 +55 d6_option_strings 30 84 +54 udhcp_str2optset 644 660 +16 d6_optflags 12 20 +8 udhcpc6_main 2590 2596 +6 udhcpc_main 2648 2651 +3 read_optset 15 18 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 10/0 up/down: 544/0) Total: 544 bytes Signed-off-by: Denys Vlasenko --- networking/udhcp/d6_dhcpc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'networking/udhcp/d6_dhcpc.c') diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index 85068721a..9e3ce8b1c 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c @@ -484,8 +484,10 @@ static uint8_t *init_d6_packet(struct d6_packet *packet, char type, uint32_t xid static uint8_t *add_d6_client_options(uint8_t *ptr) { + struct option_set *curr; uint8_t *start = ptr; unsigned option; + uint16_t len; ptr += 4; for (option = 1; option < 256; option++) { @@ -508,7 +510,12 @@ static uint8_t *add_d6_client_options(uint8_t *ptr) ptr = mempcpy(ptr, &opt_fqdn_req, sizeof(opt_fqdn_req)); #endif /* Add -x options if any */ - //... + curr = client_config.options; + while (curr) { + len = (curr->data[D6_OPT_LEN] << 8) | curr->data[D6_OPT_LEN + 1]; + ptr = mempcpy(ptr, curr->data, D6_OPT_DATA + len); + curr = curr->next; + } return ptr; } @@ -1215,7 +1222,10 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) } while (list_x) { char *optstr = xstrdup(llist_pop(&list_x)); - udhcp_str2optset(optstr, &client_config.options, d6_optflags, d6_option_strings); + udhcp_str2optset(optstr, &client_config.options, + d6_optflags, d6_option_strings, + /*dhcpv6:*/ 1 + ); free(optstr); } -- cgit v1.2.3