mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-18 21:49:05 +03:00
Move requirements for client to determine how to set up the SNI for PSK/PKI encrypted communications down into libcoap. The client just needs to indicate the host to connect to in the client_sni field of coap_dtls_cpsk_t or coap_dtls_pki_t. New internal function coap_sanitize_client_sni() makes sure that the SNI sent follows RFC 6066. As per https://datatracker.ietf.org/doc/html/rfc6066#section-3 Literal IPv4 and IPv6 addresses are not permitted in "HostName". all IPv4 and IPv6 addresses are dropped for the SNI, and so no SNI is sent. DNS hostnames will get transmitted as the SNI.
libcoap client example
This example shows how to configure a client to use libcoap
Fast configuration (Between RIOT instances):
Preparing the logical interfaces:
sudo ./../../dist/tools/tapsetup/tapsetup --create 2
Client invocation
For the client:
PORT=tap0 make term
coapc coap://[ip6-address]/some/path
The IP address to connect to needs to be that as returned by libcoap_server, or that of the tap0 interface, etc.
Handling the static memory allocation
libcoap for RIOT is using the sys/memarray module and therefore there
are certain limits. Said resources are defined in libcoap/src/coap_mem.c,
but can be overwritten at compile time.