Commit graph

42249 commits

Author SHA1 Message Date
Marcus Shawcroft
047e17eed5 net: dhcpv4: Issue an NET_INFO when dhcpv4 allocates an IP.
Add a NET_INFO diagnostic to output the allocated IP address.

Change-Id: If6854467cfddc5b3fbe18f48d4639e6ff0c84fff
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
e65a7fcff6 net: dhcpv4: Add received message debug.
Add NET_DBG() output itemizing the parsed context of a dhcp request.

Change-Id: Ic4b2586314aa749d46c25a02d512057a3372e975
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
f903cb3763 net: dhcpv4: Implement XID
RFC2131 requires that a client must choose XIDs in order to minimize
the chance of collision with another client.  Selection of a random
XID at boot is a valid approach. Adjust the XID representation from
array of bytes to the more convenient uint32_t representation,
initialize the XID to a random number and increment for each request.

Refactor the dhcp test case to generate response messages with the XID
from the received message.

Change-Id: I93f180e6aa02430f807e0a97186577dc956fb653
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Tomasz Bursztyka
df20ab8b90 net: Renaming net_l2_init sections to net_l2
net_l2 is the proper name, looked by sanitycheck.

Change-Id: I08548865df21a57c8198fe0a801aa8c2a81b7fb0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:53 +02:00
Jukka Rissanen
7f4275ef52 iot/zoap: Temporarily disable block size transfer test
The test "Test block sized transfer" does not work with
new IP stack so disable it temporarily for new stack.
This needs to be fixed later.

Change-Id: Ie89dd101270ab9b8a9b056757de79cd3da009180
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:53 +02:00
Ravi kumar Veeramally
d3b21f0171 net: tests: Add unit tests for net_nbuf_write/insert utilites
Change-Id: I4df5672777af2c27511465b72ea17b7b5e0c8e8f
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:53 +02:00
Ravi kumar Veeramally
889b090ffb net: Implement net_nbuf_insert
Add support for inserting data into an arbitrary location in fragment.

Change-Id: Iaecdc4e980a73e0f66c208315d342e05762cd6f5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:53 +02:00
Ravi kumar Veeramally
9f308ac83c net: Implement net_nbuf_write
Add support for nbuf write to an arbitrary location in fragment.

Change-Id: I686c6d86feb8545603edd7c7a9ef6fde1c909a72
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:53 +02:00
Tomasz Bursztyka
71d1bd6066 net: Remove unused net sections
net_l2_init sections used to exist in early stage of the native IP stack
but got removed since.

Change-Id: I189d6e6f7aa05a6e5a62a28973c714d0367b0c5a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:52 +02:00
Flavio Santes
fd2e2f2f5e iot/dns: Update README files
This commit updates the README files to reflect that ZEP-1036
is already solved.

Information about ZEP-1097 and ZEP-1098 is now included.

Change-Id: I3c83160962d308d374823e086bbf083dca988606
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:52 +02:00
Flavio Santes
ffb6ae0dda iot/dns: Improve support for additional boards
This commit modifies the conf and Makefile files of the DNS client
application.

Inside the Makefile, the CONF_FILE variable is updated to include
the BOARD name, therefore prj_'board_name'.conf is used from now on
to refer to the conf file. The right conf file is selected by passing
BOARD='board_name' to make.

Configuration variables at the conf files are also homogenized.

Change-Id: I6f5aaad0b52d458bceb90b315aba2b31f085c0a0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:52 +02:00
Andy Ross
ca1a7c5825 net: tcp: Clean up TCP sequence checking
A bunch of if's are a poor substitute for straightforward interval
checking. You just have to be careful about the sign.

Also the seq_equal() routine was unused.

Change-Id: Id3a627ff75c8ab9889f226c733faa3fcb38207a7
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-12-02 12:40:52 +02:00
Andy Ross
24dcb8502c net: tcp: Fix race in net_tcp allocation
Move the IN_USE clear in net_tcp_release() to the END of the function
after the destruction is complete so someone else doesn't allocate it
while we're still cleaning it up.

Also, operations on the IN_USE flag need to be atomic for correctness.
Stick an irq_lock() around them.

Change-Id: I9d7557244fc8de5b0c69fd0bc749a9e28fa19a54
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-12-02 12:40:52 +02:00
Andy Ross
63c7565219 net: tcp: Remove dead/stubbed struct elements in struct net_tcp
Big chunks of this struct were essentially unused:

+ The prev_state field was stored at state change but never inspected.

+ The send_wnd, send_max_wnd, send_cwnd, send_pcount and
  send_ss_threshold fields were simply unused.

+ The recv_scale field was never initialized to anything but zero,
  remove the support. Windows greater than 64k seem very unlikely to
  be useful to Zephyr anyway; if we actually want window scaling (in
  either direction -- there are large memory costs!) it should
  probably be optional via Kconfig.  We surely don't want to carry
  this for all builds.

+ The buf_max_len field was hard-coded static, replace with a #define

+ Double-memset of the ack_timer field in initialization

Change-Id: I223665518529dc6a7f267bbc6992a645a30f5735
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-12-02 12:40:52 +02:00
Anas Nashif
e6bbc5003c net: do not depend on ARCH
Rename project configuration to be architecture independent and do not use ARCH
in Makefile.

Change-Id: Ic793751e3187bc74fd14cec929754d691b01a799
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko
408d0c2124 wpanusb: Improve debug for wpanusb
Change-Id: I90201df4a50f81cd9a479539826456a6ffb62bb9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko
9bbfaef4a1 wpan_serial: Implement 802.15.4 serial radio protocol
Implement serial-radio protocol used in Contiki-based border routers
to interact with 802.15.4 devices connected over serial or USB-serial.

Change-Id: I938b34ca32ae7a08e5d48e3bea585cda6c98c113
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko
7b4acbff25 wpanusb: Add wpan radio protocol specification
Change-Id: I4ab00d87de50a9efa5b715649d4b5154e37ce1c0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko
68e7037104 ieee802154: Correct error logging for cc2520 driver
Change DBG to ERR for error cases to get errors when only errors are
selected.

Change-Id: I51fd15900b1efb96d5dff36367afcdf380f11b88
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Andrei Emeltchenko
daefa3d979 ieee802154: Add log domain for CC2520 driver
This prepends logs instead of [general] with [cc2520].

Change-Id: I148159a451981fbe3da638732f0e97900f76bc58
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:52 +02:00
Jukka Rissanen
1c3c26a1f9 net: tests: Add TCP unit tests
This provides only initial set of functionality tests
for TCP. More tests are to be written.

Change-Id: I157fed85f561523bf063732ce86eaae551c2d384
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:52 +02:00
Jukka Rissanen
ddda50c214 net: tcp: Initial TCP functionality
This creates initial TCP handling logic but does not yet
enable fully working TCP connection.

Some of the connection logic is taken from FNET TCP
implementation.

Origin: FNET 3.6.1
URL: https://github.com/butok/FNET/blob/master/fnet_stack/stack/fnet_tcp.c

Change-Id: I1e100d9fa9c91437562b933d94d0bd3db1a5885e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally
ed3dbe1cbf net: Fix typos in nbuf apis
Change-Id: Id89d0d7f1d49a275de0f735a6457fdb6fdad31ea
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Luiz Augusto von Dentz
1057c44c65 net: Kconfig: Add NET_NBUF_USER_DATA_SIZE
NET_NBUF_USER_DATA_SIZE can be used to set the user_data size required
by drivers in order to be able to reuse the network data buffer without
copying them.

Change-Id: I198b24ee6d2b8971801c8da40ce008da20bd95c4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:40:51 +02:00
Jukka Rissanen
54a500a478 net: Add helpers to get sockaddr pointer
This way we avoid ugly casts in the calling code.

Change-Id: I9c949cf22ecd1603e9247a07240de5759bf85463
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:51 +02:00
Jukka Rissanen
a559ad37c2 eth: enc28j60_legacy: Make driver config_info structure const.
Change-Id: Ic3aac209024bd9a6e8456b228705b39e88179b01
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:51 +02:00
Paul Sokolovsky
4de34b3914 net: apps: Fix echo-server where IPv6 TCP context was used instead of IPv4
Apparently a copy-paste error.

Change-Id: I55aac4231384cbd95394f08a4c4f9c717aae5248
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-12-02 12:40:51 +02:00
Paul Sokolovsky
be96b7df62 net: Make net_context_get_ip_proto check correct flag.
Apparently, a copy-paste error: NET_CONTEXT_TYPE was used instead of
NET_CONTEXT_PROTO. The corresponding "set" function uses the latter,
so it for "get" too.

Change-Id: Ideb5bfaeb548222a6e64d53b782c9a111e3ef33b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally
c689fd6f1a net: Rename net_nbuf_write to net_nbuf_append
Current net_nbuf_write() api just appends data to last fragment. And
doesn't write data based on offset. That's why renaming this api.

New net_nbuf_write() apis based on offset will be coming soon.

Change-Id: Ie8e13e5f6091a279b62b6d8b0b3928a5187e75b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally
28a7df161c net: Fix ARP requests error
Reason for error is ARP message redirected back to ethernet
instead of sending directly.

Call flow:
  ehternet_send()
    net_arp_prepare()
      net_send_data().. which again calls ethernet_send().

So below check is necessary in net_arp_prepare().
"if (ntohs(hdr->type) == NET_ETH_PTYPE_ARP)".

When same buffer used for Tx, it still contains garbage in link
layer header (which is uninitialized). But this check
assumes buffer is ARP and send it immediately.

So first fix is just queue the Tx buf with net_if_queue_tx.
Now only ethernet_send() will call net_arp_prepare(), means
input buffer for net_arp_prepare is not ARP at all. So the check
is not necessary.

Jira: ZEP-1036

Change-Id: I86eaba5ffaa9cabfe43e643b17fa0f9171c4c521
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally
c90e0ae58c net: Fix slip compilation issue with debug option enabled
Slip context parameter is not used in hexdump and in few places
it is not defined. So CONFIG_SLIP_DEBUG=y throws errors.

Change-Id: I73ca26b7d5cd7c3cd532462b5300e25bbdac9511
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Ravi kumar Veeramally
f1cd63c2b1 net: Fix net_nbuf_write buf ref count
net_buf_frag_add() maintains proper refcount. We loose refcount by doing
this "buf->frags = new_data_frag".

Change-Id: I16f9b7f1dc36a8acbc1b6545c42288956cf9d535
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Flavio Santes
8d001fa5cb iot/dns: Add support for Arduino 101 and ENC28J60
This commit adds support for the Arduino 101 board with the
ENC28J60 Ethernet module.

Change-Id: Ib852e9cfb2b3b2188d3320e00d6bc24620e187f5
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:51 +02:00
Flavio Santes
8b0467a967 iot/dns: Add '+' operator
This commit adds the '+' operator that keeps symmetry with the line
below.

Change-Id: Icb2a5f22b5202597e3e0cc252436b422ce7b44a2
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:40:51 +02:00
Sergio Rodriguez
05aded096e samples/mbedtls_dtlsclient: mbedTLS sample DTLS client app.
This is a sample app using ECJPAKE crypto algorithm on DTLS, using
mbedTLS, and native IP stack

Jira: ZEP-900
Jira: ZEP-943

Change-Id: Ica17b047aab11b989d3e8c8f6ac1b79e3041053a
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-02 12:40:51 +02:00
Vinicius Costa Gomes
09b2bb05d0 drivers/slip: Fix circular dependency on NET_SLIP
Fixes this warning:

warning: (NET_SLIP_TUN && NET_SLIP_TAP && NET_SLIP_TUN && NET_SLIP_TAP) selects SLIP which has unmet direct dependencies (NET_SLIP)

Change-Id: Ic51f8403a4de19f90ba4dcdca93877d51dabf787
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
516edbf8ac net/yaip: Separate SLIP support into TAP and TUN options
For SLIP under QEMU, there is a choice between using TAP and TUN
interfaces, which have different frame formats. So, it makes sense that
we have different options for each, as they are incompatible.

Change-Id: I43f76391ccf3574da16741b314639427f5c1dd40
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
46be4f4907 samples/zoap_client: Use token generator helper
Change-Id: If3dfe80deb8ff753fecae539032399deb15279ee
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
ea28e4fccb iot/zoap: Add helper for generating tokens
Most applications will want to use randomly generated tokens, add a
helper for that.

Change-Id: If2a6b1d96596024afd2d2ce8e3632900adfe9c0f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
dc45748d50 iot/zoap: Port to the native stack
This ports zoap to the native stack.

Just for reference, and totally not scientific, here are the numbers
using the old stack:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  34657	  10316	  16916	  61889	   f1c1	outdir/qemu_x86/zephyr.elf

With yaip:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  30575	   9148	   6164	  45887	   b33f	outdir/qemu_x86/zephyr.elf

Jira: ZEP-818

Change-Id: I7992a3e2af7d419081ee5a64d7cc2d49fb628ead
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Juan Manuel Cruz Alcaraz
92539f21fc enc28j60: Modify echo server and client samples to support enc28j60
Extends the echo server and echo client samples to work with YAIP
network stack with ethernet L2 layer and ENC28J60 ethernet device
on Arduino 101 boards.

Jira: ZEP-859

Change-Id: I242e5555aff18741bf00a551424b081b5396f4b3
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:50 +02:00
Juan Manuel Cruz Alcaraz
8d6206c9be enc28j60: Adapt driver for native IP stack
Jira: ZEP-859

Change-Id: I7a073168a2bfba95291e43b227ffb6bfea1f5692
Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
2016-12-02 12:40:50 +02:00
Luiz Augusto von Dentz
8c7aa2d085 net: Add TODO item for Bluetooth
Add item for enabling samples with CONFIG_NET_L2_BLUETOOTH.

Change-Id: I2a51c197c2b1cf4a81edb189e86f645de754533b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:40:50 +02:00
Luiz Augusto von Dentz
83c9da8af8 net: Add initial Bluetooth support using native IP stack
Initial Kconfig and L2 layer support.

Jira: ZEP-992

Change-Id: Ia60316566ea1e535d9cdb3f372c3c46630d0e9c0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
f996299754 iot/zoap: Add support for error 4.15
The "Unsupported Content-Format" error was missing from the list of
supported errors.

Change-Id: I208d79f8949838187b877eaa0a53597d8a5bc6cb
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Vinicius Costa Gomes
fa5481b1cb zoap: Fix alignment of multiline function arguments
Change-Id: I0a96c87db84671be1790fda34083e7cd53e00cd0
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka
b49d6246b3 net: drivers: slip: Let's cleanup a bit for better readability
Change-Id: I50fef5bb607da600f0c878066312d4b7b2d71d58
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka
37d0958321 net: driver: SLIP does not need to store ll reserve at any time
ll_reserve is given through each buffer to be sent, it is therefore easy
to get it from there.

Change-Id: I8b52fe1b72065f5f58275f939253942f7db1f136
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka
9c70e1ca06 net: drivers: Slip can get the MTU set on it's interface
No need to store the mtu locally as the network interface already holds
it.

Change-Id: I4a1c3d164eefa28622dcb6cd510a66a825c3d9fb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:50 +02:00
Tomasz Bursztyka
076235c23b net: drivers: SLIP should not reserve anything while receiving
Link Layer reserved space will be handled by relevant L2 layer.

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