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

512 Commits

Author SHA1 Message Date
Marian Buschsieweke
3dad6740da
Merge pull request #17990 from benpicco/nanocoap-void
nanocoap: use void * for payload bytes
2022-05-10 10:49:05 +02:00
Benjamin Valentin
e621afb2dc gcoap: ensure response address is the same as request address
If a node has multiple addresses we must reply to a request with the
same address on which the request was received.
2022-05-10 09:24:56 +02:00
Benjamin Valentin
0847c18a18 nanocoap: use size_t for payload_len 2022-05-03 11:32:20 +02:00
Benjamin Valentin
cabb2c912d nanocoap: use void * for payload bytes 2022-05-03 11:32:20 +02:00
Benjamin Valentin
d03c6390c8 nanocoap_sock: release rx buffer on RESET
We must not return without calling sock_udp_recv_buf() again.
2022-05-03 03:53:56 +02:00
Benjamin Valentin
04a8a36734 nanocoap_sock: only abort nanocoap_sock_get_blockwise() on negative error
Some user callbacks might just return the result of some other operation
that returns written bytes or negative error.

Let's not break those, only consider negative callback returns an error.
2022-04-29 21:29:36 +02:00
eecac6945b nanocoap: Add handler for resource-based subtrees
This adds a coap_handler_t function that can be used to parse new
subtrees. The subtree information is included in the context pointer of
the call and must be of type coap_resource_subtree_t. This object then
contains the pointer and length of a different coap_resource_t instance.
2022-04-23 10:12:18 +02:00
Benjamin Valentin
bb4c597681 nanocoap_sock: document (ab)use of sock_udp_recv_buf(), add asssert() 2022-04-22 11:34:19 +02:00
Benjamin Valentin
b20f89976d nanocoap_sock: pass on error code from user callback 2022-04-22 10:35:52 +02:00
Benjamin Valentin
85833ab58c nanocoap_sock: clean up the request function 2022-04-22 10:35:52 +02:00
Benjamin Valentin
bd7fe3bc5c nanocoap_sock: calculate deadline from interval
So we don't have to wait a full interval again if we got a wrong
message without resend.
2022-04-22 10:35:52 +02:00
Benjamin Valentin
e2fe9d0268 nanocoap_sock: compare response token 2022-04-22 10:35:52 +02:00
Benjamin Valentin
c22b1242ae nanocoap_sock: ensure ctx is reset before receiving new frame 2022-04-22 10:35:52 +02:00
Benjamin Valentin
3ac258ccdf nanocoap_sock: set more false if response was not blockwise 2022-04-22 10:12:27 +02:00
Benjamin Valentin
a5bc3cc069 nanocoap_sock: pass on error code 2022-04-22 10:12:27 +02:00
benpicco
c032e40fba
Merge pull request #17976 from benpicco/coap_get_token
nanocoap: add coap_get_token()
2022-04-22 10:08:30 +02:00
Francisco
7307923703
Merge pull request #17960 from benpicco/sock_urlpath
nanocoap_sock: add nanocoap_sock_url_connect()
2022-04-22 08:26:12 +02:00
Benjamin Valentin
5c1ff580d6 nanocoap_sock: don't decrement retries twice 2022-04-21 15:39:25 +02:00
Benjamin Valentin
845a757eed nanocoap: don't set lastonum if no option was added 2022-04-21 15:39:25 +02:00
Benjamin Valentin
76e2500b7d nanocoap_sock: use random message IDs 2022-04-21 15:39:25 +02:00
Benjamin Valentin
c4f6249992 nanocoap: make use of coap_get_token() 2022-04-21 15:34:31 +02:00
Benjamin Valentin
3d0c1d09c4 gcoap: make use of coap_get_token() 2022-04-21 15:34:31 +02:00
Benjamin Valentin
8d391a4f5f nanocoap_sock: use random timeout 2022-04-21 15:03:31 +02:00
Benjamin Valentin
2ea6c81217 nanocoap_sock: add nanocoap_sock_url_connect() 2022-04-18 01:53:23 +02:00
benpicco
2acbb5ebea
Merge pull request #17947 from fjmolinas/pr_proxy_use_gcoap_port
sys/net/application_layer/gcoap: use COAP_PORT
2022-04-14 16:05:28 +02:00
Francisco Molina
c67a2086de sys/net/application_layer/gcoap: use COAP_PORT 2022-04-14 09:24:35 +02:00
Benjamin Valentin
dbbb602522 net/coap: refactor nanocoap_request for zero-copy operation
This removes the need for a user provied work buffer from nanocoap.
Instead we let the user operate directly on network stack internal
memory and provide a callback mechanism to make sure the memory is
properly freed again.
2022-04-13 19:33:00 +02:00
Oleg Hahm
755ea30da7
Merge pull request #17871 from HendrikVE/pr/sock_dns_mock
sys/net/application_layer/sock_dns_mock: add module for mocking sock_dns
2022-04-08 14:20:17 +02:00
Francisco
c07a11c8cd
Merge pull request #17892 from kfessel/p-ztimer-conversions
sys: some simple xtimer->ztimer conversions
2022-04-04 09:17:46 +02:00
Hendrik van Essen
a9fb3388ca sys/net/application_layer/sock_dns_mock: add module for mocking sock_dns 2022-04-03 17:29:10 +02:00
Karl Fessel
a42c39dbea net/uhcp: convert to ztimer 2022-03-31 12:50:31 +02:00
Martine Lenders
00fdd8a146
nanocoap: introduce coap_opt_remove() 2022-03-31 09:47:57 +02:00
benpicco
6849e33854
Merge pull request #17736 from benpicco/dhcpv6-tweaks
sys/net/dhcpv6: miscellaneous tweaks
2022-03-29 13:52:41 +02:00
Benjamin Valentin
37a4fffb17 sys/net/dhcpv6: consider option 0 an end marker
The REPLY of a TP-Link router (WR400 v4.20) ends with a 0 option
that has a bogus length.
When subtracting the length from the remaining length, we get an
underflow (remaining `len` is 3, option len is 4).

To get a working DHCP response, consider 0 (Reserved) an end marker.
2022-03-28 14:53:00 +02:00
Benjamin Valentin
922a1d7c9a sys/net/dhcpv6: make sanity check more lenient
If we did not enable downstream interfaces yet but have IA_PD enabled
or if we did not configure an interface for IA_NA but have the module
enabled, don't discard the DHCP reply.

If a server does not support an option it will respond with an error
code.
2022-03-28 14:52:59 +02:00
Benjamin Valentin
9cab45931a nanocoap: replace sock_udp_str2ep() with sock_udp_name2ep() 2022-03-24 17:09:16 +01:00
Benjamin Valentin
a6a8356385 nanocoap: add nanocoap_get_blockwise_url_to_buf() function
This moves the internal convenience function suit_coap_get_blockwise_url_buf()
into nanocoap to make it globally available.
2022-03-22 10:36:50 +01:00
Cenk Gündoğan
9746c3a830
nanocoap: add COAP_IGNORE for when method parsing is not important 2022-03-11 14:53:17 +01:00
Cenk Gündoğan
fa19b62cdb
gcoap/forward_proxy: add submodule 2022-03-11 14:53:17 +01:00
benpicco
9896071bb9
Merge pull request #17493 from HendrikVE/pr/auto_init_sock_dns
sys/net/application_layer/sock_dns: add pseudomodule auto_init_sock_dns
2022-03-10 00:53:32 +01:00
Hendrik van Essen
0b0910f82a sys/net/application_layer/sock_dns: add pseudomodule auto_init_sock_dns 2022-03-09 20:05:20 +01:00
benpicco
c411edef55
Merge pull request #16688 from miri64/gcoap/enh/multitransport
gcoap: multi-transport support
2022-03-03 12:15:48 +01:00
Benjamin Valentin
2034fa5101 sys/net/application_layer: add telnet server module 2022-03-01 23:07:22 +01:00
Martine Lenders
287bfdc10d
gcoap: multi-transport support for listeners 2022-03-01 19:33:15 +01:00
Martine Lenders
90eae8e0a4
gcoap: multi-transport support for clients
23a8659bdf introduced DTLS support for
CoAP, but did not make it possible to select the transport on request.
Since switching between CoAP and CoAPS (CoAP-over-DTLS) as client is a
valid use case (one might want to e.g. talk to one server over CoAP and
to another over CoAPS), this change makes that possible.
2022-03-01 19:26:10 +01:00
Karl Fessel
35107ec4ba sys/net: add missing includes 2022-02-28 14:53:07 +01:00
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