tests: lwm2m: Enable DTLS CID for interoperability tests
Leshan Demo server seem to support it so it makes sense to use it. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
parent
0a104185fe
commit
1506a43705
2 changed files with 22 additions and 0 deletions
|
@ -48,6 +48,7 @@ CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=40
|
||||||
CONFIG_LWM2M_QUEUE_MODE_ENABLED=y
|
CONFIG_LWM2M_QUEUE_MODE_ENABLED=y
|
||||||
CONFIG_LWM2M_QUEUE_MODE_UPTIME=20
|
CONFIG_LWM2M_QUEUE_MODE_UPTIME=20
|
||||||
CONFIG_LWM2M_UPDATE_PERIOD=30
|
CONFIG_LWM2M_UPDATE_PERIOD=30
|
||||||
|
CONFIG_LWM2M_RD_CLIENT_STOP_POLLING_AT_IDLE=y
|
||||||
|
|
||||||
# LwM2M configuration as OMA-ETS-LightweightM2M_INT-V1_1-20190912-D Configuration 3
|
# LwM2M configuration as OMA-ETS-LightweightM2M_INT-V1_1-20190912-D Configuration 3
|
||||||
CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME=30
|
CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME=30
|
||||||
|
@ -75,6 +76,7 @@ CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
|
||||||
# LwM2M engine should not use more than one on any given time.
|
# LwM2M engine should not use more than one on any given time.
|
||||||
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=1
|
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=1
|
||||||
CONFIG_NET_SOCKETS_ENABLE_DTLS=y
|
CONFIG_NET_SOCKETS_ENABLE_DTLS=y
|
||||||
|
CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID=y
|
||||||
|
|
||||||
# Assume that IPv6 minimum MTU is accepted
|
# Assume that IPv6 minimum MTU is accepted
|
||||||
# MTU - IPv6 header - UDP header - DTLS header - CoAP header room
|
# MTU - IPv6 header - UDP header - DTLS header - CoAP header room
|
||||||
|
|
|
@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||||
#include <zephyr/drivers/gpio.h>
|
#include <zephyr/drivers/gpio.h>
|
||||||
#include <zephyr/drivers/sensor.h>
|
#include <zephyr/drivers/sensor.h>
|
||||||
#include <zephyr/net/lwm2m.h>
|
#include <zephyr/net/lwm2m.h>
|
||||||
|
#include <zephyr/net/socket.h>
|
||||||
|
|
||||||
#define APP_BANNER "Run LWM2M client"
|
#define APP_BANNER "Run LWM2M client"
|
||||||
|
|
||||||
|
@ -58,6 +59,24 @@ static int device_reboot_cb(uint16_t obj_inst_id,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int set_socketoptions(struct lwm2m_ctx *ctx)
|
||||||
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID) && ctx->use_dtls) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Enable CID */
|
||||||
|
int cid = TLS_DTLS_CID_ENABLED;
|
||||||
|
|
||||||
|
ret = zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_CID, &cid,
|
||||||
|
sizeof(cid));
|
||||||
|
if (ret) {
|
||||||
|
ret = -errno;
|
||||||
|
LOG_ERR("Failed to enable TLS_DTLS_CID: %d", ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lwm2m_set_default_sockopt(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static int lwm2m_setup(void)
|
static int lwm2m_setup(void)
|
||||||
{
|
{
|
||||||
/* setup DEVICE object */
|
/* setup DEVICE object */
|
||||||
|
@ -201,6 +220,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
client.tls_tag = 1;
|
client.tls_tag = 1;
|
||||||
|
client.set_socketoptions = set_socketoptions;
|
||||||
|
|
||||||
lwm2m_rd_client_start(&client, CONFIG_BOARD, 0, rd_client_event, observe_cb);
|
lwm2m_rd_client_start(&client, CONFIG_BOARD, 0, rd_client_event, observe_cb);
|
||||||
lwm2m_rd_client_stop(&client, rd_client_event, false);
|
lwm2m_rd_client_stop(&client, rd_client_event, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue