Usually the out-of-memory situation will clear itself eventually,
so if that happens in TCP, then keep the connection running and
let the user to decide what to do next.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we run out of network buffers and cannot send data, and if
we have a blocking socket, then wait until new buffers are
available before returning. As this might lead to deadlock,
wait only max 10 seconds and return ENOMEM if we cannot get
buffers in a reasonable amount of time.
Fixes#28216
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of hardcoded value of 3, use the value from Kconfig file
so that user can tweak the TCP retry count.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use SYS_SLIST_FOR_EACH_CONTAINER_SAFE() macro when searching
the connection list so that we notice if new entries are added
or removed in the list.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of forcing the slist node to be first in the tcp struct,
use the pointer to node when accessing the slist. This way we
can change the ordering of fields in tcp struct.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Re-structures the `bt_conn_recv()` to support more generic appending of
new ACL data. This also handles the possibility of receiving 0-length
ACL_START and ACL_CONT fragments, whilst maintaining existing
error-checking functionality.
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
Fixes issue #26900.
A controller may fragment an L2CAP SDUs in any way it sees fit,
including fragmenting the L2CAP header. Likewise, the receiving
controller may send the fragmented header as ACL data to the host.
The Zephyr host assumed that a `BT_ACL_START` was at least 2 bytes long,
and consequently read the two-byte length field from the buffer without
length checks.
This commit allows the `BT_ACL_START` to be less than two bytes,
updating the `conn->rx_len` onces the `BT_ACL_CONT` with the remaining
part of the length field has been received.
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
Fix Kconfig dependencies for enabling the controller PHY options
for LE 2M Phy and LE Coded Phy. These options should be selectable
without connections enabled when extended advertising has been enabled.
The issue affects out-of-tree controllers that wish to use the
BT_CTLR_PHY_CODED and BT_CTLR_PHY_2M options.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Select the controller feature support for data length and LE 2M PHY
based on the SoC hardware capabilities instead of relying on SoC
family.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
osdp_build_ctx() was returning fixed NULL and the subsequent code did
not check if ctx was NULL due to osdp_build_ctx() failures. Fix both
these issues.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
When attempting to bind a channel if it fails the code will attempt to
cleanup calling bt_iso_cleanup which expects connections of
BT_CONN_TYPE_ISO.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
ISO connection does not initialize its tx_complete_work nor it uses for
anything so calling into tx_notify will likely cause a crash.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Commit 770f232a67 removes an array
termination from the shell_make_argv function. This function was
called from two functions: execute and tab_handle. In the mentioned
commit termination was added only in the execute function.
As a result calling tab_handle function was causing a segmentation
fault. This fix adds array termination to the tab_handle function.
Fixes#28434
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
Change so that the caller of lwm2m_init_message is
responsible for generating a message id and remove message id generation
from lwm2m_init_message. Prevents generating a new id when the caller's
intent is to init a message with id 0.
Fixes#28283
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
message id 0 and token 0 have special semantics in the lwm2m engine,
they are used to request generation of new id, mark them as such.
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
Now that CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE defines a stack size, allow
for it to be configurable from a .conf file just like the rest of the
threads in Bluetooth.
Fixes#27768.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Replaces the current zero length array for provisioner data with
ifdefs, to silence new gcc 10 warnings about array element access.
Fixes#28371.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Coverity spots that null pointer is passing to flash_img_buffered_write.
This patch fixes the problem.
Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
The USB infrastructure currently uses the system work queue for
offloading transfers, CDC-ACM UART transmission/reception, and device
firmware activities. This causes problems when the system work queue
is also used to initiate some activities (such as UART) that normally
complete without requiring an external thread: in that case the USB
infrastructure is prevented from making progress because the system
work queue is blocked waiting for the USB infrastructure to provide
data.
Break the dependency by allowing the USB infrastructure to use a
dedicated work queue which doesn't depend on availability of the
system work queue.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The z length modifier must be applied to avoid build errors when the
format is verified by the compiler on systems where size_t is larger
than int.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Both tx_irq_ena and rx_irq_ena flags shall be updated only
by using UART API. Those flags are used to let the device
start sending or receiving data. Changing those flags without
awareness of the user may lead to errors.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Usage of `pool_wait_sem` was incorrect. The semaphore shall be
dependent on context it was called for. In case of many CDC_ACM
devices one could possibly block others. This fixes an issue by
making semaphore a part of the internal CDC_ACM device structure.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Coverity spots that memory allocated for addr was leaking, but the
code was also leaking the socket file descriptor in the error path.
This patch fixes both problems.
Fixes#28172
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fix the OpenThread initialization to prevent the IPv6 interface to
be enabled when `CONFIG_OPENTHREAD_RAW` is set.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
the adv instance should be delete correctly if advertise fail,
Otherwise the instance will unable to allocate if start the legacy again
Signed-off-by: chao an <anchao@xiaomi.com>
Closes: #28331
Configurable initialization priority is useful when using CDC ACM
serial device, for example.
Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
The unsigned size_t type variables have been checked for having
negative values.
Fixes#28171, Coverity-CID: 214224
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
CP/PD mode selection is the most frequently looked-for/changed key in
Kconfig. Making that as the first entry for ease of use.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
OSDP subsys was doing a `select SERIAL` in its Kconfig. But this has
other unintended side effects. Change this to
`imply SERIAL_SUPPORT_INTERRUPT`.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Shell was accepting CONFIG_SHELL_ARGC_MAX+1 arguments which lead to
memory corruption and fault. Added error message reported when number
of provided arguments exceeds CONFIG_SHELL_ARGC_MAX.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fixes a memory leak when a virtual address subscription is added for a
model that either has this VA already, or the model has no more space
for subscription addresses.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Because the previous commit fixed the destination address check,
we need to handle msghdr (used by sendmsg()) in CAN socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
No need to specifically check CAN sockets here. This also means
that SocketCAN will need to support sendmsg() call too. This will
come in following commit.
Fixes#28229
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add back call to LE Write Suggested Default Data Length
command so that new connections, receiving Data Length
Update procedure before local device can auto initiate, can
respond with the suggested default data length Tx octets
and Tx time.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When controller is built with extended advertising support but without
LL Privacy build fails due to issue with code that sets TxAdd in aux
PDU:
.../ll_sw/ull_adv_aux.c: In function 'ull_adv_aux_hdr_set_clear':
.../ll_sw/ull_adv_aux.c:502:25: error: 'struct ll_adv_set' has no
member named 'own_addr_type'
502 | sec_pdu->tx_addr = adv->own_addr_type & 0x1;
|
We need own_addr_type value if an advertising set with aux but without
AD is created since we cannot get TxAdd value from other PDU.
ull_adv_aux_hdr_set_clear() can now be called with a flag to explicitly
set AdvA field and pass own_addr_type in 'value' parameter. This allows
to set proper TxAdd when creating new advertising set.
On aux updates, we use TxAdd from other PDU:
- if primary PDU has AdvA, we use TxAdd from that PDU
- if previous secundary PDU has AdvA, we use TxAdd from that PDU
In other case we just return an unpsecified error since this should not
happen in any valid scenario.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>