Commit graph

41120 commits

Author SHA1 Message Date
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
Ravi kumar Veeramally
a026c615ff net: apps: Add DHCPv4 client sample application
Change-Id: Ia0366a24c2bc18cbd9278b7dc7d4a155df6521fb
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
2a9d75ac1c net: tests: Add DHCPv4 client unit tests
Change-Id: Ief15927975bb0398c39c656068ec8c73c4f62e82
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
28c82144c2 net: Add DHCPv4 client support
Change-Id: I3a7a9074f68059d69c20c947882a3f6480ace23a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
dd7eaf9dbf net: Fix net address state
Address state is preferred when adding it to interface. State might
get change as per lifetime(limited/infinite) (e.g. expiry or renewal
period). Handle it properly.

Change-Id: I0e663171a125b0895b4574cd6ea147d0148ef8c6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
eff902b4c7 net: tests: Add include dir only when specific options enabled
Change-Id: I2119c6e08b0d13c6a6849b46f210196b07b8d51e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
87cf88b89e net: Fix IPv4 packet reception
In-case of DHCPv4 IP address negotiation message time frame,
interface doesn't have any assigned IP address. All the packets
will be dropped.

DHCPv4 client listens on server port(67) client port(68). Client
service will register a listener and listens on those ports. So
update the checkpoints accoring to it.

Change-Id: Ib046a4e1150c6b2277b0c06614970a619d0be589
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
f5dec25466 net: Fix arp/ethernet broadcast and multcast addr scenario
In case of broadcast or multicast destination address, ARP
message is not required. But ethernet_send assumes net_arp_prepare()
returns ARP buffer and doesn't fill any LL header information in
all fragments.

So checking whether destination address is broadcast or multicast
in ethernet and fill LL headers according to the case. Lets assume
if net_arp_prepare() returns success means that is ARP message.

Change-Id: If5909d04d993b1690ae44cd9f5af43b8346d3a72
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
e09b79f858 net: Fix slip multipackets reception
Multipackets support not handled perfectly and breaks regular
flow on some occasions. So remove this support and have to
implement properly.

Change-Id: I1b72c66479c3516df6e6e93998edff1260eb839d
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Ravi kumar Veeramally
846201d049 net: tests: Remove broadcast and multicast tests from ARP
If ethernet address is broadcast or multicast, l2 layer does not
send any ARP messages. Handle this scenario in ethernet tests.

Change-Id: I8e11832803e1539887152447090d1286c7fa3eb0
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:26 +02:00
Jukka Rissanen
ae3f1cd622 net: Calculate IPv4 checksum when sending IPv4 packet
Change-Id: I7ecf578efcfedab2f5814d2822f3895cba375622
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:26 +02:00
Jukka Rissanen
e04445a042 net: Add utility func for calculating IPv4 checksum
Change-Id: Iade33740963c23cb82b0d62bdb07960e8a085c82
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
c427e9bbd6 net: Context accept cb needs to return failure code
If the connection establishment has an error, the accept
callback needs to be able to return that error to user space
so that the application can know about it.
This is especially important in TCP where application needs
to start to listen again if reset is sent during connection
establishment.

Change-Id: I55f36e4f101c7237c1288f09baf6e602b33da2b3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
73aa1cc72c net: Add TCP buffer access func to nbuf
So we can easily access TCP buffer that is stored
in net_buf.

Change-Id: I37ae728be45ded2fcc74735592d94897c945afbe
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
708579eb6b net: Add TCP protocol header definition
Change-Id: I17ab9f21ebbebdfc47e82a11540d8e071d7c46de
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
84ffca2eb1 net: tests: Add unit test for net_nbuf_pull functionality
Change-Id: I929f7c6eed21aca0f92975b96380a91e5e50587f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
8d9ea90fba net: Add net_nbuf_pull function
This will remove given amount of data from the fragment list.

Change-Id: I17d809982af0b941f957205688ee61e5ac3c1f08
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
6ef5fa22b2 net: Align net_if struct to 32-byte boundary
This is needed because if there are more than one network
interfaces configured, then the second interface will point
to wrong address. Only solution to this issue is to align
the net_if to 32 byte boundary. The issue was seen in qemu
and it is not really known if the issue is present in real
hardware.

Change-Id: I2048c8a9a0aab51f84c15539159410b544f6c9b1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
846bb62521 slip: Fix debug printing
Print the link layer header in different color so that the
actual IP payload in packets are easier to see. Also the
link layer header of the first packet was not printed.

Change-Id: I99699d378ae28d6d90c683c646c904c926b7dd06
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
70430795a9 net: Fix the statistics compilation
Make sure that the statisitics compilation can be done even
if some sub-statistics module is not compiled, like IPv6 or
IPv4 statistics.

Change-Id: I1a91acd70569f074d9bb3269f74ee9c6a0ea9cf7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
6c10d3864a net: Add DEBUG Kconfig option for UDP
Change-Id: Iec84df65f0a73050559bb92753edd2eb6e8f6338
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Jukka Rissanen
96e629c877 net: Fix remaining debug option naming issues
Some of the DEBUG options for the new IP stack still used
the CONFIG_NETWORK_IP_STACK_DEBUG_ prefix.

Change-Id: I8f039ac5e303a7c571a870403ce17d758db540d5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka
7353cf4079 net: ieee802154: Add CSMA-CA non slotted radio protocol support
Implementing the primitives for non-slotted CSMA-CA radio protocol
according to section 5.1.1.4 in the 2011 version of the specification.

Slotted version will come when Beacon frame will be supported, thus
getting PAN coordinator info from its superframe.

Change-Id: I0545ed953a3c48e6b8e9cd4082db01ed66ad098b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka
06f10d43e1 net: Centralize generic IEEE 802.15.4 radio utility functions
These will be used by other radio protocol, such as CSMA-CA.

Change-Id: I8b308c0376e5e26ae35fbbb4a0a7f99228fa2529
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka
7f0012eaea net: ieee802154: Normalize Kconfig
Change-Id: I5fa36f973cdc2439bfb7e98e41abb50f4c4cd520
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:25 +02:00
Tomasz Bursztyka
dd5c1f0547 net: ieee802154: Add basic support for IEEE 802.15.4e on FCF
It can parse newer version's FCF, but it will generate only 2006 ones.

Change-Id: Ib635cc5840505af891a802da8fc6f3ee95478916
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka
203be13f83 net: samples: Add a simple Qemu sample for testing off-line 802.15.4
This will use the dedicated UART pipe driver to send/receive IEEE
802.15.4 "radio" frames.

- make
On one console:
- make qemu1
On a second console:
- make qemu2

Note:
net-tools is needed, cloned into net/tools
https://gerrit.zephyrproject.org/r/#/admin/projects/net-tools

Change-Id: I833cd40238b0653bb5b9a9b462fb4d5d2a3504b9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka
60c71f4d90 samples: net: Qemu make utilities update
- net tools directory is now in net/tools
- fixing the 80 chars line limit

Change-Id: I079880fa3449beffb326369ab23550dcba3ccf20
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka
49dffe2669 samples: net: Moving the current ieee802154 sample
More samples will come. Current one is meant to test ieee802154 with
cc2520 on quark_se_devboard target. Some future sample will show how to
use the Qemu uart pipe fake 802.15.4 radio driver for testing on one
host.

Change-Id: Idea2b16cde091c7da926ca8aa71912fbfd0a3d62
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:24 +02:00
Tomasz Bursztyka
fc0e6497af net: drivers: Add a fake ieee802154 radio driver for qemu
This driver is used for testing on Qemu where all "radio transmission"
will go through a pipe between 2 Qemus.

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