Commit graph

41120 commits

Author SHA1 Message Date
Leandro Pereira
cec8703618 net: Do not dereference context before asserting
Change-Id: Ic8f2aa754ff8c3fca64e9950fd3b63d9218d826a
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
e230b9cdf3 net: tcp: Correctly set remote address when accepting connections
Change-Id: Icb112dcb50a04755eb8ce25be2fc043074679ae1
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
8865dbd3a5 net: tcp: Correctly calculate SYN_ACK ack#
When a connection is being established, the ack sequence number in the
SYN+ACK segment must be the sequence number from the SYN packet + 1.

Change-Id: I91df986f1f1b7cf8eaff0171921ab4c8cf1ddf93
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Jukka Rissanen
ded457d5fa slip: Fix hexdump print
The fragment count value was incorrectly printed. All
the values > 9 had their last digit chopped off.

Change-Id: I8304b8047baa97995c3927809e4616653c87928b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Jukka Rissanen
5f3f331d48 net: Adapt to new behavior of net_buf_frag_add v2
This change is related to patch called
"net: Adapt to new behavior of net_buf_frag_add"

This version removes extra net_nbuf_unref() from
the code. The unref was done because net_buf_frag_del()
did not remove the double ref from the list element.

Because of the other patch, the list does not have
double ref any more, so we need to remove the extra
unref in couple of extra places.

Change-Id: If90e01c24b9b4e68afbfa283850d2a1ecb3065ed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:54 +02:00
Luiz Augusto von Dentz
82ae330bfc net: Adapt to new behavior of net_buf_frag_add
net_buf_frag_add takes the ownership of the reference passed to it so it
is no longer needed to unref when deleting fragments.

Change-Id: I73f44ba313819a176b6a64b7644c80a83d86000e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
78502f1804 net: tests: Update DHCPv4 test results based on events
Earlier test results was updated as soon as test server ACK client
dhcpv4 request. But update results on IPv4 address add event on
interface.

Change-Id: I212309a4d1d2eae88f73470e00754db1d6fecda5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
6210b7c19f net: Notify IPv4 related events on interface
Change-Id: Ie97f1f4b577973e2b0b4dd126db6f332e954210c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Ravi kumar Veeramally
f1986a1d1e net: Add IPv4 related events
Change-Id: Ieb26ab96b2b9aa6765ddba21628ab1530a2597ea
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
899df8742f wpanusb: Add wpanusb syslog domain
Change-Id: I06f2df88678658a495b3ae0064b542f4697161a9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
3c75cc9c9c wpanusb: Correct definition names
Change definition name suffix to WPANUSB

Change-Id: I3456ebff061866a67b7a07b33f6ff83a31a2d7a8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Andrei Emeltchenko
cb77016c23 net: samples: Add samples overview for wpanusb and wpan_serial
Change-Id: I05f6ce9a823cb8a5466bd02739386f23e9266cc2
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
b014cc01d9 net: tcp: Master socket should never go to ESTABLISHED state
It should go to LISTEN state as soon as possible, to service another
connection.  The client connection, though, should be in the
ESTABLISHED state.

Change-Id: I98708e67bd969f09b84e60ac2fecc284bf82a79f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
9abf988079 net: tcp: Put new_connection on handshake failure
When an incoming TCP connection is accepted, a net_context for the
client is allocated.  However, some steps prior to calling the
user-defined accept callback can fail, without freeing the
newly-allocated client context.

Change-Id: I94ed03d2f3b69eb3edd23c990da5842fa4605a29
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
03d4596c10 net: tcp: Drop early when accepting without accept callback
Avoids creating context for client socket.

Change-Id: I2ed98060c991db37a5d80f739e944f7e46206ad5
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:54 +02:00
Leandro Pereira
c0d6863272 net: tcp: Ensure iface set in LISTEN state on SYN_RCVD state
Change-Id: Ibf853eb0c7c5116dfc86c8d685496e992ab6018f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
1cffdd8cbd net: tcp: Return -EOPNOTSUPP for non-TCP in net_context_listen()
Only TCP sockets are supported by net_context_listen(), so check if the
socket family is TCP rather than UDP in order to return success or
error.

Change-Id: I2ab5e9985d448811da2e1414d3ecafd9b3b3e475
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
82530f94d8 net: tcp: Change TCP state to listen on call to net_context_listen()
This keeps the semantics of the low-level network stack API closer to
the BSD sockets API. Prior to this change, listen() primitive was a
no-op, and accept() would change the connection state to LISTEN; this
changes the functions so that calling listen() is required before
calling accept().

Change-Id: Icd89eb8d76439d63339fc99277d5d3dad66fa5f5
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Leandro Pereira
56f6a86270 net: tcp: Use macros from byteorder.h to obtain ints
Instead of defining the poorly-named a2u32() and a2u16() functions
inside tcp.c, use macros provided in <misc/byteorder.h> to obtain
unsigned 32- and 16-bit values instead.

Change-Id: I344fe0e495c574cb8cc717036154221e912b4406
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
88e6e403fe net: dhcpv4: Adjust DHCPv4 debug config wording.
Adjust the DHCPv4 client configuration wording to distinguish the
option that enables dhcpv4 client from the option that enables its
debug. Provide help text for the latter.

Change-Id: Iadb115bc93f56e7dd3f1c0824f57a9cfc4453e75
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Marcus Shawcroft
5d102604ad net: dhcpv4: Adjust debug diagnostic wording.
Adjust the workding of NET_DBG() diagnostic to emphasize that the
contents of a received dhcpv4 message where not expected, rather than
incorrect.

Change-Id: Iee29e1b93c6a4876effa2e968bf77d9a0ada4ff0
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
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