Commit graph

41120 commits

Author SHA1 Message Date
Piotr Mienkowski
93e46cc8d8 net: Definitions for IEEE 802.3, Section 2 MII compatible PHY transceivers
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>
2016-12-02 12:41:05 +02:00
Jukka Rissanen
89a00ada23 net: Replace deprecated kernel init level
Replace NANOKERNEL by POST_KERNEL in the net stack.

Change-Id: Iaad7cdbe849741bc1cf18b0ccf7264417a9495d6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:05 +02:00
Andrei Emeltchenko
f0e819faea wpanusb: Update wpan protocol document
Remove unneeded SET_HW_ADDR_FILT since it is handled by other
commands and add missing opcodes.

Change-Id: I4b6488e6cee742b79c16789e817795138506dc77
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:05 +02:00
Luiz Augusto von Dentz
59dfdf7c72 net: l2: Make NET_DEBUG_L2_BLUETOOTH depend on NET_L2_BLUETOOTH
Change-Id: I6244cb48304562d7430535c7df9fe2206c2c84b3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:41:05 +02:00
Luiz Augusto von Dentz
cfef21d13c net: l2: Enable security for bluetooth driver
IPSP spec states other security level can be used depending on the use
case:

  7.1 Node Security Considerations
  This section describes the security requirements for the Node.
  The Node may use the SM Slave Security Request procedure to request
  an LE Security Mode other than LE Security Mode 1 Level 1 if required
  by the use case.

Change-Id: I24c6676bdb05099a7e222085ee41539994eea77f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:41:05 +02:00
Luiz Augusto von Dentz
f2f96bc6f5 net: l2: Fix warning when building Bluetooth driver
Bluetooth driver requires BLUETOOTH_SMP in order to build properly since
BLUETOOTH_L2CAP_DYNAMIC_CHANNEL depend on it.

Change-Id: I7878c0c26ebf688b2a7321eb37025a9ebde6c6b8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:41:05 +02:00
Tomasz Bursztyka
acc7e6a011 samples: net: Do not set nbuf data size on 802.15.4 samples
It's 127 by default as soon as 802.15.4 l2 is selected.

Change-Id: I6c29d88bb3277a15fe54693027caf320bc3d9fc4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:05 +02:00
Tomasz Bursztyka
9c1d4c934d drivers: ieee802154: cc2520: Priority range is now 1-15
Thus setting a high priority of 2 on the rx fiber, as 0 is invalid.

Change-Id: I44a95f3648ca3fbf2eb699f1fa36963d6f3e5021
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:05 +02:00
Vinicius Costa Gomes
30dec49fd8 iot/zoap: Remove unnecessary cflags
These cflags were only needed when using the old network stack.

Change-Id: I660e397b2648137450c45d4f2edc8ec6ec7ae774
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:05 +02:00
Vinicius Costa Gomes
432c6b9997 samples/net: Add a simple demo for the link-format feature
This demo showcases how to expose resources that are exposed using the
link-format feature.

Change-Id: Iad9421082fae3212cae58e6d6e9b88fa170678b8
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:05 +02:00
Vinicius Costa Gomes
ac152ea884 iot/zoap: Add support for RFC6690 link format
RFC6690[1] defines a lightweight format for listing and querying
resources and their relationships.

The RFC defines an '.well-known/core' resource that will list the
resources and their associated metadata. It also allows resources to
filtered by their attributes.

The implementation uses the fact that resources are organized in an
array: only the resources present in the array after the
"ZOAP_WELL_KNOWN_CORE_RESOURCE" will be considered, this allows a
primitive form of visibility control for the attributes.

[1] https://tools.ietf.org/html/rfc6690

Change-Id: I2bc21ddf45f20e1f749d8ac36d247474fdaa9d64
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:05 +02:00
Vinicius Costa Gomes
ec184107be zoap: Add support for retrieving the underlying net_buf
Add an alternative to zoap_packet_get_payload(), that instead of
returning a byte array, returns the net_buf (with the COAP_MARKER
added, if needed) associated with the packet, positioned so the
application can add more data.

Change-Id: I7c955ef42f5ef8406d77da994d1673e6a69b0b6b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:05 +02:00
Jukka Rissanen
1d86b236af net: nbuf: Fix UDP and TCP start of the packet calculation
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>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
c5f8dc4748 net: ipv4: Move broadcast address getter to ipv4.c
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>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
1b58d970ca net: ipv6: Move unspecified address getter to ipv6.c
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>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
59f4810d0a net: Allow binding to any IP address
The net_context_bind() was checking that the IP address is
specified before allowing the binding. If the user wants
to bind to any address, then this check needs to be relaxed
a bit.

Change-Id: Ic92b1ba616bf096551ee996fb9cdbf2c9d156f60
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
b30bb36216 net: Add util to return IPv4 ANY address
Add function that returns IPv4 any address (all bits are zero).

Change-Id: I8816f7f264ad3a98fced7089f0b94220603c2291
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
68bddda6de net: ieee802154: Create data frame after 6lo processing
6lo compresses and fragments the result. Result is that we might end up
with less fragments than earlier. So it's more logical to create the
15.4 frame _after_ 6lo compression/fragmentation. However, since 6lo
compresses the IPv6 header, it is not possible to use buffer's IPv6
distant address directly. Instead, we copy it locally before 6lo, and
use this copy to generate the 15.4 frames afterwards.

Change-Id: I1c7b1a1702daffd6be4cacd15011c84f0beb4b2f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
7edb182d63 net: Set nbuf user data size according to 802.15.4 MTU
When 802.15.4 L2 is built-in, let's set the nbuf user data size to 127
to avoid current limitation of nbuf not taking care of MTU by itself (so
it would fragment per-nbuf user data size, and not per-MTU).

Change-Id: I14e7b0df5ae24d5c0474d1f111fac59d795ab292
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
23f6eb9953 drivers: ieee802154: Implement get_lqi() relevantly
Change-Id: Idc433b77ea3cb38af648d70ad285429c29e53c08
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
bf33494e49 net: ieee802154: Let's ask LQI through driver API
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>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
67f5ac7260 net: ieee802154: Initiate IPv6 NS when relevant
If the distant link layer address is unknown, let's find it out.

Change-Id: I2c0488bb2a32093d7a3a98b021ad5f6e1b6c0d9a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
aa54086dc6 drivers: ieee802154: Fix some old left-over before multi-frag support
And take the opportunity to reduce the buffer size, as 127 is the 15.4
MTU, it has just engouh space on 128 bytes for the spi cmd plus the
frame.

Change-Id: Ifdeb83f85ab1adcdebc55bd72c38a98f18a86dbc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Tomasz Bursztyka
d604bb98c3 samples: net: Add CC2520 dedicated prj.conf files for echo apps
Change-Id: I264a1577a176d37793a475e9605694d9d988fc69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
7d0cc0d18d net: Update ll reserve in net_context_sendto()
We need to make sure that the link layer size is correctly set
depending on destination address. This is mandatory in IEEE
802.15.4 which has dynamic link layer header size depending on
the IPv6 distant address, which obviously might become
available in net_context_sendto() after the buffer has been
filled in with data.
If we need to adjust the ll header length, we need to copy
the data from the old fragments to the new ones.
This takes into account fact that ll header size might be
bigger or smaller than previous reserve space.

Change-Id: I70edc55d41bee848837dda9b8a76f13985acc281
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:04 +02:00
Flavio Santes
69d9dfb027 net/eth: Fix priority value for the ENC28j60 Ethernet driver
Current value (100) is outside the default values: 0 - 15.

Jira: ZEP-1231

Change-Id: Ib3120b52e6eb3d95b369debd7df541fa2b0dfa6e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:04 +02:00
Jukka Rissanen
1aeea63d17 net: apps: Set the IPv6 source address preferred for echo-client
Forcefully set the IPv6 address in echo-client so that we
can use that address when sending data. Normally this should
not be done like this as the system should autoconfigure itself.

Change-Id: Id24f9aa84b30a3da941bb6b9e4522c7218687e12
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
1547a081ab net: Do not send ICMP error if dst address is multicast one
If we have received IPv6 or IPv4 packet where destination
address is a multicast one, and if there is no connection
listener for that address, then do not send ICMP destination
unreachable port error to peer.

Change-Id: I63ae5c72cf4bb75836a62670754e0b95484a6ed8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
76ddf5dcab net: Add util that checks if the IPv4 address is multicast one
Change-Id: I8c2bfccfbd25c5a034d546b334745bf739b70eae
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
d41325edee net: Clarified the net_send_data() function return value
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>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
75c86a37a3 net: Fix net_nbuf_write() documentation
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>
2016-12-02 12:41:03 +02:00
Flavio Santes
88c160021c iot/mqtt: Add test app for the MQTT packet handling routines
The following routines are evaluated in this test case:

- mqtt_pack_connect
- mqtt_pack_disconnect
- mqtt_pack_publish
- mqtt_pack_subscribe
- mqtt_pack_suback
- mqtt_pack_pingreq
- mqtt_pack_pingresp
- mqtt_pack_puback
- mqtt_pack_pubcomp
- mqtt_pack_pubrec
- mqtt_pack_pubrel
- mqtt_pack_unsuback

- mqtt_unpack_connect
- mqtt_unpack_disconnect
- mqtt_unpack_pingreq
- mqtt_unpack_pingresp
- mqtt_unpack_puback
- mqtt_unpack_pubcomp
- mqtt_unpack_pubrec
- mqtt_unpack_pubrel
- mqtt_unpack_unsuback

Future patches will extend this test case to cover the whole MQTT
packet library.

Origin: Original

Jira: ZEP-870

Change-Id: I4fee403c24d1eb0428fb18b413763e28b6b726d1
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:03 +02:00
Flavio Santes
699083140e iot: Add MQTT v3.1.1 packet handling support for Zephyr
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>
2016-12-02 12:41:03 +02:00
Vinicius Costa Gomes
9d1bc961b2 net: ieee802154: Fix typo
'#defite' -> '#define'

Change-Id: I4c2de0eea37129b86355ee3fbc48e591172999d4
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:41:03 +02:00
Sergio Rodriguez
51c61dcd50 samples/mbedtls_dtlsclient: mbedTLS sample DTLS compile on unified kernel.
Makefile modifications to be able to be compiled with the unified kernel

Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Change-Id: I0fce5d3f6b28df0cff4b7c0b554a787996e8c966
2016-12-02 12:41:03 +02:00
Andrei Emeltchenko
f416f615bd wpan_serial: hexdump and interrupt debug to VERBOSE_DEBUG
Print packet hexdump and interrupt related debug only when
VERBOSE_DEBUG is enabled.

Change-Id: Ieb997e3537a9a2316d1435372948004dd93babab
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:03 +02:00
Andrei Emeltchenko
a239abeb5c wpan_serial: Update README
Update information related to simple web server info.

Change-Id: Ib0155c116a3d53b374a7401eb6e9d1599390dba3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:03 +02:00
Andrei Emeltchenko
c275f0756e wpanusb: Decrease amount of debugs
Print packet hexdump only when VERBOSE_DEBUG is enabled and remove
debug print in empty functions.

Change-Id: Ifd3ae59001233f0237c4b7575bd92607c93e2ea0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
06a408e16c net: apps: Set the IPv6 source address preferred for echo-server
Forcefully set the IPv6 address in echo-server so that we
can use that address when sending data. Normally this should
not be done like this as the system should autoconfigure itself.

Change-Id: I99041539c50f994f5d3ddaabaf5cac8599d82078
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
fd016b84d3 net: Add network utilities shell support
Add a shell module to provide utilities to send ping and
get statistics information from the running system.

Change-Id: I1129a57f35a6794a23d61f57bee972b6267b09fd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:03 +02:00
Jukka Rissanen
f8a8cac3fe net: Add util to send ICMPv6 Echo-Request packet
Add function to send IPv6 ping message to peer.

Change-Id: If7517beefe109f5f35cba82bc175da5a22cdb1d1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:02 +02:00
Jukka Rissanen
7e0b45759f net: Add helper to return network buffer information
This is needed by net-shell module.

Change-Id: Ic93f806a5882592ff1769b4a14b6ed524ba14912
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:02 +02:00
Jukka Rissanen
60ecd5ecd6 net: Network stack analyzer re-factored
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>
2016-12-02 12:41:02 +02:00
Jaakko Hannikainen
f9f0d895ea net: Add net_addr_pton()
This function converts a string into an IP address.

Change-Id: If57983a345fe4c18df01e58dbce7d9a50a27b82a
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka
b52f8f1fa1 tests: net: TCP Context needs to be listening before running accept
Change-Id: I433ddac41afcb055cd45e2e7fc4c26ed8c56e3c2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka
54af319833 net: unified: Remove legacy selected Kconfig options
Those options do not exist anymore on unified kernel.

Change-Id: I8f7f95f8f3e1429cdf7ce82db8a6a14bcfe587ef
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka
64e7dc2caa tests: net: Unified kernel is now default and only one
Adapting all unit tests so:

- main task's prj.mdef is already provided by unified kernel with a
default stack of 2kb.
- unified is the only kernel to be used now, removing unecessary kernel
type make option.
- removing all NANOKERNEL/MICROKERNEL related #ifdefs and so on.

Change-Id: I9b853dbd2aef971d355188cbf7fe2ececaaa80c1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka
9313172f84 drivers: ieee802154: Let's timeout on cc2520 tx
Looks like getting an SFD interruption is not 100% reliable, so let's
just use a semaphore with a timeout on it instead of using
device_sync* routines.

Change-Id: I4e4115c7b939c95d7e75fbb33664d411e0a6e8cc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka
d33c883eaf drivers: ieee802154: Rework RX buffer handling in cc2520
Flushing rxfifo is necessary only on complete failure. It's badly
documented, but cc2520 errata mention that srxflush instruction should
be avoided as much as possible because it generates garbage in rxfifo
and kills incoming rx packet.

Change-Id: I486f7f4179103cf0c86c206821a0a61fec06178a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Leandro Pereira
ad1a9d088d net: tcp: Add better type safety for connection handlers
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>
2016-12-02 12:41:02 +02:00