Commit graph

19237 commits

Author SHA1 Message Date
Tomasz Bursztyka
7aa15f0257 net: ieee802154: Make pkt_hexdump ready to handle multi-fragment buffer
This debug print is heavy and disabled by default (hardcoded, no Kconfig
option). But it's anyway useful in some cases so let's update it to
handle multi-fragment buffers properly.

Change-Id: Ic20a9d4056bb91cc9816c129d78aa3fe80fc9fef
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
b18bbedfb1 net: ieee802154: L2 radio drivers should handle multi-fragment buffers
For each fragment it should transmit it, handle the error, retry if
possible, wait for the ack if necessary, all along the current
transmission strategy.

Change-Id: I28a01553e28d9bb51024321ce7d22372ad6a1335
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
ffa39e05a6 net: ieee802154: Refactor data frame function signature
This will be necessary to handle multi-frag buffers. As each frag needs
a unique sequence number, incrementing the sequence at every call.

Change-Id: I4e002dd42e89a1ef3f65e7591157d3e9d346ceff
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
2887bbf7fc tests: ieee802154: Make the test ready to handle multi fragments buffer
Buffer sent by 802.15.4 L2 might have more than one fragment, thus
handling it properly.

Change-Id: I12fef8a9c5de56615c3a084c57f438e71b320fcf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka
11a1d9ef32 drivers: ieee802154: Make uart pipe driver tx one fragment only
Let's not count the whole buffer length but only the very first frag's.
Up to L2 radio strategy to loop on every fragments and call tx for each.
(once sent, it deletes the fragment, so next fragment is always
buf->frags).

Change-Id: I94130fedfbecffdf62286bcb7f10563c776a255e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
0f2164cb5a drivers: ieee802154: Make CC2520 ready to tx only one fragment
The given buffer can come with many fragments, but it's not up to the
hardware driver to send all of these but only the first in the list.
The overall fragments send procedure is handled in l2 level where the
radio transmission strategy loops over the list of framents and send
them one by one relevantly.

Change-Id: Ia7ae42ab4e9f8efb83bf07de6791918059b1e1c9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
d48f36636d net: ieee802154: Refactor how address fields are generated
This is meant to generalize how these are computed, for future usage
like in MAC command frames.

Change-Id: I6b1cea93666f6df46a76b920077af5b0e413342e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
7e4bba03b4 net: ieee802154: Optimize context structure usage
For future purpose, let's not occupy a full byte for a unique boolean.

Change-Id: I36f2824cca4806eb90640a71ed3cea37a353b276
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
1f429015fa net: ieee802154: Optimizing how dst addr is validated in beacons
No need to use goto, validate_addr() is going to set dst addr to NULL as
expected.

Change-Id: I804a51307d9d8e5e21dbb4e6a794e23c7bbe2762
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
bcdca02ab0 net: l2: ieee802154: Fix radio utils comment
These routines are generic and not ALOHA specific.

Change-Id: I431e2f4a135d321a428e2ea98e41440cdc128a61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
62ea188772 net: mgmt: Fix include recursion loop
Including net_if.h can makes things looping, as this one will include
net_l2.h, which one might include a technology that will in turn include
net_mgmt.h again.

Change-Id: I514720875937414167f0396edb9147ed29dd6d69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
efaa46594f net: mgmt: Define request handlers to avoid build warning
Up to the part declaring mgmt request to define such handler. This is
meant to avoid such warning:

warning: implicit declaration of function ...

Change-Id: Ide6e9abf886169c26d81fe6b5c7bc280e1ac4e4d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes
86b1ef7b7b tests/zoap: Fix extra unref on net_buf fragments
Since "22e919872206b1d net: Adapt to new behavior of net_buf_frag_add"
net_buf_frag_add() takes onwership of the fragment, so this _unref()
after a net_buf_frag_add() is wrong.

Change-Id: I1559c2978cf8d800891d6e752478537fbee7c02b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes
3aa352e622 tests/zoap: Port observer tests to the native stack
This enables the tests for the observer feature to be run using the
native IP stack.

Change-Id: I325dcd1f5d9fffe3821eed1bd950a717e5f17b67
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Tomasz Bursztyka
1cd4190b2f drivers: ieee802154: cc2520: do not recalibrate rx after tx
As we use STXONCCA, RX will be stopped and reinstated afterwards.
We would be using STXON, since FRMCTRL1_SET_RXENMASK_ON_TX bit is set,
behavior would be the same.

Recalibrating the RX will uselessly abort any received frames before TX
or right after RX got reinstated. So, let's not do that and trust that
RX is anyway properly calibrated after TX.

Change-Id: Iac4fa03a175f8d139c1fc821de01caab1ec86e6b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
d5f906d493 net: tcp: Print TCP flags as a string rather than individual bits
Print TCP flags in a similar fashion to tcpdump, where uppercase
characters mean a particular flag is set, and lowercase characters mean
a particular flag is unset.

Supported flags by net_tcp_trace() remain the same: FIN, SYN, RST, PSH,
ACK, and URG, respectively represented by the letters 'f', 's', 'r',
'p', 'a', and 'u'.

Change-Id: Iaeb0b5c4fa5b4ab2b877d523b155dc431e9fc909
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
Leandro Pereira
9ff4c5f41b net: ipv6: net_ipv6_create() should know about TCP
This fixes the following build warning:
	net/yaip/ipv6.c:333:9: warning: 'nexthdr' is used unin-
		itialized in this function [-Wuninitialized]

This relies on net_context_get_ip_proto() providing the correct
protocol given a certain context.  Currently, it only returns either
TCP or UDP, which is sufficient for net_ipv6_create().  However, enum
net_ip_protocol contains other unhandled protocols (ICMP and ICMPv6,
respectively), which might or might not need to be handled in the
future.

Change-Id: I1f7af54612c3e1c978e734fc0e6b2ff1a61089f8
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:40:55 +02:00
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