1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

566 Commits

Author SHA1 Message Date
benpicco
67b98fd741 sys/net/nanocoap: introduce nanocoap_sock_*()
Co-authored-by: Jan Romann <jan.romann@uni-bremen.de>
2022-02-24 12:20:47 +01:00
Benjamin Valentin
0b768e5602 nanocoap: add nanocoap_request_simple() 2022-02-24 12:20:05 +01:00
Benjamin Valentin
7dc2f730d2 nanocoap: check if all critical options were handled 2022-02-24 12:20:05 +01:00
Benjamin Valentin
2682848a29 suit/transport/coap: move suit_coap_get_blockwise() to nanocoap 2022-01-27 14:42:49 +01:00
Benjamin Valentin
d680743fe9 net/coap: specify timeout in milliseconds
This allows for more flexibility when choosing timeouts.
2022-01-27 14:42:49 +01:00
Benjamin Valentin
3895fdc2c3 net/coap: move socket open/close out of nanocoap API
This allows to reuse a socket between requests and aligns the API
with the usage in SUIT.
2022-01-27 14:31:06 +01:00
Jan Romann
e29da26ea1
Merge pull request #17250 from JKRhb/dhcpv6-restart-fix
sys/net/dhcpv6: fix variable shadowing issue
2022-01-01 20:48:07 +01:00
Jan Romann
e185a2556d
sys/net/dhcpv6: fix variable shadowing issue 2022-01-01 18:43:13 +01:00
Karl Fessel
6347dcdffc
Merge pull request #17141 from kfessel/p-ztimer-gcoap
net/gcoap: port to ztimer
2021-12-09 15:22:10 +01:00
Benjamin Valentin
1db8ab4f72 sys/net/gcoap: add ; after DEBUG() 2021-12-08 20:41:21 +01:00
Karl Fessel
9195a4f02b net/gcoap: most ZITMER_USEC to ZTIMER_MSEC 2021-12-06 13:31:18 +01:00
Karl Fessel
f56eb9bb83 net/gcoap: port to ztimer_usec 2021-12-06 13:31:18 +01:00
Karl Fessel
2dd0cec4e9 net/gcoap: clean xtimer include from header 2021-12-06 13:31:18 +01:00
Sören Tempel
dc1b6d0436 sock_dns: include string.h for strlen(3) function prototype
Needed by the following code in `dns.c`:

e8cbc6da85/sys/net/application_layer/sock_dns/dns.c (L39-L41)

The include was probably wrongfully removed by accident in
e8cbc6da85 (CC: @miri64).
2021-11-30 01:12:40 +01:00
dba51edc69 net/uhcp[cd]: use modules to select client/server code 2021-11-09 21:42:45 +01:00
Martine Lenders
4b2ca7a702
Merge pull request #16986 from benpicco/uhcp-debug
sys/net/uhcp: use LOG_DEBUG instead of LOG_INFO
2021-11-09 12:58:16 +01:00
chrysn
a92cdb535e
Merge pull request #16378 from chrysn-pull-requests/gcoap-handle-truncation
sys/net/gcoap: Use socket _buf API to recognize truncated requests
2021-10-27 08:55:52 +02:00
Martine Lenders
b1b0a9b4f5
dhcpv6_client: add comment on why the division is needed 2021-10-15 17:36:13 +02:00
Martine Lenders
d844de2263
dhcpv6_client: keep integers in retransmission calculations signed 2021-10-15 17:35:46 +02:00
Benjamin Valentin
35b727c7be sys/net/uhcp: cleanup 2021-10-14 14:20:46 +02:00
Benjamin Valentin
f74c795033 sys/net/uhcp: use LOG_DEBUG instead of LOG_INFO
uhcp is pretty noisy compared to DHCPv6 as INFO log level is enabled
by default.

Tone it down to LOG_DEBUG to keep the output clean.
2021-10-14 14:09:17 +02:00
Martine Lenders
e74b54d3ae
gcoap_dtls: destroy session in _tl_send only on connection errors 2021-10-08 12:24:57 +02:00
Martine Lenders
96eb2c5050
Merge pull request #16731 from JKRhb/dhcp-stateless
sys/net/dhcpv6: Add stateless DHCPv6
2021-10-05 10:13:22 +02:00
Jan Romann
c62d6eb834
sys/net/dhcpv6: Implement stateless DHCPv6 2021-10-04 17:40:56 +02:00
Martine Lenders
e0ac9d3f45
dns_msg: Use correct byteorder for ID 2021-09-29 13:32:12 +02:00
chrysn
2e70f29d4f sys/net/gcoap: Use socket _buf API to recognize truncated requests
Closes: https://github.com/RIOT-OS/RIOT/issues/14167
Co-authored-by: Marian Buschsieweke <maribu@users.noreply.github.com>
2021-09-02 16:49:46 +02:00
chrysn
0ff56f284d sys/net/app/cord: Support the addition of extra registration arguments 2021-09-02 16:40:19 +02:00
Jan Romann
507d39c054
sys/net/dhcpv6: Reformat parsing of IA_NA 2021-09-01 01:24:56 +02:00
Jan Romann
18dd056f8a
sys/net/dhcpv6: Add missing IA_NA IS_USED check 2021-08-18 02:03:56 +02:00
Jan Romann
192e09b7bf
sys/net/dhcpv6: Refactor update of leases 2021-08-18 02:00:12 +02:00
Jan Romann
d0dd12cf25
sys/net/dhcpv6: Refactor parsing of IA_PD 2021-08-18 02:00:11 +02:00
Jan Romann
1daa4b6e30
sys/net/dhcpv6: Refactor message composition 2021-08-18 02:00:08 +02:00
Jan Romann
bbce04f854
sys/net/dhcpv6: Refactor mrd calculation 2021-08-18 02:00:08 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
Martine Lenders
febb07c64e
Merge pull request #16704 from fjmolinas/pr_block_finish_return_more
sys/net/nanocoap: block_finish returns if more are expected
2021-08-12 19:16:46 +02:00
Jan Romann
ad0096cde6
sys/net/dhcpv6: Refactor IA_NA implementation 2021-08-11 22:19:59 +02:00
Martine Lenders
f2f6700865
Merge pull request #16228 from JKRhb/dhcp-ia-na
sys/net/dhcpv6: Add IA_NA support to the DHCPv6 client
2021-08-11 20:50:01 +02:00
Jan Romann
234a71870a
sys/net/dhcpv6: Add IA_NA implementation 2021-08-11 19:15:35 +02:00
Martine Lenders
2d7c613948
tests/gnrc_dhcpv6_relay: initial import 2021-08-11 14:30:37 +02:00
Martine Lenders
4afc65688f
dhcpv6_relay: initial import of a lightweight DHCPv6 relay agent 2021-08-11 13:19:06 +02:00
Martine Lenders
6da2f0fab3
Merge pull request #16669 from miri64/sock_dns/enh/factor-out-msg-parsing
sock_dns: factor out message parsing and composition
2021-08-11 12:43:26 +02:00
Martine Lenders
7920ab2b95
dns_msg: make parsing input buffer const 2021-08-11 11:55:29 +02:00
Martine Lenders
e8cbc6da85
dns: move message parsing and composition to own module 2021-08-11 11:55:29 +02:00
Francisco Molina
9195f772ad sys/net/nanocoap: block_finish returns if more are expected 2021-08-06 09:29:03 +02:00
Martine Lenders
5d59065b09
gcoap: provide buffer version of gcoap_req_init()
This simplifies the usage of `gcoap` with modules such as `uri_parser`
greatly.
2021-08-05 13:31:07 +02:00
Martine Lenders
4b7ef70e66
gcoap: fix socket type naming
The `coap_socket_t` and `coap_socket_type_t` types are used by gCoAP
only and the `coap_` prefix is usually used to namespace the `nanocoap`
module's API. This makes it confusing to locate the types in question.

Signed-off-by: Martine Lenders <m.lenders@fu-berlin.de>
2021-07-27 22:37:04 +02:00
Karl Fessel
238c759899 dhcpv6_client: mrd calculation fixed for renew and rebind
mrd calculation for dhcp-renew was wrong this fixes it
and the logic for dhcp rebind mrd handling
    (try rebind if ther is mrd)
see issue  #16677
2021-07-23 17:54:55 +02:00
Martine Lenders
6493241ed4
dhcpv6_client: add ztimer backend support 2021-07-21 16:28:39 +02:00
Martine Lenders
b5d9f78cbd
dhcpv6_client: port timeout mechanism to event_timeout 2021-07-21 16:28:39 +02:00
Martine Lenders
805952c5ce
dhcpv6_client: use event_timeout instead of xtimer 2021-07-21 16:28:37 +02:00
Martine Lenders
ed9a682e49
dhcpv6_client: set timer by unit rather than integer width 2021-07-21 16:27:54 +02:00
Martine Lenders
d1613da617
dhcpv6_client: use milliseconds rather than microseconds as base unit 2021-07-21 16:27:54 +02:00
Martine Lenders
eb577c933e
dhcpv6_client: move timer setting to their own functions 2021-07-21 16:27:53 +02:00
Martine Lenders
bf764fd700
sock_dns: move module to directory named like module 2021-07-21 14:58:04 +02:00
Martine Lenders
38d14b6335
dhcpv6_client: make IA_PD an optional module
Prefix delegation used to be the only supported feature of our DHCPv6
client, but by now it also supports MUD, DNS recursive name servers and
IA_NA is on the horizon. So it makes sense to make IA_PD an optional
module like all those other features are as well.
2021-07-21 11:37:29 +02:00
Martine Lenders
d9be29318d
gnrc_dhcpv6_client_mud_url: rename to dhcpv6_client_mud_url
There is no real reason for that pseudo-module to use the `gnrc_`
prefix. Neither does it need GNRC-components (except, but optionally, as
a network stack of course), nor is it implemented with in the GNRC
network stack.
2021-07-20 15:30:34 +02:00
János Brodbeck
23a8659bdf
net/gcoap: support DTLS 2021-07-07 14:45:30 +02:00
Vera Clemens
b0f4781e15 net/emcute: Allow RETAIN flag to be set on incoming PUBLISHs 2021-06-25 18:32:53 +02:00
Martine Lenders
4deb15cb6f
dhcpv6_client: add DNS recursive name server option handling
Signed-off-by: Martine Lenders <m.lenders@fu-berlin.de>
2021-06-24 16:01:59 +02:00
János Brodbeck
2e523bf101
net/gcoap: change return type from gcoap_req_send() to ssize_t 2021-06-04 17:15:04 +02:00
chrysn
049b5179a7 sys/net/app/cord and examples: Update references to -27
With all (the few necessary) changes done, this can claim -27
compatibility.
2021-03-01 11:59:57 +01:00
chrysn
6542f7008f sys/net/app/cord: Use updated .well-known path from draft -26 2021-03-01 11:20:42 +01:00
benpicco
9fc60da4ca
Merge pull request #15830 from benpicco/net/nanocoap_add_uri
nanocoap: add coap_opt_put_uri_pathquery()
2021-02-24 12:09:08 +01:00
Benjamin Valentin
d4e5c25b70 nanocoap: add coap_opt_put_uri_pathquery() 2021-02-23 18:27:54 +01:00
Jan Romann
6a2aa7ad52 sys/net/dhcpv6: Fix MUD URL option 2021-02-09 19:47:47 +01:00
Benjamin Valentin
b24480538a nanocoap: add coap_opt_put_string_with_len() 2021-01-21 15:17:28 +01:00
Jose Alamos
0bee606bd4
gcoap: remove gcoap_add_qstring
This feature was marked to be deprecated after the release 2020.10.
Therefore this commit removes that feature.
2021-01-14 16:03:00 +01:00
Hauke Petersen
ee01950ed7 net/asymcute: switch to sock_asnyc_event 2020-12-18 13:58:20 +01:00
Martine Lenders
b5a36e9af7
Merge pull request #15653 from haukepetersen/fix_asymcute_subflags
net/asymcute: fix handling of short and pre-defined topics
2020-12-18 13:52:52 +01:00
Hauke Petersen
1e7b95cd70
Merge pull request #15661 from haukepetersen/fix_emcute_msgidqos0
net/emcute: fix MsgId for PUBLISH with QOS0
2020-12-18 13:45:10 +01:00
Hauke Petersen
289688169e net/asymcute: fix short and pre-defined topics 2020-12-18 12:27:46 +01:00
Hauke Petersen
d5aa6c1311
Merge pull request #15675 from haukepetersen/opt_asymcute_rmstaticcasts
net/asymcute: rm explicit casts where applicable
2020-12-18 12:12:05 +01:00
Hauke Petersen
610ae4925e net/emcute: fix MsgId for PUBLISH with QOS0 2020-12-18 10:41:52 +01:00
Hauke Petersen
285681a4e0 net/asymcute: rm explicit casts where applicable 2020-12-18 10:36:55 +01:00
Hauke Petersen
5ff526f928 net/asymcute: fix msgId when publishing QOS0 2020-12-18 10:26:02 +01:00
Martine Lenders
b0b1c251c0
Merge pull request #15603 from miri64/uhcp/fix/prefix-len
uhcp: check maximum for prefix length
2020-12-15 13:06:08 +01:00
Martine Lenders
44a94dd91e
uhcp: check maximum for prefix length 2020-12-15 10:42:40 +01:00
Han Xinrong
44762971c2 sys/net/application_layer/cord: add error check to cord_ep_register() 2020-12-08 20:37:15 +08:00
Martine Lenders
c44d77e528
Merge pull request #15508 from namib-project/dhcp-mud-support
Add MUD URL option to DHCPv6 client
2020-12-01 10:33:51 +01:00
Leandro Lanzieri
4b7bb8719f
Merge pull request #15240 from akshaim/Kconfig_EMCute_1
MQTT-SN Clients ( Emcute/ Asymcute) : Kconfig Updates
2020-12-01 09:47:09 +01:00
Jan Romann
9823e45a93 net/dhcpv6: Introduce buffer size check 2020-11-30 22:46:33 +01:00
Jan Romann
2a570cb957 net/dhcpv6: Add DHCPv6 option for MUD URL (RFC 8520)
Co-Authored-By: Jens Bücker <48720000+jbueck@users.noreply.github.com>
Co-Authored-By: mauspr <75017188+mauspr@users.noreply.github.com>
Co-Authored-By: schulztr <75017039+schulztr@users.noreply.github.com>
2020-11-30 22:46:33 +01:00
benpicco
6a4ece5246
Merge pull request #15359 from miri64/uhcp/fix/i15353
uhcp: fix handling of pushed prefix
2020-11-25 00:17:30 +01:00
Martine Lenders
2d54968881
uhcp: fix handling of pushed prefix 2020-11-24 11:44:30 +01:00
Akshai M
1559aa1dc6 net/asymcute : Move 'ASYMCUTE_BUFSIZE' to 'CONFIG_'
Move ASYMCUTE_BUFSIZE to CONFIG_ namespace, update entry in Kconfig
2020-11-19 23:11:21 +01:00
Akshai M
8f36c817eb net/asymcute : Add 'CONFIG_ASYMCUTE_DEFAULT_PORT'
examples/asymcute : Update macro definition
Update macro definition for UDP port.

Kconfig/asymcute : Add 'ASYMCUTE_DEFAULT_PORT'
2020-11-19 23:11:21 +01:00
Akshai M
2c7dfac7d1 net/emcute : Update documentation
Update documentation and add new group 'net_mqtt_conf'
2020-11-19 23:11:21 +01:00
Akshai M
2c710b1b3f net/emcute : Expose to Kconfig 2020-11-19 23:11:21 +01:00
Akshai M
348a8cb45a net/emcute : Move 'EMCUTE_N_RETRY' to 'CONFIG_' 2020-11-19 23:11:21 +01:00
Akshai M
1840310459 net/emcute : Move 'EMCUTE_T_RETRY' to 'CONFIG_' 2020-11-19 23:11:21 +01:00
Akshai M
752f76248b net/emcute : Move 'EMCUTE_KEEPALIVE' to 'CONFIG_' 2020-11-19 23:11:21 +01:00
Akshai M
4bb866c59e net/emcute : Move 'EMCUTE_TOPIC_MAXLEN' to 'CONFIG_' 2020-11-19 23:11:20 +01:00
Akshai M
17e2b20f50 net/emcute : Move 'EMCUTE_BUFSIZE' to 'CONFIG_' 2020-11-19 23:11:20 +01:00
János Brodbeck
16c5fd6fbd
net/gcoap: relabel _sock to _sock_udp 2020-11-05 17:19:42 +01:00
János Brodbeck
c4e646037d
net/gcoap: split out the coap processing part of _on_sock_evt 2020-11-05 17:19:41 +01:00
Bas Stottelaar
922e2ac1c9 sys/*: replace #if ENABLE_DEBUG with IS_ACTIVE 2020-11-02 21:49:39 +01:00
Martine Lenders
ea84953d8b
uhcp: fix line length 2020-11-02 15:03:49 +01:00
Sören Tempel
85296ce6cc sock_dns: Fix incorrect buffer bounds check
Apart from advancing the buffer by RR_TYPE_LENGTH, RR_CLASS_LENGTH,
and RR_TTL_LENGTH the code also attempts to read a two byte unsigned
integer using _get_short(bufpos):

	unsigned addrlen = ntohs(_get_short(bufpos));

The bounds check must therefore ensure that the given buffer is large
enough to contain two more bytes after advancing the buffer.
2020-10-30 21:41:39 +01:00
Cenk Gündoğan
7d820f7ada
nanocoap: gcoap: use const parameter for coap_method2flag 2020-10-28 15:40:35 +01:00
Cenk Gündoğan
d4370e690e
gcoap: add a handler for request matching 2020-10-28 15:40:35 +01:00
chrysn
c0bc0c41b1 net/goap: State and check that listeners are added individually
Add a an assertion on the added listener not having a trailing chain
instead of silently overwriting it, point out the precondition in the
documentation, and guide users who want to add more than one listener
towards a more efficient way.
2020-10-23 22:33:43 +02:00
benpicco
b5cd19e73e
Merge pull request #14178 from chrysn-pull-requests/gcoap-handle-con-response
gcoap: Process CON responses
2020-10-23 14:21:33 +02:00
Bas Stottelaar
1b35d06a51 sys/*: realign ENABLE_DEBUG 2020-10-23 11:27:48 +02:00
chrysn
462f8861f4 gcoap: Suppress retransmissions when ACK was received
This introduces an additional state to the COAP_MEMO_* series to avoid
enlarging the memo struct needlessly. While they are documented
publicly, practically only the COAP_MEMO_TIMEOUT and COAP_MEMO_RESPONSE
are used in communication with the application, as a
gcoap_request_memo_t is only handed out in that state.
2020-10-22 19:08:39 +02:00
chrysn
f32d758819 gcoap: Prepare to cease retransmission
The actual implementation will follow in a separate commit, this does
the groundwork and sets the intention.
2020-10-22 19:08:39 +02:00
chrysn
0a2f97680f gcoap: Cleanup around empty responses
Simplify the code path and give consistent debug messages.
2020-10-22 19:08:39 +02:00
chrysn
ff00d66d69 gcoap: Process CON responses
This generalizes the existing code for answering CoAP pings into general
message-layer responses. Such responses are now also sent as a reaction
to CON responses, which can otherwise follow the same code path as
existing other responses.

As a side effect, issues that would crop up when responding to odd empty
requests that have token length set are resolved.

Contributes-To: https://github.com/RIOT-OS/RIOT/issues/14169
2020-10-22 19:08:39 +02:00
Bas Stottelaar
80d9da90df sys/*: add missing include of assert.h 2020-10-22 11:13:09 +02:00
Bas Stottelaar
47d376c5c3 sys/*: add explicit include of timex.h 2020-10-21 21:47:31 +02:00
chrysn
6350d22bc9 net/gcoap: Register additional resources head-first
This simplifies (written and compiled) code by doing a head rather than
a tail insertion of the new listener into gcoap's list.

As handling of listeners without a link_encoder is now fixed,
gcoap_get_resource_list can handles this now without having to manually
skip over the .well-known/core handler (which is not the first entry any
more now).

Incidentally, this allows the user to install a custom handler for
.well-known/core, as the default handler is now evaluated last.
2020-10-02 21:04:25 +02:00
chrysn
e3db58f013 net/gcoap: Avoid endless loop on error
The NULL case can not regularly be reached (because regularly
gcoap_register_listener sets thel link_encoder to a default one), but if
it is (eg. because an application unsets its link_encoder to hide a
resource set at runtime), the existing `continue` is a good idea (skip
over this entry) but erroneously created an endless loop by skipping the
advancement step.
2020-10-02 20:53:05 +02:00
Benjamin Valentin
f163f1580b sys/net/uhcp: use LOG_ functions
Using `gnrc_border_router` with `uhcp` is quite noisy.
uhcpc will regularly refresh the prefix and print a bunch of status messages.

Allow the user to tone it down by setting a higher `LOG_LEVEL`.
For this, convert calls to `printf()` and `puts()` to `LOG_xxx()`.

This requires a dummy header for `uhcpd`.
2020-09-29 09:55:28 +02:00
Hauke Petersen
3b424858de net/emcute: fix buffer overflow in _willupd_msg() 2020-09-22 11:43:00 +02:00
Akshai M
bb8d3cd72b sys/net/cord : Expose to Kconfig
Expose configurations to Kconfig

Co-authored-by: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
2020-09-02 23:36:48 +05:30
Akshai M
536a99022c sys/net/cord : Move 'CONFIG_CORD_EP' to 'CONFIG_' 2020-09-02 23:36:48 +05:30
Akshai M
e09063e7f1 sys/net/cord : Move 'CORD_UPDATE_INTERVAL' to 'CONFIG_' 2020-09-02 23:36:48 +05:30
Akshai M
de2d33f65b sys/net/cord : Move 'CORD_LT' to 'CONFIG_' 2020-09-02 23:36:48 +05:30
Leandro Lanzieri
d25fc243c4
treewide: change prefix for generated Kconfig symbols.
This changes the prefixes of the symbols generated from USEMODULE and
USEPKG variables. The changes are as follow:

   KCONFIG_MODULE_ => KCONFIG_USEMODULE_
   KCONFIG_PKG_ => KCONFIG_USEPKG_
   MODULE_ => USEMODULE_
   PKG_ => USEPKG_
2020-08-31 09:37:09 +02:00
Marian Buschsieweke
3b6fa61829
sys: Cleanup access to internal variables
Replace direct accesses to sched_active_thread and sched_active_pid with
the helper functions thread_getpid() and thread_get_active(). This serves
two purposes:

1. It makes accidental writes to those variable from outside core less likely.
2. Casting off the volatile qualifier is now well contained to those two
   functions
2020-08-24 20:28:11 +02:00
Benjamin Valentin
d4aa8aad10 nanocoap: validate input with NDEBUG
A malformed or malicious CoAP request may contain invalid field lengths.
`nanocoap` protects with this by using `assert()`, which safely crashes
the application in debug mode.

In release mode the check is removed.

Instead of allowing arbitrary memory writes, return 0 on invalid inputs.

Discovered by [Coverity](https://scan3.coverity.com/reports.htm#v46910/p10250/fileInstanceId=38357789&defectInstanceId=9793779&mergedDefectId=297306)
2020-08-11 15:54:23 +02:00
Akshai M
0413a5881f net/dhcpv6 : Expose to Kconfig
Expose configurations to Kconfig. Add conditional CFLAGS to avoid
conflicts with Kconfig.
2020-07-24 00:23:08 +05:30
Akshai M
1c37e11c0e net/dhcpv6 : Move 'DHCPV6_CLIENT_PFX_LEASE_MAX' to 'CONFIG_' 2020-07-23 21:10:26 +05:30
Leandro Lanzieri
3920dd8c20
net/gcoap: Remove gcoap_finish 2020-07-17 16:33:19 +02:00
Leandro Lanzieri
60f7e3aadf
net/cord/lc: Replace usage of deprecated gcoap_finish 2020-07-17 10:01:55 +02:00
Leandro Lanzieri
f92c693682
net/cord/epsim: Replace usage of deprecated gcoap_finish 2020-07-17 09:51:34 +02:00
Akshai M
e9f270c78a net/asymcute : Expose to Kconfig 2020-07-07 16:27:57 +05:30
Akshai M
8a6d2882f7 net/asymcute : Move 'ASYMCUTE_KEEPALIVE_PING' to 'CONFIG_' 2020-07-07 16:27:57 +05:30
Akshai M
a1df2e33b0 net/asymcute : Move 'ASYMCUTE_N_RETRY' to 'CONFIG_' 2020-07-07 16:27:57 +05:30
Akshai M
6dc5747c4b net/asymcute : Move 'ASYMCUTE_T_RETRY' to 'CONFIG_' 2020-07-07 16:27:57 +05:30
Akshai M
1753b84cba net/asymcute : Move 'ASYMCUTE_KEEPALIVE' to 'CONFIG_' 2020-07-07 16:27:57 +05:30
Akshai M
7ba0d3c76f net/asymcute : Move 'ASYMCUTE_TOPIC_MAXLEN' to 'CONFIG_' 2020-07-07 16:27:57 +05:30
Aiman Ismail
869052dcd8 cord: add RD lookup client 2020-07-07 10:54:10 +02:00
Martine Lenders
2b1be158e3
Merge pull request #13837 from benpicco/dhcpv6-stale_replies
sys/net/dhcpv6: discard stale replies
2020-06-25 12:18:31 +02:00
Benjamin Valentin
2d1160426d sys/net/dhcpv6: discard stale replies
The DHCPv6 server might send reponses multiple times.
The DHCPv6 client will only handle the first response, if additional
responses are comming in they are left in the RX queue.

That results in the client always reading the response of a previous
transaction on any subsequent transactions.
In this case the client will try again, creating a new transaction - that
will again only read the previous response.

To fix this, discard previous responses by flushing the RX queue before
sending a new message to the DHCPv6 server.

fixes #13834
2020-06-21 22:07:32 +02:00
Maciej Jurczak
edf016a6cb nanocoap: Added token length validation.
Implemented a check in coap_parse() to verify if TKL value is within valid range as specified by RFC7252. The token length must be within 0-8 range, any other value should be considered as invalid and the packet should produce message format error.
A test case was added to tests-nanocoap.c to verify correct behavior in case of TKL in range and out of range.

Update sys/net/application_layer/nanocoap/nanocoap.c

Prefixed debug message with module name and abbreviations expanded.

Co-authored-by: Martine Lenders <mail@martine-lenders.eu>

Update sys/net/application_layer/nanocoap/nanocoap.c

Prefixed debug message with module name and abbreviations expanded.

Co-authored-by: Martine Lenders <mail@martine-lenders.eu>
2020-05-25 22:44:50 +02:00
Maciej Jurczak
3be2c51c42 nanocoap: Fixed buffer read out of the input packet bounds issue.
If token length in the header was longer than actually provided in the following payload, read out of the input buffer bounds or processing of data beyond the actual input packet bound could happen. In order to remove the risk, the options loop condition was modified to early detect the condition and abort packet processing if a malformed packet is detected.

nanocoap: Added pointer range check after token length parsing.

Added a check to verify if the current packet parsing pointer is still within the packet boundaries after incrementing by the token length declared in the header. If packet is malformed an error code is returned.

nanocoap: Combined packet length checks

Combined packet length checks after reading token length and processing options into a single packet length validation after the options parsing loop. The entry to the options parsing loop is safe as the while loop condition protects against entering the loop if the token length was invalid.
2020-05-25 22:44:39 +02:00
Ken Bannister
595e8c631f
Merge pull request #13726 from benpicco/nanocoap-payload_helper
nanocoap: add payload helper functions
2020-05-03 08:56:30 -04:00
Benjamin Valentin
e5c20b143d nanocoap: add coap_payload_put_char() 2020-05-01 13:58:22 +02:00
Benjamin Valentin
2751708341 nanocoap: add payload helper functions
This adds two functions `coap_payload_add()` and `coap_payload_advance()`.

 - `coap_payload_add()` will add n bytes to the payload buffer and advance
    payload pointer accordingly.

    const char hello[] = "Hello CoAP!";
    coap_payload_add(pkt, hello, sizeof(hello));

 - `coap_payload_advance()` will advance the payload buffer after data
    has been added to it.

    int len = snprintf(pkt->payload, pkt->payload_len, "%s %s!", "Hello", "CoAP");
    coap_payload_advance(pkt, len);

I considered adding an additional parameter to keep track of the total request size
(returned size from coap_opt_finish() incremented by each added payload fragment),
but decided against it to keep consistency with the existing API.
2020-05-01 13:58:22 +02:00
Leandro Lanzieri
b91c8502dc
net/nanocoap/kconfig: Explicitly define type of MODULE_NANOCOAP 2020-04-27 10:06:01 +02:00
Leandro Lanzieri
eeea9b7dae
net/coap: Expose configurations to Kconfig 2020-04-24 10:06:45 +02:00
Leandro Lanzieri
9e427e1584
net/coap: Move COAP_MAX_RETRANSMIT to 'CONFIG' namespace
COAP_MAX_RETRANSMIT is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:43 +02:00
Leandro Lanzieri
afe4244ac9
net/coap: Move COAP_RANDOM_FACTOR_1000 to 'CONFIG' namespace
COAP_RANDOM_FACTOR_1000 is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:43 +02:00
Leandro Lanzieri
072a0d8563
net/coap: Move COAP_ACK_TIMEOUT to 'CONFIG' namespace
COAP_ACK_TIMEOUT is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:40 +02:00
Cenk Gündoğan
ea616abfda nanocoap: allow coap_opt_add_string() for zero-terminated strings 2020-04-22 12:28:48 +02:00
Leandro Lanzieri
46507ff247
Merge pull request #13894 from kb2ma/gcoap/ping
net/gcoap: add CoAP ping request
2020-04-21 12:23:54 +02:00
Cenk Gündoğan
6859de7855 nanocoap: export coap_opt_get_uint() 2020-04-17 22:39:44 +02:00
Ken Bannister
6eae4ded84 net/gcoap: create CoAP ping request 2020-04-17 08:15:20 -04:00
Ken Bannister
f5a85e2aff net/gcoap: handle CoAP ping request 2020-04-17 08:15:20 -04:00
Ken Bannister
2d3eb1a343 net/nanocoap: validate empty message length 2020-04-17 08:15:20 -04:00
Leandro Lanzieri
0137a06896
net/nanocoap: Expose configurations to Kconfig 2020-04-07 17:00:55 +02:00
Leandro Lanzieri
e80dcf2d8b
net/application_layer: Add Kconfig file and CoAP menu 2020-04-07 17:00:54 +02:00
Leandro Lanzieri
b6be8af81c
net/nanocoap: Move NANOCOAP_QS_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri
2f72189aa2
net/nanocoap: Move NANOCOAP_BLOCK_SIZE_EXP_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri
4052c01e85
net/nanocoap: Move NANOCOAP_URI_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri
c84576ef6e
net/nanocoap: Move NANOCOAP_NOPTS_MAX to 'CONFIG_' namespace 2020-04-07 17:00:52 +02:00
Ken Bannister
b32fcd28d1
Merge pull request #13815 from kb2ma/nanocoap/add_canonical_uri_query
net/gcoap: add canonical uri query function names
2020-04-07 06:32:13 -04:00
Ken Bannister
5d95436334 net/cord: use canonical function name to add Uri-Query option 2020-04-06 06:19:44 -04:00
Ken Bannister
d57340c964 net/nanocoap: use new Uri-Query functions as primary implementation 2020-04-06 06:19:44 -04:00
Martine Lenders
5c95df3151
Merge pull request #13806 from benpicco/sys/net/dhcpv6-multiple_prefixes
sys/net/dhcpv6: fix requesting multiple prefixes
2020-04-05 01:14:27 +02:00
Benjamin Valentin
c8b2483de5 net/gcoap: make use of coap_opt_add_path() 2020-04-04 17:06:04 +02:00
Benjamin Valentin
0e5595cffd sys/net/dhcpv6: fix requesting multiple prefixes
There were two subtle bugs that prevented the DHCPv6 client to request
multiple prefixes for different interfaces.

 - `dhcpv6_client_req_ia_pd()` would fill up *all* leases with the same interface
 - `_parse_reply()` would return after parsing the first answer

With this patch, `gnrc_border_router` gets a prefix on both interfaces of the at86rf215.
2020-04-03 17:02:57 +02:00
Cenk Gündoğan
50900a1fbe nanocoap: add convenience function for PROXY_URI 2020-03-28 14:50:51 +01:00
Cenk Gündoğan
5e42e26a6e nanocoap: add const qualifier to pkt of coap_opt_get_opaque() 2020-03-25 13:38:21 +01:00
1d5010e126
nanocoap: make separate tree handling function
This refactors nanocoap to seperate out the resource tree parsing. It
allows for calling the tree handler with custom resource trees. The
advantage is that a resource with COAP_MATCH_SUBTREE can parse a new
separate resource tree.
2020-03-23 15:08:53 +01:00
Ken Bannister
ec2aff4546
Merge pull request #13240 from kb2ma/gcoap/deprecate_add_qstring
net/coap: deprecate gcoap_add_qstring() and update uses
2020-03-13 08:04:50 -04:00
Martine Lenders
20e30ec58b
Merge pull request #13622 from gschorcht/net/dhcpv6_fix_opt_len
sys/net/dhcpv6: fixes option length handling in client implementation
2020-03-12 18:56:43 +01:00
Gunar Schorcht
a25c61bc8b sys/net/dhcpv6: fix client option length handling 2020-03-12 18:33:17 +01:00
benpicco
1212165222
Merge pull request #13584 from kb2ma/nanocoap/add_uquery_improvements
net/nanocoap: add uquery improvements
2020-03-12 15:18:07 +01:00
Ken Bannister
c55837d809 net/nanocoap: add query option directly 2020-03-12 08:44:26 -04:00
Martine S. Lenders
411e320b0c
sock_async_event: update for async callback argument support 2020-03-11 16:54:12 +01:00
Martine S. Lenders
6e6e435c65
sock_async: add optional callback argument 2020-03-11 16:54:11 +01:00
Aiman Ismail
64f9658472 nanocoap: add coap_opt_add_uquery2() 2020-03-05 19:06:14 +01:00
Martine Lenders
ec6c07d35d
Merge pull request #13424 from miri64/examples/enh/dhcpv6-br
examples/gnrc_border_router: add optional DHCPv6 support
2020-02-25 20:08:31 +01:00
benpicco
d044800300
Merge pull request #13450 from benpicco/dns-fixes
fix DNS resolution in ping6
2020-02-24 21:58:34 +01:00
Benjamin Valentin
1de14931b8 sock_dns: use the same buffer for request & reply
Saving RAM is more important than saving a few cycles
used by re-creating the request buffer in the error case.

Also reduce the size of the buffer to 128 bytes.
If we are just requesting the AAAA record it is unlikely
for the reply to take up the maximum size of 512 bytes.

We were already placing restrictions on the domain name length,
those are now actually a bit more relaxed (112 bytes instead of 64)
2020-02-24 14:29:17 +01:00
Benjamin Valentin
e9a40933f7 sock_dns: fix off-by-one error in _parse_dns_reply() 2020-02-24 14:19:50 +01:00
Ken Bannister
e98a6e5932 net/gcoap: update copyright date 2020-02-24 06:22:04 -05:00
Ken Bannister
c8cd3f0229 net/gcoap: fix vera++ code style warnings 2020-02-24 06:20:43 -05:00
Ken Bannister
9b63abb718 net/gcoap: cast required for pic32 platform
Fixes bug found during rework for sock_async implementation.
2020-02-22 05:46:07 -05:00
Ken Bannister
0dc1e4c4e7 net/gcoap: fix when no timeout event
Fixes bug found during rework for sock_async implementation.
2020-02-22 05:46:07 -05:00
Martine S. Lenders
b929d013d8
dhcpv6_client: re-send SOLICITs after failed ADVERTISE 2020-02-20 16:41:48 +01:00
Ken Bannister
d6fa3c7c2f net/gcoap: add timeout event/handler for server response 2020-02-16 09:17:48 -05:00
Ken Bannister
ea62734baf net/gcoap: add sock_async event handling
Rework from earlier custom event/msg handling.
2020-02-16 09:17:48 -05:00
Ken Bannister
7f3e953893 net/cord: update for deprecated gcoap function 2020-01-30 06:00:53 -05:00
Ken Bannister
0ed4fe2da6 net/coap: move/rename function to add query option 2020-01-29 09:23:47 -05:00
Cenk Gündoğan
c84d7d2623
Merge pull request #12887 from leandrolanzieri/pr/kconfig_migrate/gcoap
Kconfig: Expose Gcoap configurations
2020-01-28 18:58:29 +01:00
Leandro Lanzieri
926d32ff30 Kconfig: Expose Gcoap configurations 2020-01-28 11:59:52 +01:00
Leandro Lanzieri
bab6f4737c net/gcoap: Move config macros to 'CONFIG_' namespace
Macros that changed:
GCOAP_MSG_QUEUE_SIZE -> CONFIG_GCOAP_MSG_QUEUE_SIZE
GCOAP_NO_AUTO_INIT -> CONFIG_GCOAP_NO_AUTO_INIT
GCOAP_NO_RETRANS_BACKOFF -> CONFIG_GCOAP_NO_RETRANS_BACKOFF
GCOAP_NON_TIMEOUT -> CONFIG_GCOAP_NON_TIMEOUT
GCOAP_OBS_CLIENTS_MAX -> CONFIG_GCOAP_OBS_CLIENTS_MAX
GCOAP_OBS_OPTIONS_BUF -> CONFIG_GCOAP_OBS_OPTIONS_BUF
GCOAP_OBS_REGISTRATIONS_MAX -> CONFIG_GCOAP_OBS_REGISTRATIONS_MAX
GCOAP_OBS_VALUE_WIDTH -> CONFIG_GCOAP_OBS_VALUE_WIDTH
GCOAP_PDU_BUF_SIZE -> CONFIG_GCOAP_PDU_BUF_SIZE
GCOAP_PORT -> CONFIG_GCOAP_PORT
GCOAP_RECV_TIMEOUT -> CONFIG_GCOAP_RECV_TIMEOUT
GCOAP_REQ_OPTIONS_BUF -> CONFIG_GCOAP_REQ_OPTIONS_BUF
GCOAP_REQ_WAITING_MAX -> CONFIG_GCOAP_REQ_WAITING_MAX
GCOAP_RESEND_BUFS_MAX -> CONFIG_GCOAP_RESEND_BUFS_MAX
GCOAP_RESP_OPTIONS_BUF -> CONFIG_GCOAP_RESP_OPTIONS_BUF
GCOAP_TOKENLEN -> CONFIG_GCOAP_TOKENLEN
2020-01-28 11:59:52 +01:00
Leandro Lanzieri
3f382dc323 net/gcoap: Use COAP_RANDOM_FACTOR_1000 to calculate timeout range
With this the range for the random timeout is calculated using
COAP_RANDOM_FACTOR_1000 (ACK_RANDOM_FACTOR in RFC 7252).
2020-01-27 19:47:20 +01:00
Martine Lenders
1048d67c76
dhcpv6: provide initial client implementation
This implements a client for DHCPv6 IA_PD (Identity Association for
Prefix Delegation). Goal was to have a IETF-compliant alternative to
UHCP. The implementation was based on RFC 8415.
2020-01-16 12:36:03 +01:00
Hauke Petersen
3a7b60e4d4 net/cord_epsim: adapt to gcoap API changes 2019-11-28 12:50:24 +01:00
Hauke Petersen
7b1217a529 net/cord_ep: adapt to gcoap API changes 2019-11-28 12:50:24 +01:00
Hauke Petersen
3fd8357071 net/gcoap: allow to pass user context to requests 2019-11-28 12:50:24 +01:00
Hauke Petersen
383f395af3 net/gcoap: pass memo to resp_handler directly 2019-11-28 12:48:37 +01:00
Hauke Petersen
17b1b19fda net/gcoap: do not allocate RX buf on stack 2019-11-26 15:00:03 +01:00
d4f3747705 sys/net: fix typos 2019-11-23 22:39:38 +01:00
8b06560c02
sys/net/nanocoap: correctly initialize array 2019-10-30 17:03:06 +01:00
95da51bd7f
sys/net/nanocoap: fix potential use of uinitialized variable 2019-10-30 17:03:06 +01:00
5d1480a4b8
sys/net/nanocoap: fail when start data cannot be parsed 2019-10-30 17:03:06 +01:00