Along with key-value pairs, add an option to dump vendor values as a
blob, use can choose either one or both.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Keep a separate buffer for each request context instead of having a
single common buffer for the entire client context. This allows to
simplify the retransmission logic, as parallel requests will no longer
overwrite the buffer for each other. That way, we can simply retransmit
the packet w/o a need to recreate it, and thus reach to the payload
pointer or callback.
This removes the requirement to keep the payload pointer, provided to
asynchronous coap_client_req() call, valid throughout the exchange
lifetime for simple cases (i.e. no block transfer used). In case of
block transfer, this is unavoidable and needs to be documented.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Use buffers instead of pointers for path and extra options provided in
the struct coap_client_request, so that the library keeps a copy of the
path/options instead of pointers. That way, the library can still work
correctly in case of retransmissions or block transfer in case when the
original path or options were automatic variables that went out of
context.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Revert a change that broke the stable API function shell_set_bypass.
This reverts commit 6b876dba1ba61b659b1b2d4c3ccd0ac41bd56027.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Fix overriding the test certificates directory for enterprise mode
when using sysbuild. The override already works as expected without
sysbuild.
Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
mbedtls_ssl_get_peer_cid takes size_t, not socklen_t.
c546c1cad1
changed the type of socklen_t to something that is incompatible with native
offloaded sockets, which caused a compiler error.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Neighbor Advertisement (NA) messages without a link-layer address option
are now accepted on point-to-point links. See RFC 7066, ch. 2.2.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
Offset introduced by https://github.com/zephyrproject-rtos/zephyr/pull/72590 is missing
for write_package_cb call in SWGMGT OBJ this fixes compile issues
by adding the offset parameter
Signed-off-by: Kiril Tzvetanov Goguev <kiril.goguev@voiapp.io>
When an IPV6 message that contains an RDNSS ICMPV6 option with a lifetime
equal to 0 is received, proceed to delete the indicated recursive DNS
servers listed in that option.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Allow passing some context to the shell bypass callback function by
providing a void pointer user data argument.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add an optional payload callback field to the coap_client_request
structure, allowing the application to provide blocks of payload
interactively during the resource upload, instead of having to provide
entire payload in a single contigunous memory space.
If registered, the CoAP client library will call the payload callback
whenever a new PUT/POST message is being generated (note this is also
true for retransmissions) instead of using the payload pointer/length.
If the payload callback is NULL, then the library operates as usual.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
During block uploads, the server may respond with Block 1 option with
a smaller block size than currently used (so called block size
negotiation). The CoAP client however did not read the Block 1 option
from the response, therefore ignoring the server request to lower the
block size.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a new sample to demonstrate usage of the newly introduced
Network MIDI 2.0 host stack.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
Add a new network protocol for MIDI2.0 over the network, using UDP sockets.
This allows Zephyr to host a UMP endpoint on the network, which can be
invited by UMP clients to exchange MIDI2.0 data.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
Pass a pointer to the CoAP packet in the response data. This allows
callback function to inspect for CoAP options.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Make it easier to modify the response callback data by passing it as a
struct pointer rather than a long list of arguments.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The code was writing to the dst without a verification check on
size which is not appropriate. The guard on the arguements should
be enforced and so just ensure the size is larger then the
definition of the strings from POSIX and return an error in those
cases.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
From the manpage for inet_ntop
This function converts the network address structure src in the af
address family into a character string. The resulting string is
copied to the buffer pointed to by dst, which must be a non-null
pointer. The caller specifies the number of bytes available in
this buffer in the argument size.
In an unintended misconfiguration the resolve max string ended up
being 20 and tracking thru some wierd code issues determined some
stack corruption which came back to the shell command. So, just
fix the size argument to be the sizeof which then leads to the next
problem that the size is being ignored by inet_ntop.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
zsock_recvfrom() takes as last argument a socklen_t pointer
( c546c1cad1 )
whose definition has changed.
So let's ensure we pass the right type of pointer to it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
zsock_recvfrom() takes as last argument a socklen_t pointer
which type was changed in
c546c1cad1
as is not anymore equivalent to size_t.
So let's ensure we pass the right type of pointer to it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
There is an issue when zephyr is compiled with native_sim_64 where
size_t is 8 bytes. The socklen_t in specified as 4 bytes in Linux
even for 64 bit builds so we have a conflict between Linux and Zephyr.
To make things work properly, define socklen_t as uint32_t in order to
align with Linux. Four bytes is enough for socket address length anyway.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When connecting to WiFi from stored credentials, the key_passwd is never
freed.
Additionally if the connect fails, the allocated data was never freed.
Convert heap allocated memory to stack allocated buffers.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Rename these three macros to an unprefixed lower-case variant. This is
normally not done for Zephyr macros (see container_of) but in this case
it seems like a good idea to adopt the lowercase names to:
1. have the same convention as the equivalent Linux macros, helping devs
working cross project recognizing (mis)use patterns.
2. make it somewhat intuitive that the lowercase ones are meant to be
used in functions while the uppercase ones are to be used for static
evaluation.
Add few c++ guards to avoid colliding with std::min and std::max.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Zephyr crashes when a new websocket connection is refused by the
user supplied callback function. This is caused by multiple calls
of close_client_connection(). After the first call the file handle
and the client->service pointer are invalid.
This fix checks if the file handle is valid.
Signed-off-by: Andreas Schweigstill <andreas@schweigstill.de>
DSA switch performs L2 switching on hardware on DSA user ports.
The promisc mode requirement doesn't apply to DSA user ports.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Since the protocol doesn't have message IDs in the responses to these
update messages, there's no reliable way to know, if an update succeeded or
not. I use that fact to simplify the implementation by:
- Not providing success/failure callbacks.
- Not handling updating the variables in the client struct while
an update is in progess.
In addition to adding some tests, I tested this with the emqx server.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Add a default heap reservation for gettaddrinfo(), enough for a single
function call in a default configuration on 64-bit platform.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There are some poorly compliant mdns responders on the network
that will respond with zero counts on the answers and the additional
records (in addition to the qdcount). So, this removes the checks
in the unpack method since this is a "valid" DNS packet but the
logic is already partially handled in the dns_read code already.
An example packet can be seen in this decode
0000 33 33 00 00 00 fb 9a f8 c3 0c 07 0b 86 dd 60 07 33............`.
0010 c4 e4 00 14 11 ff fe 80 00 00 00 00 00 00 98 f8 ................
0020 c3 ff fe 0c 07 0b ff 02 00 00 00 00 00 00 00 00 ................
0030 00 00 00 00 00 fb 14 e9 14 e9 00 14 f1 64 00 00 .............d..
0040 84 00 00 00 00 00 00 00 00 00 ..........
User Datagram Protocol, Src Port: 5353, Dst Port: 5353
Source Port: 5353
Destination Port: 5353
Length: 20
Checksum: 0xf164 [unverified]
[Checksum Status: Unverified]
[Stream index: 2]
[Stream Packet Number: 1]
[Timestamps]
UDP payload (12 bytes)
Multicast Domain Name System (response)
Transaction ID: 0x0000
Flags: 0x8400 Standard query response, No error
1... .... .... .... = Response: Message is a response
.000 0... .... .... = Opcode: Standard query (0)
.... .1.. .... .... = Authoritative: Server is an authority
for domain
.... ..0. .... .... = Truncated: Message is not truncated
.... ...0 .... .... = Recursion desired: Don't do query recursively
.... .... 0... .... = Recursion available: Server can't do
recursive queries
.... .... .0.. .... = Z: reserved (0)
.... .... ..0. .... = Answer authenticated: Answer/authority
portion was not authenticated by the server
.... .... ...0 .... = Non-authenticated data: Unacceptable
.... .... .... 0000 = Reply code: No error (0)
Questions: 0
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
When running just the test mqtt_sn_client::test_mqtt_sn_wait_suback on
native_sim, the current timestamp is still 0. That caused the test to fail,
because 0 is used as an indicator, that the message has never been sent,
thus sending it every time process_work is executed.
Instead of adding additional variables and complexity, the code now simply
treats now==0 special and waits 1ms until doing anything.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
- The paho client does that, too.
- This allows running single tests, because they don't rely on previous
ones having incremented the msg_id a certain number of times.
- The variable already existed in the client struct, but wasn't used. I
guess it was intended that way but never implemented.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Making the assumption, that mqtt_sn_connect does not process any incoming
data allows for this to be a very simple, additional API function instead
of adding more complexity to the connect function. This also means that the
user has to re-add predefined topics upon reconnects which don't reuse the
old session though.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Commit 48897a9090 fixed the address
mapping for dual-stack sockets when sendmsg() was used, however the same
similar issue appears (cannot check for AF_INET family for mapped
addresses as those are AF_INET6) for regular sendto() calls.
Therefore, for the sendto() case, where dst_addr is specified, check if
the address is mapped with net_ipv6_addr_is_v4_mapped() function as
well.
This also fixes another bug in sendmsg() case, where msghdr->msg_name
could've been dereferenced even if it was NULL (for example in case
of a connected socket).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
It is easier to debug things when both the relative and absolute
TCP seq and ack numbers are printed in debug prints.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use the socket eof flag to determine whether the receive
callback should be installed. If the receive cb is not installed,
then the socket cannot receive any data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This PR includes OpenThread's NAT64 header file when
NAT64_TRANSLATOR is enabled. This is done to avoid compile
warnings when OT NAT64 API is used.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Ethernet TX should not handle bridge forwarding. The bridge layer
had already handled forwarding.
Current code is causing duplicated TX if sending is via bridge
interface, or causing needless TX on other bridge ports if sending
is via one bridge port.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
There were several problems of pkt management during forwarding.
1. No need to do net_pkt_ref/net_pkt_unref around net_if_queue_tx.
2. Finally when completed forwarding, there was a net_pkt_unref for
pkt using cloning. However it also applied to pkt not using
cloning. This was causing pkt was released before sending.
3. Whether pkt cloning used or not, should not be decided by bridge
interfaces count. It's should be decided by interface count to
forward.
An example was sending pkt via bridge interface. If there were
two interfaces attached to bridge, cloning was needed but current
code won't.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
- Initialize platform requirements and start OpenThread DHCP6_PD
feature.
- Added initialization logic for DNS upstream resolver.
OTBR message data structure has been updated to store a user data
structure, if needed.
- Added SRP server initialization call.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
GCC gave the following warning:
mqtt_sn_transport_udp.c: In function ‘tp_udp_init’:
mqtt_sn_transport_udp.c:117:9: warning: ‘memcpy’ forming offset [12, 105]
is out of the bounds [0, 12] of object ‘mreqn’ with type ‘struct ip_mreqn’
[-Warray-bounds=]
117 | memcpy(&mreqn.imr_multiaddr, &udp->bcaddr.data[2], si...
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mqtt_sn_transport_udp.c:48:25: note: ‘mreqn’ declared here
48 | struct ip_mreqn mreqn;
| ^~~~~
And it turns out that it's right. The original code looks like it tries to
copy the IP address to imr_multiaddr in a way that works for both v4 and
v6. It ignores, that bcaddr.data may be way larger than even a v6 addr,
because it's a buffer that's big enough to hold many other structs as well.
Not only that, IP_ADD_MEMBERSHIP is for IPv4 only and imr_multiaddr can
only hold an IPv4 address anyway.
This modifies the code to have separate code paths for v4 and v6 and call
the correct APIs. This also gets rid of the memcpy, since it can be a
simple struct assignment now.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
dns_unpack_query() no longer prepends the unpacked query with extra dot,
therefore LLMNR responder needs to be aligned with this change when
parsing result and preparing response.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
dns_unpack_query() no longer prepends the unpacked query with extra dot,
therefore mDNS responder needs to be aligned with this change when
parsing result and preparing response.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>