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

286 Commits

Author SHA1 Message Date
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