Add new function to allocate additional buffers for net_pkt, w/o any
additional preconditions/checks. Just allocate what was requested.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RSRQ is the ratio between send and received signal strength and usually
understood/expected to be represented as a ratio in dB and as such always
has a negative range. So to allow RSRQ to be represented correctly the
resource must allow negative values, but currently it's limited to unsigned
8bit integers.
Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
Network interface numbering starts from 1, therefore when accessing
help/index array, the interface index should not be used directly, but
rather decremented by 1, to avoid out-of-bound access on those arrays.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure that the error message does not overflow the transmit buffer
when copying the error message string.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There's not really much to do when the transmission of the error reply
fails, but we can at least log the failure.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The result of string to float conversion in LwM2M shell write command
was not verified, which could result in incorrect data being written to
the resource.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Verify the return value of net_pkt_skip() function, in case the parser
ignores the unrecognized options, so that in case the option was
malformed and the actual provided option length exceeds the packet
length, it is recognize (net_pkt_skip() should fail then).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As reported by Coverity, cpkt was being used before checking it's not
NULL.
Fixes#65372 / CID: 323075
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.
The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.
This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Since lwm2m_load_tls_credentials(ctx) will assume that the ctx has a
valid security object assigned to it, it should not be called at all
when ctx.use_dtls == false.
This solves a major bug where LwM2M comms are DTLS encrypted but FOTA is
allowed to be plain-text.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
No issues with gcc but clang gives this error for
the *v4 variable few lines below.
.../lib/dns/mdns_responder.c:712:2: error: expected expression
struct net_context *v4;
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of just listening first network interface in the system,
install a multicast listener to all available network interfaces.
Fixes#18748
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add a helper macro that can be used at runtime to return
the number of network interfaces in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to bind to different network interface. This is
useful if binding a multicast address to a certain network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
DTLS Connection Identifier support requires DTLS stack
that supports it. MbedTLS support in Zephyr is already
ported in, also some offloaded sockets support it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The use case is to have a netbuf pool that is used exclusively with
net_buf_alloc_with_data() where the destroy callback takes care of
freeing the actual data buffer pointed to by __buf.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Adds a shell interface for TLS Credentials, allowing management of
credentials via the Zephyr shell
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add (internal) support for sectag iterating.
Also officially marks negative sectag values as reserved for internal
use.
This will allow a prospective TLS credentials shell to iterate over all
available credentials.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds an internal credential_digest for generating a string digest of
credentials.
Such digests would allow users of a prospective TLS credentials shell to
verify the contents of a given credential without directly accessing
those contents.
Offloading the digest process to the underlying backend allows backends
for which private portions are not directly accessible to be eventually
supported.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
A CoAP client can re-issue an observe request (same endpoint and token)
to refresh it's subscription. No new observer should be registered in
this case.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add a function to the public CoAP API to find and return the unique
observer based on the address and token.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A recent iface lock removal in ed17320c3d
exposed issues with concurrent access on TX to drivers that are not
re-entrant.
Reverting that commit does not really solve the problem, as it would
still exist if multiple Traffic Class queues are in use.
Therefore, introduce a separate mutex for TX data path, protecting the
L2/driver from concurrent transfers from several threads.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Core objects version reporting was broken for LwM2M version 1.1, as the
default object version not necessarily matches the LwM2M version.
Therefore, implement a table with default object versions for particular
LwM2M version, which can be looked up when determining whether it's
needed to include object version or not during Registration/Discovery.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit adds the option to register an event handler to CoAP
resources when observers are added/removed.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The main action in this function it queueing the packet for
transmission which doesn't need a lock and interface flags use atomic
operations.
So, remove the unnecessary lock.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
In CoAP blockwise the client is supposed to
respond with 2.31 Continue code on Ack. This was recently
broken when Block1 parsing was moved after the initialization
of reponse packet. We need separate CoAP API to modify the code
of existing CoAP packet.
Also Ack packet should contain the Block1 options, even the
last one.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Instead of consistently checking for both, IPv4 and IPv6 fragmentation
in several places, add a hidden Kconfig symbol which indicates that some
IP fragmentation has been enabled (either IPv4 or IPv6 or both).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The current logic to determine whether a packet is IP reassembled is
flawed, as it only worked in certain conditions (which was ok, as the
conditions were satisfied for the current use case, but now it's a
public function). Therefore, add an explicit flag that indicates whether
a packet is IP reassembled or not.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case of reassembled IP packets, we cannot rely on checksum
offloading as the drivers/HW has no means to verify L4 checksum before
the fragment is reassembled. Therefore, for such packets, verify L4
checksum in the software unconditionally.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Move the existing code verifying that the net_pkt was reassembled at IP
level to a helper function, as it will be needed in other places as
well. Additionally, add packet family check before accessing union
fields.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
IPv4/6 fragmentation did not set the net_context pointer on the fragment
packet and in result the send callback registered on net_context was not
called. Therefore, copy the net_context pointer from the original packet
to the final fragment to ensure that the registered callback is called.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Skipping both next_hdr_off and last_hdr_off and filling last_hdr
variable doesn't make much sense, as this effectively moves the packet
cursor inside/behind the last (L4) header with no particular meaning.
Plus the last_hdr variable isn't really used anywhere, which kind of
proves the point. Therefore, remove the unused variable and needless
net_pkt operations.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case the stack has to fragment the IPv6 packet, calculate the
checksum before fragmentation (if haven't done so).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case the stack has to fragment the IPv4 packet, calculate the
checksum before fragmentation (if haven't done so).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Modify internal L4 protocols APIs, to allow to enforce checksum
calculation, regardless of the checksum HW offloading capability.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new net_pkt checksum, which indicate checksum status on the packet
(i. e. whether it has already been calculated or not).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fix tcp.c compilation if user unsets
CONFIG_NET_TCP_CONGESTION_AVOIDANCE config option.
Fixes#64824
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The enum is mainly to print output of band, so, the default value is 0
which means 2.4GHz, which is not correct when using it to configure like
in connect.
Fix the default value to unknown i.e., no user preference. This way we
can use same enum for both set and get.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Implement testcases for Information Reporting Interface [300-399]:
* LightweightM2M-1.1-int-301 - Observation and Notification of parameter
values
* LightweightM2M-1.1-int-302 - Cancel Observations using Reset
* LightweightM2M-1.1-int-304 - Observe-Composite Operation
* LightweightM2M-1.1-int-306 – Send Operation
* LightweightM2M-1.1-int-307 – Muting Send
* LightweightM2M-1.1-int-308 - Observe-Composite and Creating
Object Instance
* LightweightM2M-1.1-int-309 - Observe-Composite and Deleting
Object Instance
* LightweightM2M-1.1-int-310 - Observe-Composite and modification of
parameter values
* LightweightM2M-1.1-int-311 - Send command
303 and 305 cannot be implemented using Leshan as it only support
passive cancelling of observation.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If the interface is WiFi one, then print information about it.
Also the device information is useful to know so print device
name corresponding to the network interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit names a couple of choices to allow the default
value to be overridden by Kconfig files out of tree
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Do not include the resource type (rt=) in the registration message when
using the OMA JSON format. This was a workaround specifically for the
Wakaama LwM2M server which is no longer needed since the latest master
branch.
Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
Portfolio object created string buffers for Identity resources
that was overlapping on some cases.
Don't calculate pointers by hand, allow compiler to calculate it.
Fixes#64634
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Extend the previous support of creating object instances by allowing
creation of resource instances as well.
Similarly, add support for deleting.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If user adds IPv6 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user adds IPv4 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Fixes#64389
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Default behaviour should only bind to port independent of IP, this
allows even multicast/broadcast L4 traffic to be received.
User can always specify a specific address to bind using shell or
Kconfig or API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Using a generic IP for address set failures is confusing, esp. two same
prints (one for v4 and the other for v6), so, use explicit version.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Moving the Zephyr specific config options from
modules/hostap/Kconfig to corresponding Kconfig where the
option is specified.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
CoAP reply structure user_data should be kept between
ongoing blocks, so that callbacks for LwM2M send continue
to work on blockwise transfers.
Fixes#64290
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The new "net sockets" command will utilize the object core
support to track and show information about BSD sockets that
are created in the system. This command is able to show info
for all network sockets (native, offloaded etc) in the system.
Example of the output of the new command:
uart:~$ net sockets
Creator Name Flags FD Lifetime (ms) Sent Received
main af_inet46 6ST 0 3260 819 498
main af_inet46 4ST 1 2110 469 142
main af_inet46 6DU 2 2110 9941 9941
main af_inet46 4DU 3 2110 1375 621
4 active sockets found.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The writefds is typically set if there is an error while
waiting for example the connect() to finish. So check if
the user supplied the writefds and update it accordingly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If we try to connect to a port which no socket is listening to,
we will get a packet with "ACK | RST" flags set. In this case
the errno should be ECONNREFUSED instead of ETIMEDOUT like we
used to return earlier.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Increase reference count already when initial SYN is sent.
This way the tcp pointer in net_context is fully valid for
the duration of the connection.
Fixes#63952
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In case ping is sent to own address, the request is looped back to the
stack and served before ping work had a chance to reschedule. In result,
when the final ping reply has been server, and ping operation finalized
with `ping_done()`, the work was rescheduled one last time, causing the
ping timeout to be reported. Fix this by rescheduling the work before
sending the actual request, so that the reply handler can cancel the
work properly in such case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case packet is looped back to the stack, set LL address information
on the packet, using the LL address set on the corresponding network
interface, so that the information can be interpreted by the SOCK_DGRAM
packet socket.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If we run network tests under tests/net, then set the
Dummy network interface as a default one so that it will
be picked up first.
This should solve the issue if the DUT is having a real
network interfaces like onboard Ethernet interface which
could cause the test to fail. The test might fail in this
case because the network tests assume that only simulated
network interfaces are used by the tests.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The remote address of the connection is checked whether
it is v4-mapping-to-v6 address in which case we should
print it such.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When a new incoming connection is accepted, do not overwrite
the listening remote address. The remote address for the
listening socket is the any address (like :: for IPv6)
and not the accepted socket remote address.
This only affects the "net conn" shell command which prints
the remote address incorrectly. There is no problem accepting
new connections in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We should use the NET_CONN_RANK() macro when printing the
current rank value as that macro masks the rank values properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The socket address passed in accept() call should point
to the new connection address and not the old one.
Fortunately this only affects things after the v4-mapping-to-v6
support so older code than this works fine.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The address length of the accepted socket must reflect the
size of the address struct, so it should either be
sizeof(struct sockaddr_in) for IPv4 or sizeof(struct sockaddr_in6) for
IPv6 socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This allows IPv4 and IPv6 share the same port space.
User can still control the behavior of the v4-mapping-to-v6
by using the IPV6_V6ONLY socket option at runtime.
Currently the IPv4 mapping to IPv6 is turned off by
default, and also the IPV6_V6ONLY is true by default which
means that IPv4 and IPv6 do not share the port space.
Only way to use v4-mapping-to-v6 is to enable the Kconfig
option and turn off the v6only socket option.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add support for IPv4 mapped IPv6 addresses when converting
IP address to a string in inet_ntop() function.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fix two issues with net tcp command:
* The `net tcp` commands are still based on net_context API. For TCP,
the API caller (net shell) should add one extra reference to the
allocated net context, to prevent premature context release in case of
connection teardown. Currently that was not the case, and the context
was released too early, resulting in missing final ACK from the Zephyr
side on connection close.
* The net context API should not be called from the registered connect
callback, as this creates a temporary deadlock situation. The
net_context_connect() function blocks until the connection is
established, or an error or timeout occurs. For that time the
net_context mutex is being locked. In case of connection error (for
example after receiving RST packet) the connect callback is called,
indicating an error. If we try to call net_context API from within, a
deadlock situation takes place, as the context mutex is still locked
by the net_context_connect() (called from the shell thread). This
blocks the further execution of the TCP stack and can result in an
unexpected behavior (like for example retransmitting the SYN packet,
which takes place from yet another thread, TCP work queue).
Fix this, by releasing the net context not from the callback directly,
but based on the return value from net_context_connect().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The warning which became error looks like this
error: type qualifiers ignored on function return type
[-Werror=ignored-qualifiers]
219 | const char * const wifi_ps_txt(enum wifi_ps ps_name);
It is pointless to add a const qualifier to a return value.
So remove the const pointer to avoid this warning.
Fixes#64197
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The interface number is generated automatically if one
presses <tab> when expecting the interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow multiple commands use the same dynamic shell command
completion when expecting network interface index.
For example "net iface" and "net stats" are such commands.
The network interface expansion cannot be used in "net ipv6 add",
"net ipv4 add" and "net route" commands as they require more
data after the network interface index argument.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The "net stacks" has been obsolete for a long time already
so remove it for good. It is replaced by "kernel stacks" cmd.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is a preparation for the refactoring. The old "net" command
is renamed "net_old" so that the individual commands can be
placed into a separate .c files.
This is done like this because we need to use the
SHELL_SUBCMD_SET_CREATE() to create the sub-command and then
use the SHELL_SUBCMD_ADD() in the .c files to add the command
into the sub-command and not get conflict with the same name
sub-command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is preparation commit that moves the net shell code to
subsys/net/lib/shell directory. The following commits will
then refactor the code in net_shell.c to smaller and more
manageable pieces.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of strlen() use sizeof() in FL() macro. This way
all the checks are done at compile time instead of runtime.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add Kconfig option to control TCP RST behavior on connection attempts on
unbound ports. If enabled, TCP stack will reply with RST packet (enabled
by default).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Send RST as a reply for unexpected TCP packets in the following
scenarios:
1) Unexpected ACK value received during handshake (connection still open
on the peer side),
2) Unexpected data packet on a listening port (accepted connection
closed),
3) SYN received on a closed port.
This allows the other end to detect that the connection is no longer
valid (for example due to reboot) and release the resources.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a helper function which allows to send a RST packet in response to
an unexpected TCP packet, w/o associated connection or net context.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As composite operations don't have path in CoAP packet,
it wrongly triggered a check for security object and got
denied the access.
Fixes#64012
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When objects are initialized, empty strings should be set to length of
zero, instead of length of the full buffer.
So use INIT_OBJ_RES_DATA_LEN() to give both, the buffer size and data
length.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When resource instances are initialized, we must calculate
beginning of the data buffer using the index and maximum
data length. Otherwise buffers would overlap with previous.
Fixes#64011
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
As the lwm2m_registry.c and specificly lwm2m_set()
functions already ensure null-terminator on string and
count that into string lenght, the content type handlers
should do the same.
When string is written, strlen()+1 is the data length.
When string is read, use the data length, so we don't
leak uninitialized strings. If buffer overrun have
removed the null-terminator the strlen() migh be larger
than data_len.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Resend the request with Echo option and the received Echo
option value when receiving a 4.01 (Unauthorized) response
with the Echo option.
Add missing header file kernel.h to coap_client.h.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
The stack size was previously hardcoded in the source code, making it
difficult to change when enabling options that require a larger stack.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
According to IEEE Std 802.1AS-2011 11.3.3, gPTP messages are not
VLAN-tagged.
Remove the use of VLAN headers for gPTP messages on the TX path.
The RX path is handled by the drivers. The network drivers in Zephyr
might need to be updated as well in order to accept receiving
non-VLAN-tagged gPTP messages when the CONFIG_NET_VLAN option is
selected.
Continue sending gPTP packets with VLAN tags when CONFIG_NET_GPTP_VLAN
is enabled. Specify that this option is for testing purposes.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
The previous implementation was setting priority 3 (Critical
applications) for Sync, Pdelay and Pdelay_Resp messages; and priority 6
(Internetwork control) for the other PTP messages. This might have been
done under the incorrect understanding that "Critical applications" was
the highest priority.
This resulted in the Pdelay_Resp_Follow_Up getting sent before the
Pdelay_Resp message when enough TC_TX queues were being used
(NET_TC_TX_COUNT >= 2), which is an inversion compared to the intended
order.
Invert the priority of the outgoing PTP packets so that the PTP event
messages are sent with higher priority, as was originally intended.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
The priority 3 (Critical applications) was incorrectly marked as
"highest priority", which might have led to incorrect use of
NET_PRIORITY_CA in some cases.
Note that this is already correctly advertized in other places, as it
was partially fixed in af8a0b1a5d.
NET_TC_SKIP_FOR_HIGH_PRIO was previously only allowing to push priority
3 (Critical applications) packets directly to the driver, but not the
ones with a higher priority. Change it so that it is now in effect for
priority 3 and above.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Add new configuration value CONFIG_LWM2M_UPDATE_PERIOD
that allows calculating update period from last update,
instead of calculating it from the lifetime.
In runtime, server is allowed to change the lifetime of the
registration which causes update perdiod to be effected.
When fixed update period is preferred, UPDATE_PERIOD
config is then used.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fixing kernel crash caused by memory release
while having a scheduled work item pending.
Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Currently context->local is not set for offloaded interface.
This change move net_offload_bind call after set of context->local.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Only confirmable messages need pending tracking. Non-confirmable
messages are released after sending.
Match incoming packets with token, not message ID.
Ignore responses with non-matching tokens.
Remove unused function send_reset().
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
In case observation token changes (the LwM2M server re-sends
observation request to the client), the LwM2M engine should cancel any
ongoing notifications based on the old token. Otherwise, it will be
impossible to match the pending notification reply (ACK) with the
observer context anymore, causing new notifications for this
observation to stall.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The compiler emits a "null where non-null expected" warning unless the
argument of strlen is non-null at compile time.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Always clone net_pkt to pass to promiscuous queue.
Previously, net_pkt was passed to L2 before conditionally cloning.
But L2 would in some cases strip ethernet headers, so cloned
net_pkt received through promiscuous interface would be missing headers.
Signed-off-by: Kieran Tyrrell <kieran@sienda.com>
The mode command operation has to be set to WIFI_MGMT_GET when the
option -g is provided. It was mistakenly set to true. Correcting the
same
This PR fixes#63424 and sets the proper value for the get command
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
This commit adds a check to prevent attempting to reestablish
the PPP session if the carrier is down. Without this check,
the PPP FSM attempts and fails to establish a PPP session
twice before giving up. The behavior is not breaking anything,
but it is not desired.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Rearranges the k_mem_slab fields so that information that describes
how much of the memory slab is used is co-located. This will allow
easier of its statistics into the object core statistics reporting
framework.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
A minor overlook from the recent ICMP rework, the registered handlers
should no longer unref the processed packet as it's now the
responsibility of the ICMP module.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As we already log fragmented packets there's no need to log them again
unless they have been fully assembled and the result is to be logged.
We also want to log the final packet in all cases (after mangling LL
address) for the non-fragmented case.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
It is the general rule in Zephyr's network stack that methods that
return NET_OK are expected to have "consumed" the packet, i.e. it should
not be referenced any more.
This change applies this rule to the methods in ieee802154_mgmt.* for
improved consistency with the remainder of the network stack.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The "encryption only" security level was deprecated in IEEE
802.15.4-2015. This deprecation has already been introduced in the code
but was overlooked in net config.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:
Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The current zperf tcp/udp download command doesn't provide the option
to bind the server to a specific host address. If there is more than
one interface, it will not be possible to test each interface with zperf
tcp/udp download command without building the Zpehyr.
This patch will add support for zperf tcp/udp download command to bind
server to host interface address.
Signed-off-by: Rahul Singh <rahul.singh@arm.com>
Added a new event for LWM2M_RD_CLIENT_EVENT_DEREGISTER for
indicate LwM2M client dereistartion.
Updated unit test and sample for new event type
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
The experimental status of the PPP L2 is long overdue so
it can be removed as the component is working fine.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This adds a function k_object_is_valid() to check if a kernel
object exists, of certain type, and has been initialized.
This replaces the same (or very similar) code that has been
copied from kernel into the network subsystem.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Re-add the `WIFI_MGMT_FORCED_PASSIVE_SCAN` option removed in #62751.
Now that `struct wifi_scan_params` is a reasonable size, we can enforce
the passive scan request even when no parameter struct is supplied by
the user.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Instead of providing a comma seperated list of SSIDs, provide the SSIDs
individually. This substantially simplifies the implementation.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Fix bug in timeout_expired() function. Coap client was resending
pending messages after 500 ms (COAP_PERIODIC_TIMEOUT) and didn't
wait for retransmission timeout.
Use 64-bit k_uptime_get()
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Hides types used in the IEEE 802.15.4 L2 sub-API and L2-internal APIs
that are of no public interest and improves documentation of the
remainder.
The changes are mostly minor as the API documentation had already been
improved and clarified in previous changes. Also includes non-visible
documentation to the subsystem-internal Frame API by adding references
to the specification.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Write documentation for conn_mgr and its subsystems, especially
guidelines for writing connectivity implementations
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
The CONFIG_NET_L2_WIFI_SHELL isn't always enabled.
But these functions might still be used, so need to
move functions into mgmt.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
If an IPv4 address is requested on an IPv6 interface or vice versa
use a sane default fallback address to send the response.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The zperf shell sends a IPv6 ping at the start when working
with IPv6. Convert the sending of the ping to use the new API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add suitable functions that offloaded network device driver
can receive ICMP Echo-Request (ping) requests and give
ICMP responses back when it receives them from the network.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add new net_if_is_offloaded(iface) that returns true if
the network interface is offloaded (either IP or socket
offloading is enabled for that interface) and false if
the interface is not offloaded.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to send ICMP Echo Request message a.k.a pings.
The same ICMP API and framework is used for network stack
internal needs in later commits. One benefit for this new
API is that it allows sending Echo Requests to offlined
network devices.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add DHCPv6 support to the net config library. In case DHCPv6 is enabled,
net config will attempt to acquire IPv6 address and/or prefix when used.
The user can select with Kconfig whether to request address or prefix
(or both).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a DHCPv6 client implementation for Zephyr (RFC 8415).
The implementation allows to request IPv6 address and/or prefix from the
DHCPv6 server, and for now supports only the mandatory set of DHCPv6
options needed to achieve this. Currently the implementation supports
the following scenarios:
* Requesting new IPv6 address/prefix with Solicit/Request exchange
* Refreshing existing leases with Confirm, Renew or Rebind (depending
on the context).
For now, no Information Request (the case where neither IPv6 address or
prefix are requested) is supported. No support for Reconfigure was added
either, as this is optional (the client manifests clearly to the server
that it does not support Reconfigure). Support for these can be added
later if needed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Code using sys_csrand_get should depend on CONFIG_CSPRNG_ENABLED symbol
and not in ENTROPY_HAS_DRIVER since they are not using the entropy
device directly.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Replaces the previous approach to define bands via hardware capabilities
by the standard conforming concept of channel pages.
In the short term this allows us to correctly calculate the PHY specific
symbol rate and several parameters that directly depend from the symbol
rate and were previously not being correctly calculated for some of the
drivers whose channel pages could not be represented previously:
* We now support sub-nanosecond precision symbol rates for UWB. Rounding
errors are being minimized by switching from a divide-then-multiply
approach to a multiply-then-divide approach.
* UWB HRP: symbol rate depends on channel page specific preamble symbol
rate which again requires the pulse repetition value to be known
* Several MAC timings are being corrected based on the now correctly
calculated symbol rates, namely aTurnaroundTime, aUnitBackoffPeriod,
aBaseSuperframeDuration.
In the long term, this change unlocks such highly promising functional
areas as UWB ranging and SUN-PHY channel hopping in the SubG area (plus
of course any other PHY specific feature).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Previously each piece of LwM2M SEND was
using token length of zero. I think this was unintentional.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
To protect the integrity of outgoing block-wise transfers, append
Etag option that allows client to see if the received block is
generated from same content as it is expecting.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow blockwise-send buffers to be used with GET and FETCH
queries as well.
When outgoing packet is split into multiple blocks, don't free
it when first block is send. Keep it in memory until some other requests
come.
Following queries to next block are matched using CoAP token.
However, this required Leshan to use COAP.BLOCKWISE_REUSE_TOKEN=true
option from Californium.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
lwm2m_udp_receive() is only called with same function
pointer, so there no need to carry that in the parameter.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
In reality, single-write is the only operation that handles
BLOCK1 operations when receiving paylod.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Partial content format support is required to have a proper support
for content format OPAQUE instead of threading it as a part of
plain text format.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Move commands that require parameters first into the list.
Move syntax line first, command documentation second,
flags last. This is much like Unix commands do
❯ /bin/ls --help
Usage: /bin/ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Compared to:
uart:~$ lwm2m
lwm2m - LwM2M commands
Subcommands:
read :read PATH [OPTIONS]
Read value from LwM2M resource
-x Read value as hex stream (default)
-s Read value as string
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
We must send the packet without queueing it. The pkt has already
been queued for sending, once by net_if and second time in the ARP
queue. We must not queue it twice in net_if so that the statistics
of the pkt are not counted twice and the packet filter callbacks
are only called once.
Fixes#62483
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
It is always possible to bind to same port if the sockets
are in different address family.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Turn the nested arrays of `scan_params->chan` into a single array.
This adds the requirement to specify the band for each channel, but
eliminates the large amount of dead memory for unused bands. Overall,
this saves 50% of the RAM space for this variable.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Make the maximum number of channels that can be manually scanned
configurable by the application. The previous value of 233 was vastly
overallocating memory as the largest band only contains 60 allocated
channels.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
A few attributes isn't cloned togerder with pkt.
This commit add missing part.
Additionally, because the `eof` flag in net_pkt structure is
avilable unconditionally hence `#if defined(CONFIG_NET_SOCKETS)`
guard has been removed form setter and getter functions for
this flag.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
In net_pkt structure couple of flags are no longer used.
Flag pkt_queued can be removed permanently togeter with setter
and getter functions.
Second flag sent_or_eof has been renamed because it is still
used partially only for indicating EOF. Additionally unused setter
and getter for 'sent_' part of this flag are removed.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
In spec:
The LwM2M Client MUST reject any LwM2M Server operation on
the Security Object (ID: 0) with an "4.01 Unauthorized" response
code.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
With bootstrap one function is unused. Fix by changing
ifdef to if (IS_ENABLED()) so linker can drop it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The header file contains mixture of functions and static arrays.
Replacing static arrays to functions.
Initialize functions in C file.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Remove the wifi_mgmt interface overriding default values with values
from kconfig. The defaults were only applied when a `params` struct was
provided by the application.
This is the case when the application is explicitly setting the options
it wants, why is the mgmt API changing these. When `params` is NULL and
thus modem defaults are requested, these defaults aren't applied. This
is the opposite behaviour from what seems reasonable.
In addition, these options are:
* Undocumented
* Using non-trivial string parsing functions (strtok)
* Adding complexity to the API implementation by forcing support for
ROM versions of command line arguments.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commits adds support for the SO_REUSEPORT socket option.
The implementation follows the behavior of BSD and tries to also follow
the specific additional features of linux with the following
limitations:
* SO_REUSEADDR and SO_REUSEPORT are not "the same" for client sockets,
as we do not have a trivial way so identify a socket as "client"
during binding. To get the Linux behavior, one has to use SO_REUSEPORT
with Zephyr
* No prevention of "port hijacking"
* No support for the load balancing stuff for incoming
packets/connections
There is also a new Kconfig option to control this feature, which is
enabled by default if TCP or UDP is enabled.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
This commit adds support for the SO_REUSEADDR option to be enabled for
a socket using setsockopt(). With this option, it is possible to bind
multiple sockets to the same local IP address / port combination, when
one of the IP address is unspecified (ANY_ADDR).
The implementation strictly follows the BSD implementation and tries to
follow the Linux implementation as close as possible. However, there is
one limitation: for client sockets, the Linux implementation of
SO_REUSEADDR behaves exactly like the one for SO_REUSEPORT and enables
multiple sockets to have exactly the same specific IP address / port
combination. This behavior is not possible with this implementation, as
there is no trivial way to identify a socket to be a client socket
during the bind() call. For this behavior, one has to use the
SO_REUSEPORT option in Zephyr.
There is also a new Kconfig to control this feature similar to other
socket options: CONFIG_NET_CONTEXT_REUSEADDR. This option is enabled by
default if TCP or UDP are enabled. However, it can still be disabled
explicitly.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
While matching source address for a given Link-Local destination the
functions iterate over interfaces and return a first result with a
valid LL-address. However, they should first try to fetch address of
the default interface as it not always the first one on the list.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Allow Bootstrap server to close the DTLS connection immediately
after receiving Ack to Bootstrap-Finish command.
This is not an error as either parties are allowed to tear down
the connection.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow certain RD-client states to timeout.
As stated in LwM2M specification:
The bootstrap procedure failed when the LwM2M Client did not
receive the "Bootstrap-Finish" operation after the
EXCHANGE_LIFETIME time period expired.
The EXCHANGE_LIFETIME parameter is defined in RFC 7252
We must handle the case where Bootstrap server is not sending
information towards us.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When publish buffer run out, no thread active process work.
Fix this, by reschedule process work.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Current MQTT-SN topic and publish allocators are not thread safe.
Fix this, by using k_mem_slab instead of arrays.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Releasing the lock before notifying condvar led to a race condition
between a thread calling k_condvar_wait to wait for a condition variable
and another thread signalling for this same condition variable. This
resulted in the waiting thread to stay pending and the handle to it
getting removed from the notifyq, meaning it couldn't get woken up
again.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
When a packet can't be cloned we crash as we try to initialize the
cursor on a nullptr. We should check if we have a valid pointer,
and if we don't we drop the packet along with a warning.
Signed-off-by: Andreas Ålgård <aal@ixys.no>
In low memory conditions, its possible for socketpair memory allocation
to fail and then the socketpair is freed but after that the remote
semaphore is released causing a crash.
Fix this by freeing the socketpair after releasing the semaphore. Add a
test case to induce low memory conditions (low HEAP and high socketpair
buffer size), with the fix issue is not seen.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
All WiFi channel numbers fit within a 8 bit number, as the maximum
allocated channel is 233. This halves the memory requirement.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The errors are printed in hex, but no prefix was used. This could be
confused with usual errno return values. The 0x prefix makes clear
that it's a hex value.
Also a missing minus sign is added to one log message.
Signed-off-by: Martin Jäger <martin@libre.solar>
NET_STATISTICS_PPP are dependend on NET_L2_PPP, not on NET_PPP.
This allows to use statistics also in modem subsys.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
This patch amends the existing L2CAP accept callbacks to use the new
accept signature that includes a pointer to the L2CAP server structure.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
This change brings in support for setting various Wi-Fi modes and
enables a specific Wi-Fi interface to be also placed into a sniffer
operation via monitor mode and promiscuous mode. A raw TX- packet
Injection mode is also introduced
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
This adds support to allow any priority from the user instead of
limiting to the protocol values (0-7). This is useful in conveying
custom priorities from application to the driver/chipset.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This is handy in testing of setting priority directly rather than
deriving from DSCP. Please note ICMP doesn't use net context.
This is applicable for both shell and API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
wifi_utils_parse_scan_ssids could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Also limit the range of the CONFIG_WIFI_SCAN_SSID_FILT_MAX parameter
from 1 to 4 to avoid stack overflow due to users specifying a large
value for this parameter.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
wifi_utils_parse_scan_bands could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add a network configuration option to configure whether IEEE 802.15.4
packets are expected to be ACKed or not.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In the IEEE 802.15.4 area certain settings must be set before
net_if_up() may be called (e.g. the channel).
Also net_if_up() may not be called if
CONFIG_IEEE802154_NET_IF_NO_AUTO_START=y.
This fixes the set-up order and handling of
CONFIG_IEEE802154_NET_IF_NO_AUTO_START.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In case RST packet is received or malformed packet is received, the TCP
should not proceed with the state machine execution (which may process
the invalid packet) but rather jump directly to exit, where the
connection will be closed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The net_mgmt subsystem offers a function which waits (blocks)
until a specified net event occurs. An event callback is
pushed to the stack, then added to the net_mgmt_event_callback
list. If the event occurs, the net_mgmt thread calls the
callback and deletes the callback from the list. However, if
the event does not occur within the timeout specified when
invoking mgmt_event_wait_call() the function will return,
corrupting the callback structure the stack is reused.
This PR fixes the issue by deleting the callback before exiting
in case the event does not occur.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.
The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);
has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);
The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.
All in-tree uses of the function have been adapted.
Fixes#61888.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
If network interface name support is enabled, print the name
when showing network interface data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure we use the network interface name (if configured)
instead of device name when binding to certain network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If CONFIG_NET_INTERFACE_NAME is enabled (default is y), then
system will automatically set a user friendly name to the network
interface like eth0, wlan0 etc.
Application can change the interface name if needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The twt and ps helper functions were not namespaced (were missing
wifi_ prefix).
Also change wifi_get_twt_... to more logical wifi_twt_get...
like the other twt prefixed functions and wifi_get_ps... to
wifi_ps_get... like the other ps prefixed functions.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add TLS_DTLS_CID socket option, which enables to use the Connection ID
extension for the DTLS session.
The option provides control of the use of CID with the `setsockopt()`
function. The value provided can disable, enable, and control whether to
provide a CID to the peer. It uses a random self CID (if told to provide
one to the peer) unless TLS_DTLS_CID_VALUE set previously.
Add TLS_DTLS_CID_VALUE to get or set the CID sent to the peer, if any.
Add TLS_DTLS_PEER_CID_VALUE to get the CID value provided by the peer,
if any.
Add TLS_DTLS_CID_STATUS to determine if CID used, and whether
bidirectional or one way.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
Fix few mismatched CONTAINER_OF, few missing k_work_delayable_from_work
and a missing reference to the array first element.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The connectivity monitoring subfeature of conn_mgr is currently also
named conn_mgr, which is confusing.
This commit renames it to conn_mgr_monitor, or conn_mgr_mon for short,
for clarity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add a helper allowing connectivity implementations to more easily access
connectivity flags on connectivity bindings.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds conn_mgr_binding_lock/conn_mgr_binding_unlock, which connectivity
implementations can call to lock or unlock the passed in connectivity
binding.
This allows connectivity implementations to safely make direct accesses
to binding data from outside conn_mgr_conn_api callbacks, and should
allow cleaner, more robust connectivity implementations to be written.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Splits many definitions from conn_mgr_connectivity.h off into their own
header, conn_mgr_connectivity_impl.h
conn_mgr_connectivity.h now focuses solely on user/application-facing
APIs, and conn_mgr_connectivity_impl now contains all functions, utils,
definitions intended for use by connectivity implementations, including
conn_mgr_if_get_binding, which is now available for use by connectivity
implementations.
This lays the foundation for allowing connectivity implementations
easier and safer access to their internal state through internal APIs.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>