As the native IP stack is now the default, there is no need
for corresponding Kconfig option.
Change-Id: I08e4992f540f928a2b7378e8803e634e38725348
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit removes the legacy Contiki based uIP stack.
The new native IP stack must be used after this commit.
The commit also removes following things:
- legacy cc2520 driver
- legacy ethernet drivers
- legacy IP stack samples
and changes these things:
- disabled tests that only work for legacy IP stack
- select new IP stack by default
- enable random number generator by default as it is needed
by the new IP stack
Change-Id: I1229f9960a4c6654e9ccc6dac14a7efb9394e45d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is to be used in net-shell to view currently
available network connections.
Change-Id: Iadb6555ed6db4e8fb0639e6d0dcf1eccd970acca
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If IP stack offloading is enabled, then call corresponding
L2 driver when corresponding net_context API function is
called. The L2 driver can then do its magic to send/recv
IP packet or do what ever with it.
Change-Id: I26695cee6feb80a41923db0165f22d94477333be
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This code is inspired by a similar feature found in ccan[1],
that enforces that the parameter passed to ARRAY_SIZE() is
always an array and not a generic pointer. This is a slightly modified
version that will work if the macro is expanded outside of a function
body.
The check is performed by comparing if typeof(array) and
typeof(&array[0]) are of a different type. Due to the way arrays
decays to pointers in C, if one passes a pointer, the types won't be
compatible and a compile time assertion will fail.
No bugs have been found with this change, but since there's no runtime
or size overheads, there's no reason to not enable it.
[1] https://github.com/rustyrussell/ccan/blob/master/ccan/array_size/\
array_size.h
Change-Id: I6c321714d0024298e593176be43b2d0b5362cc0d
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This macro does two things: first, it validates that the pointer is not
NULL. Second, it validates if it's between the first and the last
element in the array.
This is useful for cases where a pool of structures are used, such as
in the network subsystem.
Change-Id: I9d815936e31d87a3b3ff80466eea97bc4ad954b5
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
The macro defines the stack as usual, but if user has
enabled net shell (CONFIG_NET_SHELL), then additional
information about the stack is stored in net_shell
linker section. The information in the net_shell linker
section is then used to print information about the
stacks in the networking sub-system.
Change-Id: Ic6e9f16a73a192b9a59d32a6d0070322382f98bd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The original version can fail in ARM like this
***** USAGE FAULT *****
Executing thread ID (thread): 0x200027a8
Faulting instruction address: 0x00008080
Unaligned memory access
Fatal fault in thread 0x200027a8! Aborting.
so use UNALIGNED_PUT() and UNALIGNED_GET() instead.
This failure was seen when IPv6 address was
copied to neighbor cache in ipv6.c:nbr_new().
Change-Id: I638424b9a95c451e13314ca9182c39ab8aa71830
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If CONFIG_INIT_STACKS is not enabled but CONFIG_NET_SHELL is,
then net_analyze_stack_get_values() was not properly compiled
out which caused unknown function call.
Change-Id: I18de5ec0b5d6ab7876e801c83b82c9dd5bf22093
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds the MQTT high-level API with Quality-of-Service
support. The following MQTT messages are covered by this commit:
CONNECT (tx), DISCONNECT (tx), PUBACK (tx, rx), PUBCOMP (tx, rx),
PUBREC (tx, rx), PUBREL (tx, rx), PUBLISH (tx), PINGREQ (tx),
SUBSCRIBE (tx), UNSUBSCRIBE (tx), CONNACK (rx), PINGRESP (rx),
SUBACK (rx) and UNSUBACK (rx).
Where 'tx' stands for transmission: routines that create and send
messages. 'rx' stands for reception: routines that receive an RX
buffer from the IP stack and parse the MQTT mesage contained in
that buffer.
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ibee701a298127eb713aa3fde5aaf7d089ecd1b9d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
Updating the API documentation to use K_NO_WAIT instead of 0.
Change-Id: I10ba31fe116210443f383b343993c3cca830a7c2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Dropping legacy API. This commit also contains updated
unit tests in order to pass the test.
Change-Id: Ibc7426837e2f4f23bb5f3ed3719635c5c3d0ed0f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Origin: Original
Based on "IEEE Std 802.3-2008, Section 2" Chapter 22.2.4
Change-Id: I08516dd1c2f74c1324d00d665f221e01af25d7f1
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Replace NANOKERNEL by POST_KERNEL in the net stack.
Change-Id: Iaad7cdbe849741bc1cf18b0ccf7264417a9495d6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The functions that return the start of the UDP and TCP buffers,
did not take the IP extension header length into account.
Change-Id: Ie3e2fbc49365de9176a788b54ab628e6ef37f5ee
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
More logical place for net_ipv4_broadcast_address() is in ipv4.c
instead of net_if.c.
Change-Id: I069f5030963bcb809df34e874054e2b7826ff868
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
More logical place for net_ipv6_unspecified_address() is in ipv6.c
instead of net_if.c. Removing the net_if_ipv6_unspecified_addr()
variant as it is no longer needed.
Change-Id: Ib5b4f6748030a8bf50fb848a87eef2968e2bcbc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add function that returns IPv4 any address (all bits are zero).
Change-Id: I8816f7f264ad3a98fced7089f0b94220603c2291
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of appending the LQI into the buffer, which is an awkward usage.
Change-Id: I2f604cd61ef3b309cdfe304dac0ab1e7a2ca3f6a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
If net_send_data() returns 0, then the buffer was sent ok
and the sending device driver has already freed the buffer.
If net_send_data() returns <0, then the buffer sending failed
and the caller can either try to fix the issue and re-send the
buffer, or the caller can unref the buffer. Normally caller
should unref the buffer in this case as there is not much that
can be done here.
Change-Id: I39d7b22bbb78a9c16fd037f3a066797e455c31fd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The pos and len variables were in incorrect order.
The pos is first before the len variable.
Change-Id: I0b078ce2f08923c1673bd918fc03adb2ff09691a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds support for the MQTT protocol v3.1.1.
Specifically, this commit allows a Zephyr application to create
the following MQTT messages:
CONNACK, CONNECT, PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP, UNSUBACK,
SUBSCRIBE, SUBACK, UNSUBSCRIBE, PINGREQ, PINGRESP, and DISCONNECT.
Furthermore, the following messages can be parsed by the routines
provided by this commit:
CONNACK, CONNECT, PUBLISH, PUBACK, PUBREC, PUBREL, PUBCOMP, UNSUBACK,
SUBSCRIBE, SUBACK, PINGREQ, PINGRESP and DISCONNECT.
NOTE: client behavior (routines with network access) and QoS will be
integrated in future patches.
The MQTT v3.1.1 specification can be found at:
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html
Origin: Original
Jira: ZEP-365
Jira: ZEP-591
Jira: ZEP-856
Change-Id: Ie0c179370cea22f7554564692bc426a8d5c419d2
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This is needed by net-shell module.
Change-Id: Ic93f806a5882592ff1769b4a14b6ed524ba14912
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Separate the calculation of stack utilization variables and
printing the values from each other so that it is possible
to use separate printing function to print the values.
Change-Id: I3a5827c08edea5017e2a4bc1c5be2fe419cdfcb8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This function converts a string into an IP address.
Change-Id: If57983a345fe4c18df01e58dbce7d9a50a27b82a
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
This creates a `struct net_conn_handle` that's only used as an opaque
pointer. The purpose is to avoid assigning a void* to a void** in
connection registering/unregistering functions, avoiding a
previously-caught bug by issuing an incompatible pointer types warning:
warning: passing argument 7 of 'net_tcp_register' from
incompatible pointer type [-Wincompatible-pointer-types]
Suggested by Andy Ross in 5beec6. This particular commit didn't catch
any bugs, but the one caught in 5beec6 wouldn't exist if this were in
place at the time.
Change-Id: I5c13fb4c5826adce6397feb7b400d36e426c4a87
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
The allocated space for IPv6 string was too short by 10 chars
which meant that full IPv6 address was not printed correctly.
Change-Id: I9c7f3f118f486f88e769aaadf09d100a1d4fd6bc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Utility function that can add option bits to IPv6 option bitmap.
Change-Id: Ia10d27c201556fb960a736590788b791a7e3c018
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
RPL implementation taken from net/ip/contiki/rpl and
ported to use the new stack.
Origin: Contiki
Change-Id: I479d9dd143b763f90cb7915806fd7e9faea0300c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add utilities to return network interface link local and
global IPv6 addresses.
Change-Id: I54d0ec28410b9ad4ad7068a887bfa6706453159c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Go through the router list and return the default router
where to send the network packet.
Change-Id: I87e5118b03352b7d11e1fde800d1530e5929ebab
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Helper checks if the IPv6 address belongs to one of the subnets
defined for network interfaces.
Change-Id: I0e88ebe5014a514404b589e32cc71590950a39c7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The other part of the stack can register a handler that is
called after the network packet has been sent. This callback
is used by RPL routing code.
Change-Id: I6b76c5f01d1f6706b0c0a56980ad50e1b85fc427
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is meant if only one needs reliability when sending non-TCP packets
(as TCP would make is redundant).
Change-Id: I7dc605094b422a750424c3498d18f32d809d23a8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
For future purpose, let's not occupy a full byte for a unique boolean.
Change-Id: I36f2824cca4806eb90640a71ed3cea37a353b276
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Including net_if.h can makes things looping, as this one will include
net_l2.h, which one might include a technology that will in turn include
net_mgmt.h again.
Change-Id: I514720875937414167f0396edb9147ed29dd6d69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>