-
Notifications
You must be signed in to change notification settings - Fork 11
RDKB-62810,RDKB-62812:initialize DHCP for Voice interface #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d58ffa3
53f20da
65e0864
3673d2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -89,6 +89,7 @@ static int udhcpc_get_req_options (char * buff, dhcp_opt_list * req_opt_list) | |||||
| * @param[in] ascii_len Length of the output buffer. | ||||||
| * @return 0 on success, -1 on failure. | ||||||
| */ | ||||||
|
|
||||||
| static int hex_to_ascii(const char *hex, char *ascii, size_t ascii_len) | ||||||
| { | ||||||
| if (hex == NULL || ascii == NULL || ascii_len == 0) | ||||||
|
|
@@ -139,27 +140,32 @@ static int udhcpc_get_send_options (char * buff, dhcp_opt_list * send_opt_list) | |||||
| return SUCCESS; | ||||||
| } | ||||||
|
|
||||||
| char args [BUFLEN_128] = {0}; | ||||||
| char args [BUFLEN_512] = {0}; | ||||||
| while ((send_opt_list != NULL) && (send_opt_list->dhcp_opt_val != NULL)) | ||||||
| { | ||||||
| memset (&args, 0, BUFLEN_128); | ||||||
| memset (&args, 0, BUFLEN_512); | ||||||
| if (send_opt_list->dhcp_opt == DHCPV4_OPT_60) | ||||||
| { | ||||||
| /* Option 60 - Vendor Class Identifier has udhcp cmd line arg "-V <option-str>" | ||||||
| * If this option is not set with '-V' then udhcpc will add a default vendor class option with its name and version. | ||||||
| * So we need to set this option with '-V' with ACSII string. | ||||||
| */ | ||||||
|
|
||||||
| char ascii_val[BUFLEN_128] = {0}; | ||||||
| if( hex_to_ascii(send_opt_list->dhcp_opt_val, ascii_val, sizeof(ascii_val)) == 0) | ||||||
| if(0== strncmp(send_opt_list->dhcp_opt_val,"pktc2.0:",strlen("pktc2.0:"))) | ||||||
| { | ||||||
|
|
||||||
| snprintf(args, BUFLEN_128, "-V %s ", ascii_val); | ||||||
| snprintf(args, BUFLEN_512, "-V %s ", send_opt_list->dhcp_opt_val); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| /* Option 60 - Vendor Class Identifier has udhcp cmd line arg "-V <option-str>" | ||||||
| * If this option is not set with '-V' then udhcpc will add a default vendor class option with its name and version. | ||||||
| * So we need to set this option with '-V' with ACSII string. | ||||||
| */ | ||||||
| char ascii_val[BUFLEN_128] = {0}; | ||||||
| if( hex_to_ascii(send_opt_list->dhcp_opt_val, ascii_val, sizeof(ascii_val)) == 0) | ||||||
| { | ||||||
| snprintf(args, BUFLEN_128, "-V %s ", ascii_val); | ||||||
|
||||||
| snprintf(args, BUFLEN_128, "-V %s ", ascii_val); | |
| snprintf(args, BUFLEN_512, "-V %s ", ascii_val); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The special case handling for Option 60 when the value starts with "pktc2.0:" passes the value directly without hex-to-ASCII conversion. However, the comment at lines 155-157 states that the original behavior is to prevent udhcpc from adding a default vendor class option. This creates an inconsistency: for voice interfaces (pktc2.0:), the value is passed as-is (presumably already in ASCII), while for other interfaces, hex values are converted to ASCII. The code should validate that pktc2.0: values are in the expected format and document why they bypass the hex-to-ASCII conversion.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -473,4 +473,4 @@ static int set_mta_config(const char *OptionValue, char *version) | |
| } | ||
| return 0; | ||
| } | ||
| #endif | ||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent variable naming: The configure option is named "dhcpVoiceOptions_support" in the AC_ARG_ENABLE but the internal variable is named "dhcp_voiceOptions_support" (note the underscore positions differ). This inconsistency could lead to confusion during debugging or when modifying the build system. The variable naming should be consistent throughout.