- Renaming NET_L2_RAW_CHANNEL to NET_RAW_MODE
- Create a generic IEEE 802.15.4 raw mode for drivers
- Modify the IEEE 802.15.4 drivers so it passes the packet unmodified,
up to code using that mode to apply the necessary changes on the
received net_pkt according to their needs
- Modify wpanusb/wpan_serial relevantly
Fixes#5004
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
In 90b471fe4, there was a change to make k_poll() return EINTR error
if it was cancelled with k_fifo_cancel_wait(). Handle this change, or
otherwise sockets EOF handling was broken.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
If net_context_recv() returns a error, net pkt will not be released. For
example, net_context_recv() returns -EBADF because the TCP connection is
closed by the peer.
Handle the return value instead of using SET_ERRNO().
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Token is missing when we jump to the error and token is not yet setup.
To correct it, we grab the token from the input packet at the beginning
of the handle_request()
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Copy/paste error was checking minimum measurements where it
should have been checking maximum measurements.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Initial values for the min/max measurements were 0 and this caused
issues with sensors maximums that weren't above 0 and minimums that
went below 0. Let's update those to MAX_INT so the first sensor
value update will set those to correct values.
When resetting the measured values, let's use the current sensor
value not 0.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
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.
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().
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Add status error string when sending a error message from
HTTP server to client as described in RFC 2616 ch 6.1.
Previously only error code was sent except for 400 (Bad Request).
This also fixes uninitialized memory access in error message.
Coverity-CID: 178792
Fixes#4782
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
The addrlen of accept() and recvfrom() is a value-result argument. It
should be updated to the actual size of the source address after
calling accept() and recvfrom().
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Update the firmware update_result accordingly by checking return
value of the firmware data write callback registered by application.
Also, set response code according.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Create http library that uses net-app instead of net_context
directly. The old HTTP API is deprecated.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
A regression by commit 9728179757 ("Allow net_context re-connect").
The code did not create IPv4 listener if IPv6 listener was successfully
created.
Fixes#4697
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We should call coap_update_from_block() which will determine the minimum
size of the BLOCK1 SIZE between server/client and update the current
offset and total size(if available) accordingly.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Due to parameters used, net_context_recv() call cannot fail (it just
installs a callback, no I/O performed).
Coverity-CID: 178247
Fixes: #4581
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
If we receive lot of data fragments, then yield after initial
processing so that TLS thread can start to work on these.
If we do not yield here, we pile up data buffers and might run
out of memory more easily.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It might happen in TCP client, that the TCP connection is terminated
in which case net_context is freed. Check this and mark corresponding
net_context inside net_app to NULL. This way there will be no issue
to access already freed net_context.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The client TLS code did not handle server issued close properly.
Now the connection is terminated properly and TLS thread is left up to
wait more requests from the user.
This commits adds new boolean field to net_app context. Because there
are already multiple boolean flags there, convert them all to bitfields
to save space.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the TLS handshake might take long time before connection is ready,
check this before trying to send user data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Print information that we are sending plain data and receiving
encrypted data, the code claimed that we are sending encrypted
data which is not the case here.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If user closes the client connection, then make sure that
user can just call net_app_connect() instead of calling the
client init. The client initializes everything in net_app but
for simple re-connect that is not necessary.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Now that objects and samples have their return values fixed, let's
propagate them back up to the user if there's an error.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Previously, post_write and execute callbacks returned 1 when handled
and 0 for error condition. However, this wasn't detailed enough and
the engine can't propagate any sort of error back to users -- so it
doesn't even check the return values in many cases!
Let's adjust the resource callback functions of all objects and the
lwm2m_client sample to return 0 for success or a valid error code.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Now that we can access resource data in the lwm2m subsys, let's use
the user provided firmware push buffer (5/0/0) to also store the
firmware pull data.
This way the size of the firmware pull buffer is completely up to the
application.
NOTE: This patch adds a 64 byte firmware buffer to the lwm2m_client
sample for this purpose.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
With the change to support multi-fragement buffers in the LwM2M subsys,
the OPAQUE data type was direct write methods were broken.
Let's fix OPAQUE handling by using the newly introduced getter methods
which can use multiple user callbacks (depending on the size of the
user provided buffer). Let's also add public methods for users to set
/ get OPAQUE data in resources for future use with DTLS key data.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
The lwm2m_engine_get_resource() function needs to be made available to
other portions of the lwm2m subsys in order for firmware resource data
to be used in the future.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
During conversion from the ZoAP to CoAP APIs the use for this variable
was removed, but the variable itself was left in place.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
No need for 2 different defines to specify URI lengths in the source
for firmware pull method. Let's combine them.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Each content formatter should have a way of handling opaque data.
For instance TLV data will individually be able to specify a length
but plain text will take up the rest of the packet.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
The existing LwM2M framework expected contiguous buffers and this
was the reason for the 384 byte buffer sizes. This was previously
a limitation of the ZoAP API. The new CoAP API doesn't have this
limitation and the LwM2M library has already been migrated to use
it.
Let's finish the process by replacing any contiguous buffer handling
with the correct net_pkt APIs to parse across multiple fragments.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
application/octet-stream is used to indicate opaque payload format.
Use plain text handler to handle the opaque format.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.
than a system include like
Avoiding the use of system includes in these cases is beneficial
because;
* The source code will be easier to build because there will be fewer
system include paths.
* It is easier for a user to determine where a quote-include header
file is located than where a system include is located.
* You are less likely to encounter aliasing issues if the list of
system include paths is minimized.
Authors:
Anas Nashif
Sebastian Bøe
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Recent commit fb7f6cfa97 ("net: lib: http: Fix invalid pointer
body_start") introduced logic to reset the response body_start pointer
when the response buffer was reused.
This check needs to be fixed so that it doesn't arbitrarily change
body_start when not needed.
The problem with the current check can be demonstrated by not setting
a response callback for request which generates a large response
spanning multiple packets.
In this case body_start is still valid (not reusing the response buffer
because there is no callback set), but it will be changed when the 2nd
packet is received and the "at" marker is located at the head of the
new packet (!= response_buffer).
Signed-off-by: Michael Scott <michael.scott@linaro.org>
When moving to the new CoAP API, I thought we would need to parse
incoming option values longer than 12 characters.
This hasn't proven to be true, so let's remove the auto-selection of
this config. If needed user can set this option later.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Currently, we check the length of an option value in the
coap_packet_append_option() function. This isn't required as
we're appending to a net_pkt and not using struct coap_option
where the limitation is imposed.
Instead, we should check the option value length in
parse_option() where we assign the value to a struct
coap_option.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Inform user if we could not install receive callback after
a connection is created in net-app client.
Coverity-CID: 178246
Fixes#4582
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>