Skip to content
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

download_client: Allow use of DTLS CID #11493

Closed
wants to merge 3 commits into from

Conversation

SeppoTakalo
Copy link
Contributor

Few changes to the download client:

  • When connecting to DTLS service, enable Connection-ID. Controlled by Kconfig.
  • Refactor to use Zephyr socket API instead of POSIX socket API. This is easier regarding headers.
  • Clear CoAP timeout values on start of transmission.

@SeppoTakalo SeppoTakalo requested a review from rlubos as a code owner June 12, 2023 13:20
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Jun 12, 2023
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jun 12, 2023

Test specification

CI/Jenkins/NRF

  • Integration Platforms

CI/Jenkins/integration

Test Module File based changes Manually selected West overwrite
test-ci-nrfconnect-boot-fw-update X
test-fw-nrfconnect-nrf-iot_mosh X
test-fw-nrfconnect-nrf-iot_samples X
test-fw-nrfconnect-nrf-iot_serial_lte_modem X
test-fw-nrfconnect-nrf-iot_zephyr_lwm2m X

Detailed information of selected test modules

Note: This message is automatically posted and updated by the CI

@github-actions github-actions bot added doc-required PR must not be merged without tech writer approval. and removed changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Jun 12, 2023
@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publishing GitHub Action.

@umapraseeda
Copy link
Contributor

Are there any updates required in the library documentation?

@SeppoTakalo SeppoTakalo removed the doc-required PR must not be merged without tech writer approval. label Jun 13, 2023
Copy link
Contributor

@rlubos rlubos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please rebase

@github-actions github-actions bot added the doc-required PR must not be merged without tech writer approval. label Jun 13, 2023
@SeppoTakalo
Copy link
Contributor Author

Are there any updates required in the library documentation?

actually, you are right. Kconfig options are not mentioned in documentation, so I added a short note there as well.

@SeppoTakalo
Copy link
Contributor Author

rebased.

When connecting to DTLS service, enable Connection-ID.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When transmission of a new block starts, clear timeouts.
Otherwise previous CoAP transmission timeouts might be left.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Using POSIX API directly brings some portability issues with
headers, so it is safer to use zsock API on libraries.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
@SeppoTakalo SeppoTakalo removed the doc-required PR must not be merged without tech writer approval. label Jun 26, 2023
@SeppoTakalo
Copy link
Contributor Author

Build failures on test application:

INFO: /tools/ncs/toolchains/fcef6322b4224bba80652b6ea86eebc963247c5d/usr/local/lib/python3.8/site-packages/ctf/targetcomm2/target_lib/tca_transports/uarte.c:20:9: note: '#pragma message: TCA_TRANSPORT=UART will be deprecated, it is recommended to use UART_NRFX for new code'

INFO:    20 | #pragma message "TCA_TRANSPORT=UART will be deprecated, it is recommended to use UART_NRFX for new code"

INFO:       |         ^~~~~~~

INFO: [93/324] Building C object CMakeFiles/app.dir/jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/subsys/modem_funcs/modem_funcs.c.obj

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/subsys/modem_funcs/modem_funcs.c: In function 'enable_and_connect_modem':

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/subsys/modem_funcs/modem_funcs.c:72:5: warning: implicit declaration of function 'nrf_modem_init'; did you mean 'nrf_modem_at_err'? [-Wimplicit-function-declaration]

INFO:    72 |     nrf_modem_init();

INFO:       |     ^~~~~~~~~~~~~~

INFO:       |     nrf_modem_at_err

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/subsys/modem_funcs/modem_funcs.c: At top level:

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/subsys/modem_funcs/modem_funcs.c:151:54: warning: 'enum at_cmd_state' declared inside parameter list will not be visible outside of this definition or declaration

INFO:   151 | int at_read_out_uuid(char *buf, size_t buf_len, enum at_cmd_state *state){

INFO:       |                                                      ^~~~~~~~~~~~

INFO: [94/324] Building C object CMakeFiles/app.dir/src/main.c.obj

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c: In function 'dfu_target_callback_handler':

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c:62:5: warning: implicit declaration of function 'send_evt' [-Wimplicit-function-declaration]

INFO:    62 |     send_evt(FOTA_DOWNLOAD_EVT_ERASE_PENDING);

INFO:       |     ^~~~~~~~

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c:68:5: warning: implicit declaration of function 'send_error_evt' [-Wimplicit-function-declaration]

INFO:    68 |     send_error_evt(FOTA_DOWNLOAD_ERROR_CAUSE_DOWNLOAD_FAILED);

INFO:       |     ^~~~~~~~~~~~~~

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c: In function 'start_download':

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c:82:61: warning: passing argument 4 of 'fota_download_start' makes integer from pointer without a cast [-Wint-conversion]

INFO:    82 |         int ret =  fota_download_start(host, file, sec_tag, NULL, fragment_size);

INFO:       |                                                             ^~~~

INFO:       |                                                             |

INFO:       |                                                             void *

INFO: In file included from /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c:3:

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/nrf/include/net/fota_download.h:126:33: note: expected 'uint8_t' {aka 'unsigned char'} but argument is of type 'void *'

INFO:   126 |                         uint8_t pdn_id, size_t fragment_size);

INFO:       |                         ~~~~~~~~^~~~~~

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c: In function 'init_dfu_target_params_oversized_buffer':

INFO: /jenkins_workspace/workspace/nrfconnect-boot-fw-update_master/test_fw_update/utils/test_applications/application/fw_download/src/main.c:120:9: warning: unused variable 'img_type' [-Wunused-variable]

INFO:   120 |     int img_type;

INFO:       |         ^~~~~~~~

INFO: [95/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/timeutil.c.obj

INFO: [96/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/thread_entry.c.obj

INFO: [97/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj

INFO: [98/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj

INFO: [99/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/rb.c.obj

INFO: [100/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj

INFO: [101/324] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap.c.obj

INFO: ninja: build stopped: subcommand failed.

Not sure who is responsible of fixing test-ci-nrfconnect-boot-fw-update test job and its related test app.

@stig-bjorlykke
Copy link
Contributor

What is the use-case for DTLS CID in the download client which doesn't keep the connection?

@@ -134,7 +128,7 @@ static int set_recv_socket_timeout(int fd, int timeout_ms)
.tv_usec = (timeout_ms % 1000) * 1000,
};

err = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
err = zsock_setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine in principle, but we should try to keep this aligned throughout the codebase, at least in sdk-nrf. It would be a bit messy if some libraries used zsock_ and others the POSIX names; what guideline do we set for ourselves? Is it up to personal preference which one to use?

@SeppoTakalo SeppoTakalo deleted the download_client_cid branch August 23, 2023 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants