Refactor recvfrom code for handling SOCK_DGRAM into zsock_recv_dgram
to align with SOCK_STREAM. Add flags parameter, will be used later.
Signed-off-by: Stig Bjørlykke <stig.bjorlykke@nordicsemi.no>
After porting the rand driver to drivers/entropy, replace the usage of
the old, Buetooth-specific driver with the generic entropy one.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In order to avoid confusion between "Unicode", UTF8, UTF16, UTF32,
and endianess of these encodings, rename all instances of "Unicode"
in the USB subsystem and samples into "UTF16LE".
Signed-off-by: Iván Sánchez Ortega <ivan@sanchezortega.es>
Make it possible to change USB manufacturer, product and
serial number strings by forcing prompt in the kconfig files.
Signed-off-by: Iván Sánchez Ortega <ivan@sanchezortega.es>
With the introduce of VFS the typedef for fs_file_t & fs_dir_t don't
exist anymore so we need to use 'struct fs_dir_t' or 'struct fs_file_t'.
Fix up some places that got missed in the VFS conversion.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit fixes incorrect Ethernet frame check sequence and ICMPv6
checksum caused by MTU set to zero in RA
Fixes#6342
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
Add support for Virtual File system Switch (VFS) by
introducing mount point concept to Zephyr. This allows
the applications to mount multiple file systems at
different mount points (ex: "/fatfs" and "/nffs"). The
mount point structure contains all the necessary info
required to instantiate, mount and operate on file system.
Decouple applications from directly accessing individual
file systems API's or internal functions by introducing
file system registration mechanism in VFS.
Move the file system defination and mount responsibility
to application so that application can decide which file system
to use and where to mount.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
It was possible to have enable flash module while no flash driver
implementation was enabled. This cause coverity issues and unnecessary
initialization call.
This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is
selected once any flash driver is enabled. flash_map switch its
dependency to this keyword.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Loop counter was type of signed int while it was compared
to unsigned lvalue in loop condition.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
When using the LE Create Connection Cancel command, the controller is
supposed to return a Command Complete first and then an LE Connection
Complete Event after. Since the Link Layer does not generate an event in
this case emulate the behavior in the HCI layer instead.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When reconnecting the code will attempt to recover the subscriptions
but it was not setting any callback causing the bt_att_req.func to be
NULL.
Fixes#5982
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This check is needed to not send command that is not supported
by controller. LE Set Privacy Mode command was introduced in
Bluetooth 5.0 so that it will fail on older controllers.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
We use ctx->user_data to hold socket flags. As each call to
net_context_recv() and net_context_send() overwrites its previous
value, we explicitly must pass the current ctx value there.
Without this, non-blocking socket was turned into blocking after
e.g. switching from receiving to sending.
Fixes: #6309
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
If accept callback is called with error, don't treat the context
passed to the callback as a new accepted context.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
We pass normal 1-based mask, and mask invert it before logically
AND'ing with the value. This apparently a mix-up between how the
mask was intended to be passed initially and how it was in the end.
This issue actually didn't have an effect, because currently defined
flags have mutually exclusive lifetime (when "eof" flag is set,
"non-blocking" flag value is no longer import). Anyway, that's a
bug and needs fixing.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
net_app_ctx maintains multiple net contexts(net_ctx). But when http
api's wants to reply or send some data, its always choose the first
net_context in the array, which is not correct always.
net_app_get_net_pkt_with_dst() api will select proper context
based on destination address. So with the help of new api in
net_app, http can select proper context and send packets. To
achieve this, desination address is provided in http_recv_cb_t
and http_connect_cb_t callbacks. Also chaged relevant API's to
provide destination address in http message preparation methods.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
We're missing a k_sem_give for contexts_lock in the
CONFIG_NET_OFFLOAD path of net_context_put().
This fixes a network hang which occurs after any http_close()
call when CONFIG_NET_OFFLOAD is enabled.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This fixes intercompatibility issues with controllers supporting
privacy feature.
Core Spec requires to use network privacy mode as a default when
peer device provides its IRK during bonding when LL Privacy is used,
which is the case for Zephyr. We've seen devices including PTS
which exchanges it's IRK but is not aware about network privacy
mode. This results in Zephyr not able do be reconnect to such bonded
devices.
This workaround sets device privacy mode to be able to reconnect
to such devices.
Fixes#4989Fixes#5486
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The Linux Foundation has been assigned a Company Identifier, and with it
a means of identifying Zephyr over the air. Default to the LF Company
Identifier, which can be overridden by silicon vendors.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Logic for sending chunks of data is incompatible with adding
Content-Length: header.
Per https://tools.ietf.org/html/rfc7230#section-3.3.1:
"A sender MUST NOT send a Content-Length header field in any
message that contains a Transfer-Encoding header field."
Going a bit further in my mind: also don't send Transfer-Encoded
chunked data either when the Content-Length header is present.
In general, there will be problems if the http client library
makes payload changes without the user code knowing about it.
This patch removes the use of http_send_chunk() from the new
HTTP client code and instead sends the payload directly to
http_prepare_and_send()
This fixes an issue where every available buffer would be allocated
with repeating payload data because the for loop in http_request()
wasn't ending until we ran out of memory.
NOTE: This patch was previously applied but was lost when
commit d1675bf3e6 ("net: http: Remove the old legacy API")
moved code around.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
In commit 9489fa54cc ("net: http: Fix http_prepare_and_send"),
the logic for when to call http_send_flush() was incorrect. This
is causing a call to http_send_flush() every time
http_prepare_and_send() is called.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
We should not use the user suppied timeout setting in
http_client_send_req() for the connection timeout. In the
previous API the call to tcp_connect() used
CONFIG_HTTP_CLIENT_NETWORK_TIMEOUT as the timeout setting.
Let's do that here too.
This fixes -ETIMEDOUT error generation when using K_NO_WAIT
for http_client_send_req().
NOTE: This patch was previously applied but was lost when
commit d1675bf3e6 ("net: http: Remove the old legacy API")
moved code around.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
In previous version of the HTTP API, commit 8ebaf29927 ("net: http:
dont timeout on HTTP requests w/o body") fixed handling of HTTP
responses without body content.
For the new API, let's add a specific fix for when PUT/POST requests
are responded to with just the status code.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Fixed the controller implementation for the missing advDelay
for connectable directed advertising events used in a low
duty cycle mode.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This fixes a bug in the cdc_ecm Ethernet over USB driver. The ECM
spec (section 3.3.1) says that the end of an Ethernet frame is marked
using the USB short packet mechanisim, where the last packet is less
than the maximum packet size. If the Ethernet frame is a multiple of
the USB maximum packet size then a final zero length packet must be
sent.
Linux however sends a one byte packet (usbnet.c:1393) to work
around hardware issues with zero length packets.
The current Zephyr driver works most of the time except when you send
an Ethernet frame of the right length where the last byte is zero,
such as:
$ ping 192.0.2.1 -s 23 -p 0
Zephyr then drops the last byte, creating a short frame which gets
dropped higher up in the stack.
Signed-off-by: Michael Hope <mlhx@google.com>
This commit fixes the crash of echo server from unsolicited RA with
reachable time set to 2147483648. The crash was in
net_if_ipv6_calc_reachable_time because such large value resulted in
modulus by zero due to integer overflow.
Fixes#6382
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
Use ccache when building OpenThread. When the cache is warm, I was
able to observe that this patch sped up a clean build from 45 seconds
to 33 seconds.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This doesn't appear to be used by anything in Zephyr. Remove it,
as it doesn't perform correct bounds checking.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
If net_icmpv6_get_na_hdr() returns NULL (which is possible with a
specially crafted packet), utility functions net_is_solicited(),
net_is_router(), and net_is_override() will attempt to read invalid
memory.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Assertions should only be used to check invariants. Things that may
change value in runtime are better left to proper checks.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>