Commit graph

42249 commits

Author SHA1 Message Date
Andrei Emeltchenko
7889ebaf5e net: Add L2 RAW channel hidden option
L2 RAW channel allows to use some functions of IP stack for RAW access
of network drivers. It is hidden from user and is selected by 2520 raw
driver.

Change-Id: I91dd09803052072dfddb7989d9d67c3a5840f89e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:46 +02:00
Andrei Emeltchenko
ca2cc81d7a net: Add TI_CC2520 RAW driver
Add TI CC2520 driver allowing RAW access to radio interface similar
way Bluetooth user channel works. This makes possible to handle radio
channel inside external 802.15.4 stacks, for example export it over USB
and handle in Linux.

Change-Id: I61bb4c8b998ff1e47dc65427ac471f04ec8fea63
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka
8b1953f740 tests: net: Add net management event sender/receiver tests
It mimics how event could be thrown through a dedicated thrower (a
fiber). The amount and event it can throw is gived through parameters.

Change-Id: I484bc72bdb730a77ce976b0b2998411d9918b7fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka
f9fffe32b4 net: Add debugging to network management event part
Change-Id: Ib442dd4a34b30333d1423a9e90367d6626261c37
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka
cce3a7e3d5 net: Add support for event handling on network management API
This adds the capability to raise an event, and for anybody to listen to
it.

Change-Id: I2287b43d678930c29391efa2ddf7b12652cc1bb6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:46 +02:00
Tomasz Bursztyka
ec1d2c5a48 tests: net: Add a basic network management API test
Testing if net_mng() works.

Change-Id: I303cffa206859184a503ba8efe392b673b162e43
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:45 +02:00
Tomasz Bursztyka
a73b1c39d1 net: Add network management API
Define the ground mechanism to interact with the network stack.

Change-Id: Id2af76188967fa66e0f0d755a2c1dc8a85985540
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:45 +02:00
Ravi kumar Veeramally
8fc7035cfc net: Adopt net_nbuf_read_be32() api to dhcpv4 handlers
Change-Id: I3103e5f4b1bdbf8dced12ef25edd0b63f45548f6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:45 +02:00
Ravi kumar Veeramally
1ce3550779 net: tests: Add RA message unit tests.
Basic unit tests for Router Advertisement message handler.

Change-Id: Ia99cd160632972a12e2099a3ff6e41e6ea48ff9b
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:45 +02:00
Ravi kumar Veeramally
c69b10a3a0 net: Adopt new nbuf API's to RA message handlers.
Add multi fragment parsing support for Router Advertisement
packet.

Change-Id: Ie2730156c96759ee720f406f9d034b350643322e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen
060362ff14 net: Optimize net_nbuf_write() when handling last frag
Get the last fragment only once instead of searching it for
every byte written.

Change-Id: Iebeed21671b12bc081d7a1291f91d2c897a7a1d6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen
d8cb2fb161 net: Make sure buf is correct one in net_nbuf_write()
The buf parameter cannot point to a data fragment in
net_nbuf_write() because we need to use user data inside
that function and the fragments do not have that information.

Change-Id: I45b9c23869df08a0852bd99c0b453210ad2300b5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen
25c4f99aee net: Allocate next fragment in net_nbuf_write() if needed
If the caller did not allocate first data fragment, then allocate
it automatically.

Change-Id: Ice0f3bf65b1f9cd838738549ba15117d925b37b7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen
127c4f455a net: Make net_nbuf_read() to return NULL if buf is NULL
This way we do not access invalid pointer if user passes NULL
pointer to this function. Also we can avoid extra error checks
when calling net_nbuf_read() function.

Change-Id: Ie124cbe8a7915fa07decedd48c0c274138cfd0aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Jukka Rissanen
7a4cd852d4 net: Add be16 and be32 read helpers to nbuf.h
Two utility functions net_nbuf_read_be16() and net_nbuf_read_be32()
added which return either 16 or 32 bit big endian value.

Change-Id: I3401dde75669b429160c602a820359c800671afb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:45 +02:00
Andrei Emeltchenko
d6155e0cf9 ieee802154_cc2520: Correct debug output
Change-Id: I52979eb6661aac62eea875f088972d472f46ef81
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Andrei Emeltchenko
b85b27eab2 net: Do not source contiki headers always
Source contiki headers only for legacy driver

Change-Id: I356fd65ce9a4ee144c29eed1b51f2f0175315c1c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Andrei Emeltchenko
b2a478b935 net: cc2520: Fix setting proper IEEE 802.15.4 address
The bug was introduced by commit ID
a136a2587752cca256950b0efd5567ca29117d11

Which led to write junk as an address into cc2520 and thus made the
chip filtering out all unicast packet (as the incoming address never
matched)

Change-Id: I72009e795039f2059177a5b37a4bcf5d9717d65d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:45 +02:00
Flavio Santes
b29b0995d2 net: Improve net_context_connect documentation
This commit tries to improve inline documentation by refactoring
the original text. Missing information is also added, for example:
function return codes.

Change-Id: I940d4b6fa3e8079323e5e0ec1e5f63407505c9d9
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:45 +02:00
Tomasz Bursztyka
4b7309c751 net: cc2520: Let's provide ll addr in LE already
As it used directly as the ieee addr.

Propre endianess will have to be solved once this stack will be ported
to other arch than x86.

Change-Id: Ie556fabbd99cc5559025c8392d2f699facb007fa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:28 +02:00
Andrei Emeltchenko
330da1f4c3 net: Fix handling onlink prefix
In a case prefix is valid do not return prematurely.

Change-Id: I4d3a7567787c4bd74a2d66a642b632c32e675be3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:28 +02:00
Andrei Emeltchenko
99a14f9c65 net: Fix handling ra_neighbor
Fix returning without linking laddr to the neighbor, return only when
neighbor is not found.

Change-Id: I284d42bf5b3ffde6487f669be0f95ad40368674a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:28 +02:00
Andrei Emeltchenko
92cfd5127f net: Fix creating neighbour without l2addr
At the moment after receiving Neighbor Solicitation from the peer
a new neighbour is created with unassigned lladr resulting in
error later one below:

...
[net/nbr] [ERR] net_nbr_get_lladdr: {assert: 'idx <
CONFIG_NET_IPV6_MAX_NEIGHBORS' failed} idx 255 >= max 8
...

Change-Id: Ieb218fa5e850f018255b6080cbc0c7764595d40c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:28 +02:00
Andrei Emeltchenko
fcd22382a0 net: Fix link address length calculation
The patch fixes calculation of link address length. In a case of
IEEE802154 link address is 8 bytes long and formula for Source/Target
Link-layer Address calculation gives value 2 * 8 - 2 = 14 bytes.

Change-Id: I27570d4d45d348e53f7f63cb4681a1c8c5150e5e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:28 +02:00
Ravi kumar Veeramally
434f1ed85a net: Remove multiple declarations of net_ipv6_start_rs
Change-Id: Id3da5c9cfebbddd78a2d16220fe32e04b1cd3053
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen
61dc5be389 net: Íncorrectly named function in net_if.c
The net_ipv6_set_reachable_time() was incorrectly named, the
correct name is net_if_ipv6_set_reachable_time().
The _if_ prefix needs to be there as the function is located
in net_if.c file.

Change-Id: Ic841328bdff92fbb90f51a199ebbee82d7b1c9fd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:28 +02:00
Ravi kumar Veeramally
722db0baa4 net: Adopt new nbuf API's to dhcpv4 message handlers.
Change-Id: I5f4babef1f183dab5643b9d90dc1631dfd2c6c77
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:28 +02:00
Ravi kumar Veeramally
913c1f29ca net: Add unit tests for new nbuf API's
Tests for net_nbuf_read, net_nbuf_write and net_nbuf_skip API's.

Change-Id: I77f702dda8c9df7892120f47ff03a6b256191d31
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:28 +02:00
Ravi kumar Veeramally
618879ac6a net: Add nbuf APIs to read/write across multiple fragments
Helper functions to read and write data across multiple fragments.

Write function always adds at the end of last fragment. If there is
no space in last fragment new data fragment will be created and added
to input buffer.

Read function start reading from offset of input fragment. If the
required data is located in mutliple fragments it reads from list
of fragments and returns position and fragment where read stopped.

Skip function start skipping from offset of input fragment. If the
required length is across multiple fragments it skip till length and
returns position and fragment where read stopped. This is useful
when reading with unwanted data (reserved or unhandled data).

These functions are quite useful when handling with multiple fragments.

Change-Id: I348b869108724602ae780a1cba4fe17d3af7ffc2
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:28 +02:00
Andrei Emeltchenko
11df66a139 net: Fix distant address setting
Distant address is always plain: pan id and address. Using comp
generated a bug where pan_id was overwritten with ll address parts.

Change-Id: I19c6df0b3e7072a3e8d2b9539e5aef69fe309a4a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen
338c2be888 net: tests: Add initial set of IPv6 tests
Change-Id: Ib68b38a809068ca14ee9307e9ea605f03611ebd3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:28 +02:00
Jukka Rissanen
fb9af2523d net: tests: Increase the timeout of trickle tests
One second timeout seems to be too short as some test runs
fail when run in Jenkins.

Change-Id: Ifb01929148415961712468e3cc85387aac5eb2bb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:28 +02:00
Tomasz Bursztyka
dd7b967f2d samples: quark_se_devboard has been renamed to quark_se_c1000_devboard
Change-Id: I38942fad17b9955ca4c6e25414284eab465225df
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:27 +02:00
Tomasz Bursztyka
6790484ce2 net: ieee802154: Auto ACK and CRC are always on
We have no use of configuring cc2520, at built time at least, in
promiscuous mode. So let's get rid of these options for the new driver.

Change-Id: I17611c43bc7ba7961831beaa47cc4e2371f8de61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
dbb3988ee6 net: Remove nbr_data section as it is useless
No need to store the nbr pool data into a dedicated section
as we have only one nbr pool defined.

Change-Id: I6f2afcce57b5f588878496bf085567b938e32c80
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
66d3601dd5 net: tests: Add tests for route management API
Change-Id: Ic2f8d2d270f63baa0a16ae76f248485bc00eef08
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
dd8d2b8312 net: Generic route handling
Provide a generic API for managing routing entries in the system.

Change-Id: I917a2deaafe3f340a2852ec190817ed27b3d4d7b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
3919c69072 net: Add IPv6 utility func to create IPv6 packet
Change-Id: Ie7cf11bc8d7378579b5748f26ee6c9d83b12b42c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
d1fb108192 net: Add ref counting debugging to neighbor cache
Print allocation/deallocation caller in order to find neighbor
leaks.

Change-Id: Ib383f82043a9aba44768774c5acfeb81f076a960
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
829fe0ed87 net: Add more debugging prints to neighbor cache
Print the lladdr index value if it is over the limit. This helps
debugging.

If lladdr is not known, then print "<unknown>" instead of
link layer address with all bits zeros.

Change-Id: If9926c1cde0540746254cff115bb5b7001e96143
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
6cd33c4a36 net: Fix reachable timer accessing NULL pointer
If the reachable timer expires and if the neighbor has been
removed already, then do not try to access neighbor data via
a null pointer and crash.

Change-Id: I6d9a96f3fd2a20d4897509ebb9ad48bc455a51da
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
b607fdc79f net: Added a define for unused bytes length in ICMPv6 header
Change-Id: I144285fc20f4af30cd72b46df3b014e92e3e695e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
d020340176 net: Add function to return neighbor by the index
Add utility function net_ipv6_nbr_lookup_by_index() which
returns neighbor that is using certain link layer address
specified by a link layer index value.

Change-Id: I1dad3d9eacd8358428b77b8fe53c5306d391e1ef
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
69eccf7607 net: Fix function prototype documentation in neighbor header
One parameter was not documented.
Typos fixed in parameter description.

Change-Id: I6007a2dc7548e30e09347374df7e510a1fd27b9d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
985ea03bf0 net: User connectivity API documentation
Explain how to use net_context connectivity API.

Change-Id: Ifa57af3e05ca424dfbd30a17608a1dd59646caf9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:27 +02:00
Jukka Rissanen
f5a04ec642 net: Initial architecture documentation
This document describes the network stack architecture of the
new IP stack.

Change-Id: I19f7c77c66115e6453bcde0d41bb7cada3efc5e1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:26 +02:00
Andrei Emeltchenko
29e3bcfcde ieee802154_cc2520: Fix byte order swap for long address
This fixes bug setting incorrect long ieee802154 address and also
print address in BE byte order the same way as for Linux.

Change-Id: I774301e992372588dffa6ce5964fb119642a0a0d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:26 +02:00
Tomasz Bursztyka
640d524f69 net: tests: Add a simple IEEE 802.15.4 Beacon frame test
It's an empty beacon frame, juste to validate the Beacon frame parsing
logic.

Change-Id: I90916eb87187c9eae9b2267f34dc93bee554d4b5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:26 +02:00
Tomasz Bursztyka
daf0d1a134 net: Add IEEE 802.15.4 Beacon frame validation support
Such frames will be the corner stone to deal with PAN.
For now, it only validates such frame, verifying the FCF and the whole
length.

Change-Id: I8a441911d658d35abebf690e70a69337fc26d851
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:26 +02:00
Tomasz Bursztyka
305093bb35 net: ieee802154: Endianess order is reversed on MAC
MAC adress is BE, but IEEE 802.15.4 address is LE. Since we generate the
later on the first one, we need to reverse the MAC address.

Change-Id: I9bab4cf91494276e7cd4ea09290e82c477a43646
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:26 +02:00