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

net: lib: nrf_cloud: Fix warnings on PGPS #19829

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ Cellular samples

* :ref:`nrf_cloud_multi_service` sample:

* Fixed an issue with an uninitialized variable in the :c:func:`handle_at_cmd_requests` function.
* Fixed:

* An issue with an uninitialized variable in the :c:func:`handle_at_cmd_requests` function.
* An issue with the too small :kconfig:option:`CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE` Kconfig value
in the :file:`overlay-coap_nrf_provisioning.conf` file.

Cryptography samples
--------------------
Expand Down Expand Up @@ -506,6 +510,9 @@ Libraries for networking
* :ref:`lib_azure_fota`
* :ref:`lib_fota_download`

* :ref:`lib_nrf_cloud_pgps` library:

* Fixed the warning due to missing ``https`` download protocol.

Libraries for NFC
-----------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CONFIG_NRF_PROVISIONING_CODEC_RX_SZ_START=2048

# CoAP Client
CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=64
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=192
CONFIG_COAP_CLIENT_THREAD_PRIORITY=0
CONFIG_COAP_CLIENT_BLOCK_SIZE=1024
CONFIG_COAP_CLIENT_MESSAGE_SIZE=1024
Expand Down
21 changes: 10 additions & 11 deletions subsys/net/lib/nrf_cloud/src/nrf_cloud_pgps.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(nrf_cloud_pgps, CONFIG_NRF_CLOUD_GPS_LOG_LEVEL);
#include "nrf_cloud_pgps_utils.h"
#include "nrf_cloud_codec_internal.h"

#define FORCE_HTTP_DL 0 /* set to 1 to force HTTP instead of HTTPS */
#define DOWNLOAD_PROTOCOL "https://"
#define PGPS_DEBUG 0 /* set to 1 for extra logging */

#if defined(CONFIG_NRF_CLOUD_PGPS_PREDICTION_PERIOD_120_MIN)
Expand Down Expand Up @@ -867,14 +867,18 @@ int nrf_cloud_pgps_process(const char *buf, size_t buf_len)
int err;
static char host[CONFIG_DOWNLOADER_MAX_HOSTNAME_SIZE];
static char path[CONFIG_DOWNLOADER_MAX_FILENAME_SIZE];
size_t sz = strlen(DOWNLOAD_PROTOCOL);

struct nrf_cloud_pgps_result pgps_dl = {
.host = host,
.host_sz = sizeof(host),
.host = &host[sz],
.host_sz = sizeof(host) - sz,
.path = path,
.path_sz = sizeof(path)
};

/* Include protocol so downloader does not issue a warning. */
strncpy(host, DOWNLOAD_PROTOCOL, sz + 1);

#if defined(CONFIG_NRF_CLOUD_MQTT)
LOG_HEXDUMP_DBG(buf, buf_len, "MQTT packet");
#endif
Expand All @@ -888,6 +892,9 @@ int nrf_cloud_pgps_process(const char *buf, size_t buf_len)
return err;
}

/* Point to start of full host name including protocol. */
pgps_dl.host = host;

return nrf_cloud_pgps_update(&pgps_dl);
}

Expand Down Expand Up @@ -918,14 +925,6 @@ int nrf_cloud_pgps_update(struct nrf_cloud_pgps_result *file_location)

int sec_tag = nrf_cloud_sec_tag_get();

if (FORCE_HTTP_DL && (strncmp(file_location->host, "https", 5) == 0)) {
memmove(&file_location->host[4],
&file_location->host[5],
strlen(&file_location->host[4]));

sec_tag = -1;
}

err = npgps_download_start(file_location->host, file_location->path,
sec_tag, 0, FRAGMENT_SIZE);

Expand Down
2 changes: 1 addition & 1 deletion subsys/net/lib/nrf_cloud/src/nrf_cloud_pgps_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ static int downloader_callback(const struct downloader_evt *event)

ret = downloader_cancel(&dl);

if (ret) {
if (ret && (ret != -EPERM)) {
LOG_ERR("Error disconnecting from download client:%d", ret);
}
#endif
Expand Down