This extends the thread abort hook to support memory mapped
stack. The calculation to find out to which instance of thread
pools the outgoing thread belongs requires physical address.
So find the physical address via the memory mapped stack for
that.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The "struct sockaddr" should only be used in casts and never
as a standalone variable because it might not have enough
space allocated for all the protocol specific fields.
So refactor the port_in_use() function to reflect that.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
errno values are positive, therefore they should be negated when
assigned as return values for net_dhcpv4_server_start().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
`setsockopt` is enabled by `CONFIG_POSIX_API`, use
`zsock_setsockopt` instead, otherwise there will be a
compilation error if `CONFIG_NET_SOCKETS_SOCKOPT_TLS` is
enabled.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Check if the interface is down before joining IPv4 mDNS multicast
group. This avoids warning later when the network packet cannot be sent.
Fixes#71121
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This API is not widely used and it is actually broken since device
runtime power management is not checking it when suspending and
resuming.
On top of that, this API is very close to pm_device_busy* API,
close enough to consolidate in only one API.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Commit e99b5228a1 changed the default
networking behavior on qemu platforms, as the SLIP_TAP driver no longer
selected Ethernet L2. In results, qemu platforms in default
configuration had no network interface to work with.
Fix this, by restoring select for NET_L2_ETHERNET, but this time in
NET_SLIP_TAP. The difference is that SLIP_TAP is a generic driver
config, which could be enabled on any platform, so not changing the
behavior here, while NET_SLIP_TAP is a config dedicated for qemu only,
so it's reasonable to enable all that's needed to get SLIP to work with
qemu by default.
As there were circular Kconfig dependencies, move the respective qemu
configs outside of NET_RAW_MODE if block (as this caused the circular
dependency with ETH_DRIVER_RAW_MODE). Also, remove dependency to
NET_L2_BT, as it made little sense there, and also caused dependency
problems.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There is no limitations for dwell time. Just add
valid condition for positive value. So , it's better
to remove those constraints.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
The bt_debug_dump_recv_state did not care if the receive
state being dumped to log was active or not, and if it was
not actice, then it may just contain random data.
Added a check to see if it was active.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Running out of connection contexts is most likely due to app
misconfiguration, therefore it's useful to get an explicit information
that context allocation failed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The cap_initiator unicast_stop command will now stop
all streams by default, without supplying the "all" argument.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some part of the descriptions were wrong. Also, the description of
`BT_BUF_ACL_RX_SIZE` was too verbose and no longer needed with the
updated L2CAP documentation.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The buffers for the PBP advertising data as well as the
buffers for the BASE periodic advertising data were
not cleared, so calling the functions multiple times
would simply append the data rather than just setting
the new data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There are devices that will send empty SDUs instead of
empty PDUs, and while that should be harmless, it is nice
to know what is going on, and we may want to deal with
empty SDUs and empty PDUs differently.
This also modifies the state for TS and PSN to only be
applied for valid ISO packets.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
It is a common occurance that a specific type is not
found in the codec configuration, and the main way of
knowing that is by calling the function.
The debug log does not help debug anything (as it does also
return a specific error code), but rather just clutters up
the log if enabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When returning an error code directly to an application
in the API, it should not log as a warning or error.
The lack of PAC records is also reported directly to the
application, and is not an error (in fact it is valid not to have
e.g. sink or source pacs).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add printing of the broadcast ID and whether an existing PA
sync was found in the bap_broadcast_assistant_recv_state_cb
function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bap_broadcast_assistant mod_src command can now take "unknown"
as a value to supply BT_BAP_PA_INTERVAL_UNKNOWN to the scan
delegator.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The documentation for the command
bap_broadcast_assistant broadcast_code
was incorrect and has been fixed.
Additionally, and example of the command has been added
in the shell documentation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When a PA is synced via PAST, the receive state does not
have a PA sync object, and the address and SID must be
used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The audio configuration 5 is defined to have 2 sink channels
per stream and 1 source channel per stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If pa_sync_past returns 0 then that means we are ready to
sync to past, and the BT_BAP_PA_STATE_INFO_REQ state should be set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some toolchains cannot create shared objects for Xtensa, with them we
have to use relocatable objects. Add support for them to llext.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Correct various small edge-case behaviors that have been accidentally
introduced in the http_client.
- http_client_req no longer incorrectly returns -ETIMEDOUT on NULL HTTP
resonse. -ETIMEDOUT is now only returned when the underlying TLS
socket times out.
- http_client_req now returns -ECONRESET upon incomplete (but non-NULL)
HTTP response. The request callback is no longer called in this case
(as with any other error state).
- http_wait_data has been refactored slightly to increase clarity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
If the packet cloning fails (can easily happen when working with
loopback interface and when having low net_buf count), then
print a warning to the user. Error could also be possible but
as the situation might correct itself in this case, the warning
should be enough.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Adds the CAP Commander Change Microphone Mute procedure.
This procedure changes the microphone mute state on one or more
CAP Acceptors.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If we fail to join all nodes or solicit node multicast groups
when the interface is down, then there is no need to print an
error message. The groups are automatically re-joined when the
interface comes up.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
remove unnecessary condition for CONFIG_HAWKBIT_POLL_INTERVAL,
changes poll_sleep to be in seconds,
change type of sleep_time in hawkbit_update_sleep(), so the return
value of hawkbit_time2sec() is interpreted correctly.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
In addition to flushing the dcache, to ensure that the new code is
actually read by the CPU when loading an extension, the icache must
be invalidated as well.
Without this, some tests are failing in hardware because the CPU is
executing stale code from its instruction cache.
Fixes#70906 on arduino_giga_r1/stm32h747xx/m7.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Resolved a data race in shell.c by copying the user-provided
prompt-string into a private buffer within the shell, ensuring
proper synchronization with the shell-thread.
Fixes: #64972
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
If user created the capture device using the API and not via
the shell, then the device name was not set. Use the default
capture device in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The event NET_EVENT_CAPTURE_STARTED is generated when the
capture is enabled, and NET_EVENT_CAPTURE_STOPPED when capture
is disabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The net_capture_pkt() does not return information what happened
to the net_pkt because the packet was always cloned. With cooked
capture we can avoid the cloning in which case we need to know
the capture status in order to unref the packet if needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add support for capturing arbitrary data via the cooked mode (sll)
capture API. The actual packet capture is done using net_capture_data()
function, the packet capture infrastructure does not need any changes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to create a kitchen sink pseudo a.k.a any network
interface that one is only able to write to. This might seem
unnecessary, but it is possible to attach virtual network
interfaces on top of this pseudo interface. These virtual
interfaces could then process the data for example for
packet capture purposes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For debugging purposes it would be nice to see the verdict
printed as a string instead of number.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add a recv callback to dummy API. After this it is possible to
receive data by a dummy network interface. This is only useful
if one attaches a virtual interface on top of the dummy one.
One such example is the cooked mode capture interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Change 'Hawkbit' and 'hawkbit' to 'hawkBit' wherever
makes sense, and a bit of touch ups here and there.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit fixes an issue where due to inverted logic (static function
returned 0 on success but the caller expected true/false) the MLDv2
reports were silently dropped.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Added a check for checking duplication when adding a source in the
broadcast assistant, as per requirement in BAP 6.5.4. It is not
permitted to add a source such that a combination of broadcast_id,
adv_sid and address type would result in same triple of values.
Added a recv_state struct to cache these values when read, and moved
past_avail and srd_ids into this as well.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Deprecate CONFIG_NET_TCP_ACK_TIMEOUT as it is redundant with the
combination of CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT. The total retransmission timeout (i. e.
waiting for ACK) should depend on the individual retransmission timeout
and retry count, having separate config is simply ambiguous and
confusing for users.
Moreover, the config was currently only used during TCP handshake, and
for that purpose we could use the very same timeout that is used for the
FIN timeout. Therefore, repurpose the fin_timeout_ms to be a generic,
maximum timeout at the TCP stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add hostname changed printout to event monitor. As the name
says, it is generated when the hostname of the device changes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Starting with b1d24e425c (net: lwm2m:
device object: optionally store error list in settings), it was no
longer possible to build the code with coverage enabled when the
settings subsystem was disabled.
The build would fail with an error like this:
> subsys/net/lib/lwm2m/lwm2m_obj_device.c:262: undefined reference to
> `settings_name_steq'
This fixes#70923.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Add `gdb_q_packet` function to handle proccessing of query packets. Also
add `gdb_qsupported` function to serve as a single place to process and
respond to `qSupported` packets.
Signed-off-by: Robert Zieba <robertzieba@google.com>
Make the current gdb loop enum public under the name `gdb_loop_state`.
This will allow for extending the current stub with further
functionality in the future as new features will require control over
the loop state.
Signed-off-by: Robert Zieba <robertzieba@google.com>
According to the `RFC8415` the length of the DUID is at least 1 octet
up to 128 octets. Now a user can choose buffer length without the need
for source code modification.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
For BR/EDR L2CAP, if the function bt_l2cap_br_chan_send_cb
instead of bt_l2cap_chan_send is called, the ACL conn and
L2CAP chennel status will not be checked.
Check conn/channel status before sending data in
function bt_l2cap_br_chan_send_cb.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
eth_stats.h is using ethernet api but not including the header,
it must be working by luck in files that include it after
something else that includes ethernet.h, fix by just including it.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Change the receive workque name to "BT RX WQ" to distinguish it from the
receive thread, and the long workque one to "BT LW WQ" to make the
format consistent with the other Bluetooth threads.
On an nRF52 now "kernel stacks" looks like:
0x200016c8 BT RX (real size 448): unused 280 )
0x20001780 BT RX pri (real size 448): unused 224 )
0x200012c0 BT RX WQ (real size 2240): unused 1360 )
0x20001208 BT TX (real size 768): unused 408 )
0x20001130 BT LW WQ (real size 1344): unused 408 )
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change the input callback function name to make it easier to identify
what it belongs to. This clears some ambiguity when observing the symbol
names corresponding to the function pointers in the callback section.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Users should be able to call fs_mkfs() manually even if FS_FATFS_MOUNT_MKFS
is disabled.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Instead of having a single config specifying the memory pool size for
variable-sized net buffers, have a separate one for TX and RX for better
configuration granularity when optimizing memory usage of the
application.
Deprecate the old configuration but use its value as a default (for now)
for the new configs. This will need to change when the config is
deleted.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To wait for the asynchronous suspending work item to complete, a
combination of semaphores and events is used. First, the semaphore is
released, then the events are cleared (through the boolean argument to
k_event_wait), then events are awaited.
However, if the event flag happens to be set by the work handler in the
short time between k_sem_give and k_event_wait, it is then cleared by
k_event_wait and k_event_wait blocks forever waiting for the event.
Make sure that we clear the event flag before releasing the semaphore.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
With CONFIG_BINDESC_BUILD_TIME_ALWAYS_REBUILD a re-run was called for
the entire project.
This can result in issues with the zephyr linker mechanism.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
There should be a particular defines which clarify the
use of that number. So, replacing numbers with defines
in wifi shell.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Outgoing block-transfers now set the socket hint
to ONGOING as long as the BLOCK1/BLOCK2 header has
MORE flag set to true.
This means as only the last packet in the block-transfer
set the socket hint to LAST or ONE_RESPONSE.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Once Wi-Fi is associated few parameters like listen interval and
power-save mode cannot be changed. The state for association is
"ASSOCIATED" and not completed. Even after state transitions to
COMPLETE, it can still go back to other states, e.g., PTK/GTK renewal.
Fix the state check.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
If host is not reading RTT data (because there is no PC connection
or RTT reading application is not running on the host), thread will
stuck continuously trying to write to RTT. All threads with equal or
lower priority are blocked then. Adding detection of that case and
if host is not reading data for configurable period then data is
dropped until host accepts new data.
Similar solution is using in RTT logging backend.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
All implementations of random number generator where duplicating logic
for sys_rand32_get. Since this subsystem already has a logic to
generate random values of arbitrary size, we can generically implement
sys_rand32_get on top of that.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The gPTP is not suppose to be run on top of VLAN and the
earlier support was just for testing purposes. Remove VLAN
support now after the VLAN overhaul.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print also network interface index together with the pointer value
in order to get more useful information what is going on in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print information whether a multicast address is properly
joined to a multicast group when print addresses using
"net iface" command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As the interface type is always Virtual, no need to print it.
Print instead the name of the network interface as it is more
useful to the user.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If an IPv6 address was added to the interface while the
interface was down, its solicited node multicast address
is not joined properly and IPv6 communication will to
other hosts will fail. So make sure to rejoin all the
solicited node multicast groups that were joined already
when the network inteface is going up.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add debug information to print when the network L2 enable
callback is called and fails. Useful to see this information
as at that point the interface goes down.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Start any pending IPv6 DAD timers when interface comes up.
If IPv6 addresses have been added to the network interface when
it was down, the addresses would never work properly if the DAD
is not done.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of printing just a network interface pointer, print
also the interface index so debugging is a bit faster as no
lookup from interface listing is needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
No need to do the checks any more because user has specified
the VLAN count and so many VLAN virtual interface are already
created.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Re-implement the VLAN support inside the network stack.
All the user facing APIs stay as is but internally the VLANs
are implemented using the L2 virtual interfaces.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Simple rename to align the kernel naming scheme. This is being
used throughout the tree, especially in the architecture code.
As this is not a private API internal to kernel, prefix it
appropriately with K_.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some compilers have trouble parsing variables directly after a case
statement.
Fixes: #70792
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Changing remaining users of fcntl.h to use the include from our own
POSIX file so that the values in there are consistent in all parts
of the sources.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use only Zephyr specific POSIX header files so that the whole
system is getting values from the same files. There was an issue with
native_sim run of tests/net/socket/af_packet which had O_BLOCKING set
to 0x4000 from include/zephyr/posix/fcntl.h, but then the file
subsys/net/lib/socket/sockets.c was having O_BLOCKING set to 0x0800
because different header files were used.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit fixes this error seen in CI so that things
work even if CONFIG_POSIX_API is enabled.
subsys/shell/backends/shell_mqtt.c:727:12: error:
conflicting types for 'write'; have
'int(const struct shell_transport *, const void *, size_t, size_t *)'
727 | static int write(const struct shell_transport *transport,
const void *data, size_t length)
include/zephyr/posix/unistd.h:230:9: note: previous declaration
of 'write' with type
'ssize_t(int, const void *, size_t)'
230 | ssize_t write(int file, const void *buffer, size_t count);
subsys/shell/backends/shell_mqtt.c:787:12: error:
conflicting types for 'read'; have
'int(const struct shell_transport *, void *, size_t, size_t *)'
787 | static int read(const struct shell_transport *transport,
void *data, size_t length, size_t *cnt)
include/zephyr/posix/unistd.h:231:9: note: previous declaration
of 'read' with type
'ssize_t(int, void *, size_t)'
231 | ssize_t read(int file, void *buffer, size_t count);
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Currently the socks library does not use sockets so there
is no need to select socket symbols.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API inside the
network stack.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Have special wrappers for zsock_fcntl and zsock_ioctl functions
so that gcc warning can be avoided.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The CONFIG_NET_SOCKETS_POSIX_NAMES option is marked as deprecated in
favor of using normal POSIX socket API includes found under the
include/zephyr/posix directory. If you want to use BSD socket API calls,
you need to select POSIX_API and use the socket headers found in the
POSIX subsystem. If you do not want to or cannot enable POSIX_API,
then you must use zsock_ prefix when working with BSD socket calls.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Added a check for duplication of add source operation in the Scan
Delagator. BAP 6.5.4 states that an assistant may not perform add
source operation if it results in a duplication of a source. While
this is not mentioned for the Scan Delegator, the spirit of the spec.
must be that no duplications can exists in the recv_state, which is
what this commit fixes.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
By using `getopt_state` to access `optarg`, offering a better alternative
to direct global `optarg` access.
This approach mitigates the risks associated with concurrent access to
the global variable.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This change marks each instance of the `struct option` as `static const`.
The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit simplifies the access to structure members and omits
unnecessary variable initializations.
Specific adjustments include:
- Moving from pointer-based access (`(®d)->chan_info`) to
direct structure member access (`regd.chan_info`).
- Removing explicit initializations where not required.
- Removing excess backslashes '\' before '%' in the format string.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
When setting a name to a network interface, verify that no other
interface has the same name as that would make very difficult to
select an interface by a name.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The current implementation can raise a warning as the compiler sees
an attempt to index an array with a size of zero. This can be fixed by
giving `gdb_mem_num_regions` a default value of zero, but this gets
flagged by CI checks. Disable the warning around the array access.
Signed-off-by: Robert Zieba <robertzieba@google.com>
commit 67bb6db3f8 ("syscall: Export all emitted syscalls, enabling
them for extensions") exports all emitted syscalls, however, it does
that only for the `z_mrsh` symbols, effectively only available for
userspace. If an extension running at kernel level tries to use a
syscall, it will fail to load.
This patch fixes that by exposing the `z_impl` symbols instead. However,
this is not as straightforward as the `z_mrsh` ones. As, in their
signatures, they can basically contain any type, it's not just a matter
of emitting `EXPORT_SYMBOL(z_impl_<syscall>)`, as the compiler will
complain about the undefined types. Here, there are a few approaches.
One of them is to have the `EXPORT_SYMBOL` being generated on the same
files where the syscall is implemented - injecting it there would allow
it to access all known symbols. But changing a lot of files is
undesirable, and it was one of the nice points of first patch.
Another one would be to reconstruct - or simply use the absolute path -
for the includes where the syscalls are defined. Reconstruct the paths
seems fragile and I'm not sure using absolute paths is portable.
Finally, the approach used in this patch is to declare, on a different
generated file, all `z_impl_` symbols as `void *` - after all, only the
address (and the name) to the function is relevant to EXPORT_SYMBOL. By
living in an compilation unit that doesn't include any header which
would expose any of the syscalls, there shouldn't be any conflicts. And
to account for the possibility that a syscall is not compiled - due
being configured out via Kconfig - all those symbols are also weak
aliases to a pointer to NULL. This file is then included in
`llext_export.c` (which should naturally not include any conflicting
header).
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
For zero sized buffers, instead of pointing to a buffer, net_buf->__buf
is NULL. For this reason, when cloning a buffer, the code needs to check
__buf before dereferencing it.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
When z_test_1cpu_start() is called to ensure that only a single CPU
on an SMP system is available for use in a test, this commit will
ensure that that CPU is the primary CPU--CPU0. This is done because
some timer drivers only have the timer interrupt processed by one CPU.
A bit of a song and dance is performed to achieve this without enabling
the CPU mask/affinity pinning API. If the cpuhold thread is found to
be executing on CPU0, then a new copy of cpuhold thread is created. Once
the new copy is executing (incidentally guaranteed to be on another CPU)
then it informs the original copy and busy waits until it the original
copy is switched out of CPU0. At this point, we can create the next
cpuhold thread to occupy another CPU if needed.
During this song and dance, it is critical that the 'copy' not pend. If
it pends, we can not guarantee which CPU it will execute on when it
unpends. As the cpuhold threads have the highest priority, nothing is
going to cause them to execute on another CPU for as long as they do
not pend.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit removes `bt_hci_evt_get_flags`, and the associated flag
symbols. These symbols no longer serve a purpose in the driver interface
after the removal of `bt_recv_prio` from the interface.
The implementation of `bt_hci_evt_get_flags` is distributed to its
still-existing use sites, `hci_core` and the `hci_driver` in the
controller.
The duplication of code is intentional. This is no longer part of any
interface, and the host-developers expect the host copy of the function
to change or dissapear entierly. This will allow the host implementation
to progress without fear of breaking the controller implementation.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Remove `bt_recv_prio` from the HCI driver interface. It's primary
purpose was to be used in conjunction with `CONFIG_BT_RECV_BLOCKING`,
which has been removed.
`hci_raw.c` provided a adapter implementation to make drivers
implementing the `CONFIG_BT_RECV_BLOCKING` interface useable with
`CONFIG_BT_HCI_RAW`. But since `bt_recv_prio` is being removed from the
HCI driver interface, drivers needing the adapter should copy the
adapter implementation as private internals.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This config selects a variant of the HCI driver interface that spills
out host internals unto the drivers and even the Zephyr controller. It
will now be removed in favor of driver interfaces that hide the
internals of the host.
The new default is `CONFIG_BT_RECV_WORKQ_BT`.
Any references to the removed kconfig are refactored out.
Any out-of-tree driver using the removed interface can be easily adapted
by copying the following implementations into the driver as private
functions:
- `hci_driver.h:BT_HCI_EVT_FLAG_RECV_PRIO`
- `hci_driver.h:BT_HCI_EVT_FLAG_RECV`
- `hci_driver.h:bt_hci_evt_get_flags`
- `hci_raw.c:bt_recv_prio`
In combination these symbols function as a interface adapter. These
symbols will be removed in this PR in subsequent commits.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Return availability of free buffers after data is consumed. This
information may be important for the module using uart_async_rx to
schedule next reception if there is a new buffer available.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
As stated in "[RFC7959], Section 2.5":
"The Block1 Option provides no way for a single endpoint to perform
multiple concurrently proceeding block-wise request payload transfer
(e.g., PUT or POST) operations to the same resource. Starting a new
block-wise sequence of requests to the same resource (before an old
sequence from the same endpoint was finished) simply overwrites the
context the server may still be keeping."
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Check max_tx_octects and max_tx_time are in the valid range, according
to the BT Core spec 5.4 [Vol 4, Part E, 7.8.46]
Fix#70472
Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
A Kconfig item is added and the buffer
is embedded into the modem_cmux struct.
The default value is increased from 16 to 64 bytes in
an effort to reduce the number of modem_pipe_receive() calls.
CONFIG_MODEM_CHAT_LOG_BUFFER is renamed
to CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE for consistency.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add a configurable delay between when a byte is received and
MODEM_PIPE_EVENT_RECEIVE_READY is sent.
This fixes data reception at baud rates above 460800, and
most likely also reduces the workload at any baud rate
when receiving bytes by not going through the work item
and callbacks for every single byte.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
- Set all the state bits before calling uart_rx_enable() because
interrupts may happen already before it returns.
- Fix the byte count in the "Receive buffer overrun" log.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
- Add the frame data length to the frame header log.
- Log the dropped frames as well.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The previous default value made UART TXs of size > 1145
time out at a baud rate of 115200.
It should not be so small that it can cause undesirable timeouts.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
MODEM_UBX: Adds Support for UBX Messages in Modem Subsystem.
GNSS API Supported: get_supported_systems, set_fix_rate, get_fix_rate,
set_enabled_systems, get_enabled_systems, set_navigation_mode,
get_navigation_mode.
Boards Tested: MIMXRT1062_FMURT6, VMU_RT1170.
Note: Partial support for U-BLOX Messages is provided as of now.
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Signed-off-by: Mayank Mahajan <mayankmahajan.x@nxp.com>
Commit prevents updating replay protection list on any frame came
from the network layer.
Replay protection cache is updated only if
- transport handles transport command without errors
- access layer handles model message without errors
- transport frame has correct length
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds analyzing of returned status of element rx.
If at least one element receives multicast message then
access layer will return suceess status.
If option CONFIG_BT_MESH_ACCESS_LAYER_MSG is enabled then
access layer will return success always.
Function bt_mesh_access_recv has been introduced to cover
case when real model statuses should be returned over
oppcode aggregator model despite access returns success.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Refactor the IP tunneling support as the input callback was removed
in previous commit. The data will flow through the recv callback now
as expected.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The input callback was an unfortunate idea which just complicated
how the packet flows through virtual interfaces so removing it.
The data is passed normally through the recv callback from now on.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The function needs to loop through the virtual interfaces
tied to this physical interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Channel is mandatory for AP mode. It is processed only
if its less than or equal to three characters. Otherwise
we need to throw error for channel in AP mode.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
arch_interface.h is for architecture and should not be
under sys/. So move it under include/zephyr/arch/.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add declaration of the _POSIX_C_SOURCE < 200809L for ztest library for
declaration of strtok_r and strdup functions.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
This functionality is useful on the following scenario:
1) The first buffer in a net_pkt contains user data which is relevant
for the (whole) net_pkt.
2) When inserting a new buffer in front of the net_pkt, the (previously)
first buffer (and its user data) are no longer accessible via
net_pkt->buffer.
3) net_buf_user_data_copy() allows to simply copy the user data from the
old to the new first buffer.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
If the network interface does not enable IPv4, then it is pointless
to print DHCPv4 information when invoking "iface" shell command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The final ACK check during passive close was wrong - we should not
compare its SEQ number with the ACK number we've sent last, but rather
compare the ACK number it acknowledges matches our current SEQ number on
the connection. This ensures, that the ACK received is really
acknowledging the FIN packet we've sent from our side, and is not just
some earlier retransmission. Currently the latter could be the case, and
we've closed the connection prematurely. In result, when the real "final
ACK" arrived, the TCP stack replied with RST.
Subsequently, we should increment the SEQ number on the connection after
sending FIN packet, so that we are able to identify final ACK correctly,
just as it's done in active close cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Dwell time Active or Passive is optional in wifi scan.
If user don't set the Dwell time value, it will be set
as 0. We are adding a range check in scan extensions
for dwell time. So need to set default values.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Add an error log if there's a failure when attempting to load
certificates during socket connect.
Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
remove hb_context.status_buffer_size and replace it with
sizeof(hb_context.status_buffer), because hb_context.status_buffer_size
is never set.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Current implementation of mDNS responder does makes it mandatory to have
all the records set at compile time. It is not suited well for applications
that have to publish/unpublish or change records in runtime, e.g. data
received from the network.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Follow-up: fe25709a9c twister: add unit_testing soc and board
Moving the soc.yml and board.yml to subsys/testsuite tree.
Introduce subsys/testsuite/arch/archs.yml with unit_testing arch.
Update the Zephyr CMake module unittest.cmake to include HWMv2 and
reorder includes to follow same order as zephyr_default.cmake.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Enables compatibility of NUS for codebases that are not
Bluetooth-centric (e.g: Non-bluetooth samples that use UART over
Bluetooth LE for Console, Logging, Shell, others).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Enables usage Bluetooth LE GATT as a serial endpoint to exchange data
using UART APIs. This implementation is compatible with UART Interrupt
Driven APIs and uses the nus-uart device-tree node properties to
configure FIFO buffers for transmitting and receiving. Defining
multiple instances of the driver is possible and it allows implementing
multiple GATT NUS service instances to exchange data as separate serial
endpoints.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
NUS is implemented as a Bluetooth LE service, exchanging data treating
the NUS characteristics as Serial endpoints: RX characteristic to
receive, TX characteristic to send binary packets.
This implementation also enables the ability to define multiple
instances of the NUS Service, analogous to mutliple serial endpoints,
to use each one for different purposes. Unless disabled through Kconfig,
NUS instantiates a default instance, similar to what other services do,
which allows users not interested in using multiple instances, to not
worry about the inherent complexities.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Zephyr's DHCPv4 server does not implement persistent storage of address
leases. In result, all leases are lost on reboot, which can cause
delays with clients starting in INIT-REBOOT state and thus sending
(potentially several) Requests before attempting full Discover-Request
procedure.
Add option to override RFC defined behavior, which states that if we
don't recognize the client sending the Request, the server shall remain
silent. Enabling that option allows the server to send NAK reply in case
client is not recognized, informing the client it should proceed with
full procedure.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RFC6842 updated RFC2131 in terms of including client ID option in
responses sent from the server. According to that RFC, the server MUST
include the client ID option in Offer/Ack/Nak replies, if it was
provided by the client.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case ACK from the server was lost, we'd not reply Request
retransmissions, as the lease state is already in allocated state on the
server side. Therefore we also need to allow to reply with ACK in such
case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
5 seconds turned out to be too short timeout in case retransmissions
kicked in at DHCP level, hence increase the timeout.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add message types for line coding and contol line state updates.
Add a publish message function that takes a pointer to a device
structure as payload, and use USB notification in the CDC ACM
implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The implementation uses the system workqueue and a callback provided
and registered by the application. The application callback is called in
the context of the workqueue. Notification messages are stored in a
queue and delivered to the callback in sequence.
We cannot call application callback directly from the USB device stack
thread because the behavior of arbitrary code provided by the
application is unpredictable, and we do not want it to be executed in
the same context where all events from the device controller are
handled.
Nor can we use the ZBUS subsystem directly. ZBUS offloads responsibility
for defined behavior to the observers and application, and does not
provide any way for the publisher to enforce defined behavior and
execution context.
ZBUS listener would be called from the USB thread context and is not
acceptable. ZBUS subscriber does not provide delivery guarantee and
cached message can be overwritten. ZBUS message subscriber has
cumbersome global configuration and buffers that are too complicated to
handle from USB configuration, and even if we would use it, defined
behavior is not possible because of how listener and subscriber are
handled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Debugging IPv6 Neighbor Discovery issues requires to enable full IPv6
logs, which can get bloated given it provides logs for every single
packet. We should be able to focus on IPv6 ND logs only, hence introduce
a separate log module for IPv6 ND.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Recently (during Bluetooth UPF), a lot of developers experience
confusion due to weird errors in SMP, etc, which are actually irrelevant
and caused by the connection never having existed.
As a stop-gap measure, until upper layers properly report lower layer
failures, add a warning in the logs to stop wasting developer time.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Since the cap_common.c rely on CONFIG_BT_MAX_CONN, and is
only used for connected procedures, it should be guarded
by CONFIG_BT_CAP_INITIATOR_UNICAST instead of
CONFIG_BT_CAP_INITIATOR
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increase the timeouts to be 60 instead of 6.
The reason for this is that some controllers (like the Zephyr
controller) will reserve some of these to ensure stability,
and in fact with skip = 5 and retry = 6, it would still
send the PA reports at every interval.
To accomodate a higher timeout value, the functions used to
convert PA intervals to PA timeouts have been updated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added the CONFIG_MCUMGR_TRANSPORT_BT_DYNAMIC_SVC_REGISTRATION Kconfig
option to manage how the SMP service should be registered.
By default the SMP service must be registered at runtime.
If this Kconfig option is disabled, the SMP service is statically
defined and registered.
This change allows to opt out of using the CONFIG_BT_GATT_DYNAMIC_DB
Kconfig option and as a result, lower the memory usage.
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
Linkable loadable extensions can only use syscalls if they are exported
via EXPORT_SYSCALL (or EXPORT_SYMBOL). Instead of enabling used syscalls
one by one, this patch exports all of them automatically via
`gen_syscalls.py`. If CONFIG_LLEXT=n, the section where the exported
symbols live is discarded, so it should be a non-op when llext is not
enabled.
This patch also removes the now redundant EXPORT_SYSCALL macro. Note
that EXPORT_SYMBOL is still useful on different situations (and is
indeed used by the code generated by `gen_syscalls.py`).
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Sets the retries in cmd struct to their Kconfig value. This fixes
an issue in imx_usdhc.c where retries would be used uninitialized. That
leads to a loop not being entered and subsequently no data being read
from the controller.
Tested on mimxrt1170_evk.
Signed-off-by: Jakob Genßler <jakob.genssler@gin.de>
As we are replacing native_posix with native_sim, let's
refer to native_sim instead of native_posix in the comments.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
There is no need to validate stream_param->data if it is NULL.
Fixes failing PTS BAP/BSRC test cases.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
When the policy returns NULL pm_system_suspend was assuming that
the current state in z_cpus_pm_state was ACTIVE, since that is the
state set after the core wakes and return to this function. The
problem is that in cases where the cpu does not preserve the context,
and returns to this function, z_cpus_pm_state has the value of the
last state used and the cpu use it again.
Fix it setting z_cpus_pm_state to ACTIVE every time the policy returns
NULL.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The function inteval_timeout() was missing "r", the function
should be called interval_timeout()
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Tracing with sysview is missing both
sys_port_trace_k_thread_abort_enter()/_exit() which exist on
other tracing backends. So add them.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
As per current definition of the Z_TEST macro, defined in
include/zephyr/ztest_test_new.h, the passed parameter is named
'fixture', not 'this'.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Rename the internal input callback structure to input_callback. This is
for coherency with "INPUT_CALLBACK_DEFINE" and other similar code paths
in Zephyr, and also to avoid confusion with terminology.
This is an internal structure, applications should not have any
references to it so there should be no need for any release note
entries.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Remove SCO security management code block.
Currently, security related checks are not
necessary. It can be added if needed.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Call bt_sco_server_register to register SCO
server. Manage the SCO connection request.
Get SCO connect/disconnect status via SCO
channel ops.
Notify the uppper layer of the SCO connection
status changes through bt_hfp_hf_cb::
sco_connected and bt_hfp_hf_cb::
sco_disconnected.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Currently, SCO connections and disconnections
are agnostic to upper-layer.
Add two functions, bt_sco_connected and
bt_sco_disconnected, to notify the SCO
connect changes.
For Central side, pass "struct bt_sco_chan"
object when calling bt_conn_create_sco. it
uses to manage the SCO channel for upper-
layer.
For Peripheral side, two functions
bt_sco_server_register and
bt_sco_server_unregister are added to monitor
SCO connection request for upper-layer. The
upper-layer could accept or reject SCO connect
When the connection request received. If the
connect is accepted, the "struct bt_sco_chan"
object could be passed by "sco_server->accept".
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The codecs used for the bap bt_bap_stream_config was only
valid for the lifetime of the procedure, which meant
that by the end of the procedure the stream->codec_cfg
became invalid.
This is fixed by using the pointer provided to the
CAP API, and documentating the lifetime of the codec_cfg.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
IGMP queries sent out by a proxy querier can have
a source IP address 0.0.0.0
Allow these incoming packets.
Fixes#69917
Signed-off-by: Savin Weeraratne <savin.weeraratne@audinate.com>
When we receive Router Advertisement with life time,
we will add this as default router, like typing command "net iface"
and has show below
IPv6 default router :
fe80:xxxx::xxxx
When this default router is backend A and
we ping backend B with link local address,
we will use default router A and send echo request
to backend A instead of B, which will receive Redirect and no reply.
Fix it by link local address does not check route.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
When calling `mesh prov beacon-listen on` shell command before
provisioning the local device, the stack won't report unprovisioned
beacons. This is because the scanner has not been started yet. This
behavior confuses users. Print a warning that the device needs to be
provisioned first before it can listen to unprovisioned beacons.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In the simulated bsim boards there is no jittery delay
from a (D)PPI event until a TIMER starts.
The timer starts instantaneously so we do not need to
compensate for it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The building error is reported in Ubuntu if
CONFIG_NET_BUF_LOG is true.
Change __line__ to __LINE__ to fix building
error.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Use the HAL always when setting the TIMERs CC registers,
(also for coded Phy) to ensure things work properly for simulation.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add HCI input parameter validation according to spec for passing
qualification tests.
- Conditional compile of LE Set PA Receive Enable feature
- Store BIGinfo encryption state and number of streams
- Do not report BIGinfo if phy is invalid or unsupported
- Return disallowed ll_read_iso_tx_sync uses sync recever handle
- Validate BIS indices in ll_big_sync_create
Signed-off-by: Morten Priess <mtpr@oticon.com>