B#12795: don't convert clientid option to hex

This commit is contained in:
Amin Ben Romdhane 2023-11-29 15:45:02 +00:00
parent f43885b47d
commit b05a69ec54
3 changed files with 5 additions and 4 deletions

View file

@ -125,6 +125,7 @@ struct dhcp_options_type DHCP_OPTIONS_ARRAY[] = {
{"", 58, OPTION_INT, 4}, /* DHCP_RENEWAL_TIME */
{"", 59, OPTION_INT, 4}, /* DHCP_REBINDING_TIME */
{"vendor", 60, OPTION_STRING, 0}, /* DHCP_VENDOR */
{"", 61, OPTION_HEX, 1}, /* DHCP_CLIENT_IDENTIFIER */
{"", 65, OPTION_IP, 4}, /* DHCP_NIS_SERVER_ADDR */
{"tftp", 66, OPTION_STRING, 0}, /* DHCP_TFTP_SERVER_NAME */
{"bootfile", 67, OPTION_STRING, 0}, /* DHCP_BOOT_FILE */

View file

@ -2641,7 +2641,7 @@ static int set_DHCPv4ClientSentOption_Enable(char *refparam, struct dmctx *ctx,
char str[256] = {0};
convert_hex_to_string(dhcp_client_s->value, str, sizeof(str));
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, b ? str : "");
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, b ? (DM_STRTOL(dhcp_client_s->option_tag) == DHCP_OPTION_CLIENTID) ? dhcp_client_s->value : str : "");
}
}
@ -2716,7 +2716,7 @@ static int set_DHCPv4ClientSentOption_Tag(char *refparam, struct dmctx *ctx, voi
dmuci_set_value_by_section(dhcp_client_s->client_sect, "sendopts", sendopts);
} else {
convert_hex_to_string(dhcp_client_s->value, str, sizeof(str));
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, str);
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, (DM_STRTOL(value) == DHCP_OPTION_CLIENTID) ? dhcp_client_s->value : str);
}
}
}
@ -2771,7 +2771,7 @@ static int set_DHCPv4ClientSentOption_Value(char *refparam, struct dmctx *ctx, v
dmuci_set_value_by_section(dhcp_client_s->client_sect, "sendopts", sendopts);
} else {
convert_hex_to_string(value, str, sizeof(str));
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, str);
dmuci_set_value_by_section(dhcp_client_s->client_sect, option_name, (DM_STRTOL(dhcp_client_s->option_tag) == DHCP_OPTION_CLIENTID) ? value : str);
}
}
}

View file

@ -29,7 +29,7 @@ config interface 'wan'
option proto 'dhcp'
option hostname 'iopsysWrt-44D43771B810'
option vendorid 'dslforum.org'
option clientid '44:D4:37:71:B8:10'
option clientid '01:44:D4:37:71:B8:10'
option device 'eth0'
option reqopts '12 43 55'
option sendopts '0x38:6661696c20746f20636f6e6e656374 125:00:00:0D:E9:1C:01:06:34:34:44:34:33:37:02:0B:59:30:37:32:31:31:34:30:30:38:36:03:05:45:41:47:4C:45 lease:3600 41:C0A80A0C0A0C013F2D2D2D15 router:10.10.10.8,35.35.40.45,192.168.11.11'