Commit Graph

504 Commits

Author SHA1 Message Date
Genaro Saucedo Tejada 4dc8078435 fix: net samples no longer include unneeded 802.15.4 files
Some samples were including nullsec.c, simplerdc.c and
framer-nullmac.c, those files are not needed but introduce some
symbol dependencies, causing link to fail when optimization is not
-Os, e.g. when compiling with CONFIG_DEBUG.

Change-Id: Id227470a4517e8e2c3b9af942b0893783075cd40
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-09-12 12:29:09 +00:00
Jukka Rissanen 33d92af1cf net: Initial trickle algorithm support for legacy IP stack
This commit only provides the Trickle algorithm support.
Some other entity must call its functions in order to be
useful.

Fixes: ZEP-627

Change-Id: Ice1fcfe9c57269309eeab06eab000622662e2929
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-09-12 02:00:12 +00:00
Rohit Grover 769e2541d1 net: revert tcpip_poll_tcp() to not require a data_buf
tcpip_poll_tcp() was changed with commit 61edc68c to take on a
data_buf parameter, which was then processed as the primary
buffer. That change led to incorrect behaviour where the handling
of the first data buffer on a connection got mixed with the SYN buf.
It is no longer clear why tcpip_poll_tcp() was modified with the
change 61edc68c originally. Reverting the modification to
tcpip_poll_tcp() leads to much better handling of TCP data; and
also obviates another pull-request submitted recently:
https://gerrit.zephyrproject.org/r/#/c/4226.

Change-Id: I947c0991495c538c41e6581c8d360526b1bb89ad
Signed-off-by: Rohit Grover <rohit.grover@arm.com>
2016-09-06 15:11:03 +00:00
Marcus Shawcroft 01f59b6d9e net: uip: Fix udp_socket_process receive data callback buffer handling.
Adjust the data pointer passed to a udp_socket_register() registered
callback to point to the udp data contents rather than the header
information.

Change-Id: Ib90eee91e0ec4d0290517fee7b929d39ce3e07c6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-06 15:10:33 +00:00
Marcus Shawcroft 624cf83772 net: Fix code formatting
Re-instate correct code formatting.  No functional change.

Change-Id: If7c61214c07c6573ec25022ad47f83cc1b29e24c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-06 15:10:12 +00:00
Marcus Shawcroft b92d10d879 net: uip: Fix compile fail with stats enabled, tcp disabled.
Add missing preprocessor conditional around statistics update.

Change-Id: I3e55b1512e913b2e9a60d0ab56264439ca417a23
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-06 15:09:58 +00:00
Tomasz Bursztyka 8a574fdd67 net: contiki: simplerdc: Fix an uninitialized variable warning
If retries are 0 (which should never be), ret will not be initialized.

Change-Id: I8ef9a2ccbf89191e48d407fdb1292554fa8f15d9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-06 09:05:37 +00:00
Marcus Shawcroft 710e82faca net: Tighten ETHERTYPE decode.
The uip stack processes received packets by calling net_recv() but
does not discard packets marked with an ethertype other than IPv4 or
IPv6 resulting in confusion further up the stack.  Discard non IPv4/v6
packets from further processing by the IP stack.

Change-Id: Ic62f8d12b02da197b1abc774a581bff30330080c
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-08-30 10:48:48 +00:00
Andrew Boie ee5c0fb771 net: fix incorrect printk() usage
Change-Id: Ie8b61b6bd7e207664b31b1da64c44c7d04ccfd87
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Anas Nashif 78ce02f86d quark_se_devboard: We do not support capabilities via Kconfig yet
This will lead to conflicts and warning coming from Kconfig, so just
whitelist the board in the samples where this hardware is supported

Jira: ZEP-739

Change-Id: I4a2f3bdcfdb44fc75df0e272c237789ee16e0de1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-08-25 06:12:00 -04:00
Jaakko Hannikainen db493450ac net: ip: Fix compiling with 15.4
Kconfig allows selecting NETWORKING_WITH_15_4_TI_CC2520 even if the
current board doesn't support it, and also selects it by default. This
breaks building the 15.4 sample with qemu_x86. Add a config option for
having CC2520 support and enable the choise only if it is available.

In addition, remove unused function from iee802154 code, as it now
fails the tests.

Jira: ZEP-697

Change-Id: Ib082f82acdd0f86d3306bbd3bb827f61b0fd0be1
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-08-23 13:13:59 +00:00
Jaakko Hannikainen a8cd2ff368 net: Add NULL check to eventhandler
The eventhandler gets called with NULL buf, but it can't handle it. Add
a NULL check to prevent crashing.

Change-Id: Id16c2aa093a145e0442dfc61dd0b6e1b81b701f5
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-08-12 15:43:14 +03:00
Jaakko Hannikainen f77191976a net: contiki: Fix timer callback condition
etimer_expired will return true only once. This means periodic timers in
the netstack won't get to run since etimer_process calls etimer_expired
for all timers in the stack.

Jira: ZEP-475

Change-Id: I28da638789b0604f9dd0a0598a7fa590e6b0a746
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-08-10 15:25:59 +00:00
Leyi Rong e72a71a53d net: uip: Fix uip_udp_conns traverse loop in uip_process
the traverse step length should be sizeof(struct uip_udp_conn)
in uip_process when matching the right uip_udp_conn for net_buf

Change-Id: I33c0499582a96e5031ba94f147ff2376726b3f9c
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
2016-08-10 14:57:02 +00:00
Leyi Rong dcafc14162 net: net_context: Fix local ipv4 addr compare with INADDR_ANY
net_context_get will obtain ip addr from uip_hostaddr when the local
ipv4 addr is set to INADDR_ANY. So local_addr->in_addr.s_addr[0] is
represented for the local ipv4 addr content.

Change-Id: Ie6d77f27bdde5ea8568428a61b129eccb253df0a
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
2016-08-08 20:57:17 +00:00
Jaakko Hannikainen 2652c0e5a9 net: contiki: Add NULL check to neighbor polling
The function is getting called with NULL bufs, so uip_len cannot be
called on them. The stack further down handles NULL buffers correctly.

Jira: ZEP-474

Change-Id: I85fb045ec76bea2a83c64d0f72eabba4e661f5f4
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-08-02 05:25:59 +00:00
Jaakko Hannikainen 0766d3b921 net: contiki: Prevent a null dereference
When first starting the board, uip_connr may be NULL. This causes an
invalid pointer dereference. Add a NULL check.

Change-Id: Ia5d9897038a22fe44aab5106dd6b84c5a358512d
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-07-29 18:05:45 +00:00
Tomasz Bursztyka 37405583d9 net: coap: Add a Kconfig option to enable/disable link format filters
This requires strstr() from minimal libc, thus requesting such extension
to be built relevantly.

Jira: ZEP-598
Change-Id: I943d8046b6165fbcebec9cbabd7b874b19160d48
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-29 17:33:53 +00:00
Ravi kumar Veeramally b325989ede net: Fix incorrect IP app data length
When application wants to send zero length data, packet is dropped.
And uip_appdatalen is wrongly assigned with total IP packet length.

Jira: ZEP-575

Change-Id: I7f714cbef74dc28b83db7a776ef80a3026ae120e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-07-28 20:58:01 +00:00
Inaky Perez-Gonzalez 3e63a74514 net/yaip: revert merge
Follow up to TSC decission for further discussion in the networking
WIG.

Change-Id: I148b484dfe308661573e47ed3e60cceed673bddf
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-07-22 04:43:09 +00:00
Maureen Helm 1942a413fc net: tinydtls: Use assert.h from minimal libc
Now that minimal libc has assert.h, we can remove the workaround from
tinydtls.

Change-Id: I3bb001d1891f0b110b43133d30c262ba320450f7
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-07-21 16:22:20 +00:00
Ravi kumar Veeramally f93771a25c Revert "net: Restructured Ethernet driver menu"
This reverts commit 6de5643eb1.

Patch breaks applications running over Ethernet.

Jira: ZEP-565

Change-Id: Id147b7089f175c769c42c4e3dfb95408ee17ba9e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-07-20 22:57:55 +00:00
Jani Pajarinen 6de5643eb1 net: Restructured Ethernet driver menu
Created menu for Ethernet driver and moved driver + debugging setting
under it. Changed prompt from "Grove log level" to more describing and
fixed typos.

Change-Id: If2f79fee1a002a42e89e2493a2294332abec05ee
Signed-off-by: Jani Pajarinen <jani.pajarinen@intel.com>
2016-07-13 14:33:44 +00:00
Tomasz Bursztyka fdc93e6202 net: debug: Indent properly some config options.
Change-Id: I3500081592a983e97e3e5407ac441b4ece58634d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-07-13 14:06:17 +00:00
Jukka Rissanen 30b07ad70a net: yaip: Process received ICMPv4 messages
Call ICMPv4 handler when receiving such a network packet.
Currently only echo-request is handled.

Change-Id: Ib59c65b38f13c484f1842485118dad32fb6a6f36
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:57 +00:00
Jukka Rissanen 5cd47edca9 net: yaip: Add ICMPv6 handler
The host will be able to respond to ICMPv6 messages.
An echo-request handler is implemented and it will send
echo-reply when needed.

Change-Id: I08f4703bab5cf3e95d3ae722ebc7a386d22fe17e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:56 +00:00
Jukka Rissanen c324d8a4f9 net: yaip: Add debugging option for network utilities
Various network utility routines can debug print after this.
The Kconfig option is called CONFIG_NETWORK_IP_STACK_DEBUG_UTILS

Change-Id: I8384f974bd3c4965a6ef401bff8060389fab51ad
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 19:20:55 +00:00
Johan Hedberg 08ff2f67a2 net: Fix Kconfig warning
The double include of Kconfig.debug causes the following warning:

scripts/kconfig/conf --silentoldconfig Kconfig
/home/jh/src/zephyr/net/ip/Kconfig.debug:45:warning: choice value used outside its choice group
/home/jh/src/zephyr/net/ip/Kconfig.debug:47:warning: choice value used outside its choice group
/home/jh/src/zephyr/net/ip/Kconfig.debug:49:warning: choice value used outside its choice group

Change-Id: I3f59587eed656b67e1f69e2a8151288f41b50769
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-12 19:26:42 +03:00
Jaakko Hannikainen 5c657752da net: Yield before sending packets
Using net_receive with long timeouts breaks net_reply. Sending a lot of
packets in a row without yielding causes failures since the network
stack can't send them. Add yield code for both net_reply and net_send.

Jira: ZEP-469
Jira: ZEP-497

Change-Id: Ic59769462e0575da0898d35745d49647f7e43edd
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-07-12 10:48:55 +00:00
Jaakko Hannikainen 8b6be8d773 net: Update ip_buf_len for TCP packets
When handling TCP packets, ip_buf_len is set 4 bytes too big.
Recalculate the value when handling it.

Change-Id: I6502bd58d3860f6318dca668b7b1d6b556d34c2a
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-07-12 10:45:19 +00:00
Jukka Rissanen d7cf956c07 net: yaip: Refactor debug printing in net_if
There is now Kconfig option to enable net_if debugging.
Also use NET_DBG() instead of directly calling syslog macros
so that we can print fiber id automatically.

Change-Id: I150d363006e4be358c38308a93771ba444b0835e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:24:00 +00:00
Jukka Rissanen 6bd7430a34 net: yaip: Start to use logging macros from sys_log.h
Instead of directly calling printk/printf, the network printing
macros will use syslog macros defined in sys_log.h

Change-Id: I3f12f81557f50b24ca47a43f345162f9ffbd574c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:49 +00:00
Jukka Rissanen 5f8c18fc1b net: yaip: Add Kconfig option for compiling IPv4 support
The YAIP stack uses CONFIG_NET_IPV4 to compile IPv4 support.

Change-Id: Ia4a579591d6d2050e168c35e68546281043d53a8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:33 +00:00
Jukka Rissanen f2f7bc1c13 net: yaip: Add Kconfig option for compiling IPv6 support
The YAIP stack uses CONFIG_NET_IPV6 to compile IPv6 support.

Change-Id: I25c3b2d6775ed610fca43960a569ddab0ec470aa
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:23:05 +00:00
Jukka Rissanen 99a04e263d net: Show only uIP debug options when needed
uIP specific debug options are shown only when uIP is
being compiled.

Change-Id: Ieea5db021227a2b3cbe625a9c774e7c1f99b5e83
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:22:56 +00:00
Jukka Rissanen 8e3defbe73 net: yaip: Let new IP stack know the debug Kconfig options
Change-Id: I1a549317b3072536a6eddf59fb5912aa3795e02e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:21:38 +00:00
Jukka Rissanen 75ae39518c net: yaip: Initial commit for new IP stack
This is a placeholder that just compiles but does nothing else.

Change-Id: I9689fa26eb13bc23d29940938f7b3c11f32b2ff1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-07-12 07:18:06 +00:00
Jaakko Hannikainen 51e517c08b net: contiki: Fix compiling with ipv4
ip_buf_sent_status is only available for TCP, but uip_send_udp is only
called for UDP. Remove the else block.

Change-Id: I9695b33f975042ec15fde718d91ab901617437f2
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-06-27 11:46:50 +00:00
Jaakko Hannikainen 0616c2679b net: initialize ip_buf_len when receiving packet
When udp_packet_receive is called, ip_buf_len is set 4 bytes too big.
This ends up with the client program receiving 4 bytes more than the
board actually received. Initialize it correctly alongside other values.

Change-Id: I0012aa7e8c6a440a618dfa03c4fdc2b898d592fc
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
2016-06-27 11:46:50 +00:00
Johan Hedberg 4e3e23eb18 net: Use net_buf APIs for getting net_buf elements from FIFO
The net_buf API ensures that the frags pointer gets initialized
properly. Using nano_fifo_get could mean that buf->frags is something
else than NULL if there was more than one item in the FIFO.

Change-Id: If65e85a7cbe82f562307dc781d48110c3be0472b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-14 09:20:06 +00:00
Arkadiusz Lichwa b2647d84b3 Bluetooth: L2CAP: Refactor l2cap core types
Refactors L2CAP core data structures and modifies functions that uses them.
Now we can have separate L2CAP feature channel objects for LE and BR/EDR
transport. This's also a ground for make L2CAP CoC API to be common
for both transports.

Change-Id: Ic1197b0e3c4f505764b23fb9c7eb27123a44a675
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-13 11:49:07 +00:00
Ravi kumar Veeramally 803de8d14e net: Fix return value from uip_udp_packet_sendto
udp_socket_sendto returns always datalen irrespective of
uip_udp_packet_sendto return value.

Change-Id: Ib1c5a25ae89ddaa0826d35d4fd53f9c2ccea7b93
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-05-31 08:06:37 +00:00
Ravi kumar Veeramally 0de956d53f net: dhcp: Add DHCP client support.
DHCP client support provided for IPv4 over ethernet.

Change-Id: Ia89bc4123842cf109813b80a90b70cf50cc52e0a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-05-27 11:09:30 +00:00
Jukka Rissanen 655eb4b75e net: ipv6: Allow user to select number of neighbors
Earlier default was 8, new default is 4.

Change-Id: I99c9d2aae465fd0feb968efa7417cd28bafd73b8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:21 +00:00
Jukka Rissanen 798d3511c1 net: ip: Allow user to select number of TCP connections
Earlier default was 10, new default is 2.

Change-Id: I307a4abaad34223254fd32e1fd4357892a04a2d0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:21 +00:00
Jukka Rissanen a2004cc70f net: ip: Allow user to select number of UDP connections
Earlier default was 10, new default is 2.

Change-Id: I938449d840a244a13e9b9b954648577b76db00bc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:21 +00:00
Jukka Rissanen e56f701a04 net: ip: Allow user to select number of network contexts
The network context is similar concept as network socket.
Depending on application use, the number of contexts can be
now tweaked. Default value is now 2, it was 5 earlier. Using
the lower number saves 241 bytes of memory.

Change-Id: I6e2a9f053c8c63163af6d6175783233f67553ae9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:21 +00:00
Jukka Rissanen 81671f793d net: 802.15.4: Removed the TX fiber and its stack
This saves little over 4kb of memory.

Change-Id: I4dc3812b11de2736e2bdc17042e47fcdf5cf5491
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:20 +00:00
Jukka Rissanen 026a6d170a net: 802.15.4: Always use nullmac driver
User cannot select CSMA mac driver any more in order to save some
memory.

Change-Id: I7805a1c2028f60bc8a428bd5b8f891d540a14b6d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-27 06:15:20 +00:00
Sebastien Griffoul fb8d7625d1 net: ipv6: Fix net_set_mac function
The ethernet driver calls net_set_mac before net_init is
called (ie before the uip stack has been fully initialized).
Unfortunately net_set_mac calls the function uip_ds6_set_lladdr.
Therefore this function is called before uip_ds6_init: this is an
issue as uip_ds6_set_lladdr is setting some static data which are
going to be erased by uip_ds6_init. In some case it could even lead
to a system hang due to a timer set twice.

To fix this issue net_set_mac should check whether net_init has been
already called. If not net_set_mac should simply copies the mac
address into uip_lladdr. Indeed uip_ds6_init automatically calls
uip_ds6_set_lladdr for the address stored into uip_lladdr.

Change-Id: Ifbcb07e7cd493b6284a85d70f2439d434cebbb00
Signed-off-by: Sebastien Griffoul <sebastien.griffoul@intel.com>
2016-05-26 12:24:43 +00:00