Do not shortcut the sending side for TCP as we need to use
net_tcp_send_data() to send TCP data in order not to have
double unref in Bluetooth or IEEE 802.15.4 technologies which
has a special TCP packet sending logic.
Change-Id: I077db336c6335ccdbbafa4600f98388ecf33955f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When sending TCP data using 802.15.4 or Bluetooth technologies,
the 6lo code modified the original IPv6 header. This caused
issue when acknowledgment was waited to the sent packet as
the code could never match the sequence and ack numbers in
TCP header.
This commit changes this and the packet is cloned when sending
it so the 6lo code will modify a copy of the data and will not
touch the original packet.
JIRA: ZEP-1719
Change-Id: Iae51f35d5b5ada0d2543b58a29abbf10f146777e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Enhance the connection debugging and print the UDP and TCP
checksum when the packet is received.
Change-Id: I1ccf58a299178277fab0667b01d54ad7bac38663
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If there is lot of network traffic, it is possible that all the
network packets are allocated by network driver. The device driver
places the received packets into RX queue. Then that queue is read
by 6lo code. During the uncompression, the 6lo code tries allocate
net_buf in order to place proper IPv6 header into it.
If all the data fragments are in use at this point, then 6lo cannot
continue and it blocks while waiting available net_buf. This leads
to deadlock in the stack.
The solution is to change the 6lo to allocate the net_buf using a
timeout which will cause the received packet to be dropped if it
cannot be uncompressed because of out-of-buf situation.
Change-Id: I137f02b05193e16c45da8804974d357c920c861d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When doing 6lo compression or 802.15.4 fragmentation,
use the API that uses dedicated net_buf pool if that
support is enabled by the user.
Change-Id: Ic6651c393832c759eebb66a41db31c9067ebb4a9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The function copies the net_buf user data (struct net_nbuf).
Change-Id: I2ea42823d58aea77ea7b710f6ce5fd5d1e3641b4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It makes no sense to modify the original net_buf so change the
copy function not to touch the original buffer.
Change-Id: I5d22445ce50cee62994c36567f0e995a500cb89d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The first parameter of net_nbuf_copy() must be the head
of the buffer chain i.e., it must contain the user_data
part. If a fragment is given, then we do not know enough
information to allocate the data fragments.
Change-Id: I052b183d8c63d7326b320254f36f00b2fc48b0a0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Print information about various network buffer pools in the
system. This is useful in debugging the buffer allocations.
Change-Id: I31123c6f1f6647f77503f32e268c174330762128
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is used to show the name of the pool during debugging.
Change-Id: I3a3c3c853e5fe13fd11f6ffd9e1feea4abf0c248
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use context specific net_buf pool in echo-server and echo-client.
This will prevent application from allocating all available network
buffers in the system and thus preventing the core IP stack
functionality.
Change-Id: I3dbc64dd81c8a1165241426287a3530d00cbc7bf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can configure its own pools for data that needs to
be transmitted out (TX). This helps to avoid deadlocking
the system if user space application uses all the buffers
in the system, and the core IP stack tries to get buffer
that needs to be sent out.
By default the net_buf pool support in net_context is turned
off as application developer needs to create the pools and
tie them to desired contexts.
Change-Id: Ida4a1771d34d6c250974e56fba4f0e0b2592cb29
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the pool contains now more accounting information, there is
no need to keep track of this data in nbuf.c.
Change-Id: I7fd44f9feda8fd9816356556d1e788ad56e6eedd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adding this information to the pool:
* number of available (free) buffers in pool
* total size of the pool in bytes
This can be used when debugging net_buf pool allocations.
Change-Id: I4212fcddb1affdf53e0827c88473d3380e2a4929
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Provide a configuration option for promiscuous mode.
Promiscuous mode provides a convenient workaround for ZEP-1673 however
it generates significant demand for RX buffers on a loaded network.
Add a configuration option to conveniently enable / disable.
The Kconfig defaults promiscuous on to workaroudn 1673, once that
issue is resolved the default logic on NET_IPV6 will be dropped.
Change-Id: I6929aca70d7bd88ce88c65d6654d664ea6653b66
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Rewrite the dhcpv4_t1_timeout() handler to explicitly handle all
states.
Change-Id: I6f9d6c8cfacd945e24eb66c6440bf305d528c521
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The iface handle checks in the both timeout handlers are unnecessary.
Drop them.
Change-Id: Ie7c884b2ea648f700fbefa8382341036a4db063f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Correct the logic that determines when CIADDR is set and when it is
left as all zeros. RFC2131 requires that CIADDR is only set when the
client is in specific states.
Change-Id: I93a45e355fbef8d11dba5ac194570b87c594656e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
RFC2131 places explict requirements on a client w.r.t which messages
are broadcast and which are unicast directly to a server. Notable
rules as they apply to the current dhcpv4 implementation are that
DISCOVER and a REQUEST in response to an OFFER are broadcast. A
REQUEST in state RENEWAL is unicast. There are further rules relevant
to the REBINDING state which is not yet implementated.
Adjust the current implementation that always uses broadcast to use
unicast as required by RFC2131
Change-Id: I6edef4241bcd74623a804a73415888cd679888d0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
RFC2131 requries that a client MUST NOT include server identifier in
DHCPREQUEST from state RENEWING.
Change-Id: I0fba703f3a3b218af1ac03f4f1f0daa290bd428f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The DHCPv4 client obtains resources from the server on a lease. Once
a lease expires those resources must be relinquished.
Update the DHCPv4 client to explicitly remove leased resources from
the network stack once a lease has expired.
Change-Id: I5d3b7a02e463041cfdee1d104f5962498bdd6a30
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The existing dhcpv4 initialization code places all initialization in
the per iface dhcpv4_start() code. The net_udp_register() setup needs
to happen once for the dhcpv4 instance rather than once per iface.
Subsequent patches in this series also need a place to perform one
time initialization, independent of iface.
Factor the one time setup code out of the existing net_dhcpv4_start()
into a dhcpv4_init() function. Rather than use SYS_INIT() to run
dhcpv_init() we hook directly into net_init().
The prototype of dhcpv4_init() is shared within the net subsystem with
a new private header file deliberately to avoid exposing the function
via the public API in include/net/dhcpv4.h
Change-Id: I3502a53cc3bfe4db4e4cd22c02ae133c266fdf10
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Factor out common code associated with entering the REQUESTING state.
Change-Id: I0fc038a49309625c24b874dfda0355794cd41da9
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Factor out common code associated with entering the SELECTING state.
Change-Id: If34929e5f13dff7650388a2b491a01cbbf5dc100
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Refactor send_discover() to provide a clean separation between state
machine and action.
Change-Id: I96510cc6a7ab16216821fe65ea4289a78f6443aa
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Refactor send_request() to provide a clean separation between state
machine and action.
Change-Id: If4c61c5789c919ab3ce6c1f914afc243176760d8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Split handle_reply into distinct state machine and actions.
Change-Id: Ib177c7a4007662f941f156acfa5791e1d27e3d73
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The dhcpv4 state machine implementation names differ from the names
used by the relevant rfc. There is no good reason for them to be
different, so rename them.
Change-Id: I837f1bc4788c0ed4d2949b12eb6f5bfeef9a0be8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
There are two implementations of dhcpv4 state name numbers to human
readable strings, unify the two.
Change-Id: I1d654918bb919108a0d8c5514b309b193c9c3f96
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
The dhcpv4 state machine has a dedicated context within each net_if
structure. For reasons unknown the timers used by the dhcpv4 state
machine have been placed in net_if outside of the dhcpv4 context area.
Relocate them into the dhcpv4 context.
Change-Id: I0531f493610dffda9ca9208993597a5665bde997
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Change the message type representation from integer to enum, this will
help prevent re-occurrence of recent issues where states and events
are interchanged by making it more likely the compiler will see a type
mismatch.
Change-Id: Ia235afda428a9e5dfbd933e02beeae468b4c84a2
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Refactor and simplify packet construction. This resulting code is
simplier, easier to read and compiles a lot smaller.
Change-Id: I43c67d79fbb77f85af54355eca41f516054cbba3
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
This function is used only within net_context.c, make the symbol static
then.
Change-Id: Ib2c00a21c25e8c6a1404d6345d4b8ae05b779525
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
'query->value' is a 'const uint8_t *' so it should be casted to a
char (signed) array before it is used in places where a 'char *'
is expected, strncmp() is an example.
Jira: ZEP-1810
Change-Id: I94cf780a40ad5fed29607d2302dc7a10387bb86f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Since we try to match with POSIX behavior as much as possible, let's
not bother the user unless they need to be bothered. The recv(2) POSIX
syscall won't return 0 on stream sockets unless the connection has been
closed by the peer; however, that was happening with the callback set
by net_context_recv().
Change it so that the callback is never called if operating on a stream
socket and appdatalen is set to 0.
This is similar to a previous patch sent by Michael Scott in [1], but
not relying on the actual TCP flags: only on the appdatalen and the
socket type.
[1] https://gerrit.zephyrproject.org/r/#/c/9949/
Jira: ZEP-1632
Change-Id: Ib0c214fc9269d305a03e8d85eb606f106c45b038
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Using a more efficent entropy call and proper output data
Change-Id: I2ce71f63b6f22e5ceda79babd2eac802fa4bdf53
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
In Atmel SAM Family of MCUs, the watchdog is enabled by default at boot.
The watchdog once disabled, cannot be re-enabled back without a reset.
Hence disabling the Watchdog needs to be handled via the Watchdog driver.
Tested on Atmel SAMV71 Xplained Ultra Evaluation Kit.
Jira: ZEP-1684
Change-Id: I5682c3f007a846b064b8d16abf0d9b67d4c8e7d6
Signed-off-by: Souvik K Chakravarty <souvik.k.chakravarty@intel.com>
Basic Watchdog driver for Atmel SAM family MCUs. Currently only
disabling the watchdog is supported.
Tested on Atmel SAMV71 Xplained Ultra Evaluation Kit.
Origin: Original
Jira: ZEP-1684
Change-Id: I8f717c7f53aa290c944b7935e0570c2a6f53956e
Signed-off-by: Souvik K Chakravarty <souvik.k.chakravarty@intel.com>
This reverts commit 370571b563 which
breaks the build in weird ways since we end up some times include
Makefile bits multiple times and getting unexpected behavior. Its also
not clear if this actually fixes the issue with make qemugdb target work
again.
Change-Id: I1a04881daabc0a37651906a42b1bf1fb27f9411f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
From the response of read_local_supported_feaatures check if local
device supports eSCO packet type and update it to bt_dev.
Also added sco field in bt_dev
Change-Id: If85b3d24d327a6243318fad89a07375a8253f89b
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
This patch includes handling AG network error i.e +CME ERROR and
report the error number.
Change-Id: I19a3158e44568ad0ad21fb0dd790ac2f554c0625
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>