Commit graph

19237 commits

Author SHA1 Message Date
Anas Nashif
57683bc01f doc: reference bluetooth section of Arduino 101
Change-Id: Ide11ac9e22c175603791c6a3b65a64fa12fe6d5c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 17:55:04 +00:00
Johan Hedberg
dc42b2df43 net: buf: Fix timeout parameter documentation
The timeout given to APIs is in milliseconds and not ticks.

Change-Id: Iae198ca3aee326c19d0894a22f6e5cfca19ba131
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-03 15:24:07 +00:00
Jukka Rissanen
792c0209f1 Merge net branch into master
Main changes:

- Documentation enhancements and fixes
- TCP fixes
- MQTT fixes
- HTTP server sample application
- IRC sample application
- DNS sample application fixes
- Zperf sample application fixes
- IEEE 802.15.4 fixes
- ZoAP server fixes
- BT IPSP fixes

----------------------------------------------------------------
Anas Nashif (3):
      doc: update networking with Qemu section
      doc: net: use Qemu setup section in current documentation
      doc: net: restructure networking documentation

Andy Ross (5):
      net: tcp: Clean up net_context lifecycle
      net: tcp: Don't send active close FIN packets synchronously
      net: tcp: Clean up FIN handling
      net: net_context: Drop callbacks in net_context_put()
      net: tcp: Add optional TIME_WAIT support

Flavio Santes (11):
      net/mqtt: Move upwards buffer size validation
      net/mqtt: Simplify the MQTT high-level API
      net/mqtt: Add the "malformed" callback to the MQTT ctx structure
      net/mqtt: Validate null or app level zero-length rx buffers
      net/mqtt: Add the MQTT Publisher sample application
      net/mqtt: Remove redundant line
      samples/net/dns: Add the FRDM_K64F board to the testcase.ini file
      samples/net/dns: Move conf variables to config.h and delete unused defines
      samples/net/dns: Improve network configuration
      samples/net/dns: Update README file
      samples/net/http: Add the HTTP server sample application

Jorge Ramirez-Ortiz (1):
      net/mqtt: Check function return value

Jukka Rissanen (16):
      net: tcp: Call connect callback later
      net: Increasing the default number of network contexts
      samples: zperf: Use native IP stack for TCP support
      samples: zperf: Enable TCP for zperf configuration
      doc: net: Migrate from Zephyr 1.6 to 1.7
      net: nbuf: Removing dead code from net_nbuf_compact()
      net: tests: Add unit tests for net_nbuf_compact()
      tests: net: rpl: Fix unicast NS sending
      tests: net: Add tests for network interface
      net: nbuf: Do no use timeout if called from isr
      net: stats: Collect bytes sent and received
      net: ipv6: Use the nexthop when sending the packet
      samples: net: zperf: Initialize address family properly
      samples: net: zperf: Fix udp.upload command
      samples: net: zperf: Fix compiler warnings
      samples: net: zperf: Set the proper UDP payload

Julien Chevrier (1):
      net: iface: Fix bad comparisons in net_if

Kumar Gala (1):
      net: ip: stat: fix typo in rpl.dio.sent stat

Leandro Pereira (1):
      samples: net: Add IRC bot example

Luiz Augusto von Dentz (5):
      net: bt: Fix failing to resolve link-local address
      net: Add ll addresses on net_if_send_data
      net: Introduce NET_IF_POINTOPOINT flag
      net: bt: Add Kconfig to interoperate with Linux
      net: samples: Add CONFIG_NET_L2_BLUETOOTH_ZEP1656

Michael Scott (24):
      net: correct in*_addr parameter of net_addr_pton()
      samples: net: irc_bot: run sample process as a thread
      samples: net: irc_bot: establish privmsg callback typedef
      samples: net: irc_bot: release net_context reference upon error
      samples: net: irc_bot: remove unneeded typecasts and extra var
      samples: net: irc_bot: add helper function in_addr_set()
      samples: net: irc_bot: remove sockaddr globals
      samples: net: irc_bot: make panic() more accessible
      samples: net: irc_bot: use #defines for server and port
      samples: net: irc_bot: make some functions more accessible
      samples: net: irc_bot: simplify connect path
      samples: net: irc_bot: expand some char buffers
      samples: net: irc_bot: fix null pointer deref
      samples: net: irc_bot: use irc parameter's connection
      samples: net: irc_bot: dont hardcode NET_SYS_LOG_LEVEL
      samples: net: irc_bot: modify disco check in on_context_recv()
      samples: net: irc_bot: create semi-unique IRC user names
      samples: net: irc_bot: handle messages across multiple fragments
      samples: net: irc_bot: add Linaro copyright
      samples: net: irc_bot: add FRDM K64F project .conf
      samples: net: irc_bot: add IPv4 support
      samples: net: irc_bot: add DNS support
      samples: net: irc_bot: add DHCPv4 support
      net: tcp: Only return -ETIMEDOUT if timeout!=0 in connect

Paul Sokolovsky (1):
      net: echo_server: Enable TCP for frdm_k64f

Ravi kumar Veeramally (5):
      net: tests: Add unit tests for net_addr_pton() utils function
      net: utils: Add net_addr_ntop() helper function
      net: tests: Add unit tests for net_addr_ntop() utils function
      net: context: Skip reserved ports
      net: context: Assign a random port number when context is created

Sergio Rodriguez (1):
      driver: ethernet: Fix typo on enc28j60 driver Kconfig

Tomasz Bursztyka (10):
      samples/net: Fix a tiny mistake in dhcpv4_client README.rst
      samples/net: Add a simple telnet sample
      doc: Include main Network APIs doxygen documentation
      doc/api/networking: Add existing network protocol libraries APIs
      net/ieee802154: Set IEEE extended address whatever runtime mode it is
      net/ieee802154: Setting short address is about local node
      net/ieee802154/mgmt: Add getters/setters for various radio network info
      net/ieee802154/shell: Add commands to set/get radio network info
      net/ieee802154: Fixing active scan buffer reference counting
      net/ipv6: Updating ll reserve should be done for all IPv6 packet.

Vinicius Costa Gomes (5):
      samples/zoap_server: Enable support for 802.15.4
      samples/zoap_server: Allow overriding the BOARD variable
      samples/zoap_server: Add a 802.15.4 case to the test suite
      iot/zoap: Fix the return value of zoap_packet_get_payload()
      samples/zoap_server: Fix errors for GET requests without payloads

 .known-issues/doc/networking.conf                |  49 ++
 doc/api/api.rst                                  |   1 +
 doc/api/networking.rst                           |  66 ++
 doc/subsystems/networking/ip-stack-migrate.rst   |  61 ++
 doc/subsystems/networking/networking.rst         |  61 +-
 doc/subsystems/networking/overview.rst           |  58 ++
 doc/subsystems/networking/qemu_setup.rst         | 158 ++++
 drivers/ethernet/Kconfig.enc28j60                |   2 +-
 include/net/dhcpv4.h                             |  10 +
 include/net/dns_client.h                         |  10 +
 include/net/ieee802154.h                         |  33 +-
 include/net/mqtt.h                               |  74 +-
 include/net/mqtt_types.h                         |  10 +
 include/net/net_context.h                        |  79 +-
 include/net/net_if.h                             |  20 +
 include/net/net_ip.h                             |  28 +-
 include/net/net_mgmt.h                           |  11 +
 include/net/net_stats.h                          |  17 +
 include/net/zoap.h                               |  15 +-
 include/net/zoap_link_format.h                   |  10 +
 samples/bluetooth/ipsp/prj.conf                  |   1 +
 samples/bluetooth/ipsp/src/main.c                |   2 +-
 samples/net/coaps_client/README.rst              |   4 -
 samples/net/coaps_client/src/udp.c               |   2 +-
 samples/net/coaps_server/README.rst              |   1 -
 samples/net/coaps_server/src/coaps_server.c      |   2 +-
 samples/net/dhcpv4_client/README.rst             |  19 +-
 samples/net/dns_client/README.rst                |  44 +-
 samples/net/dns_client/prj_arduino_101.conf      |  11 +-
 samples/net/dns_client/prj_frdm_k64f.conf        |  10 +-
 samples/net/dns_client/prj_qemu_x86.conf         |  10 +-
 samples/net/dns_client/src/config.h              |  29 +-
 samples/net/dns_client/src/main.c                | 170 ++--
 samples/net/dns_client/testcase.ini              |   2 +-
 samples/net/echo_client/src/echo-client.c        |   8 +-
 samples/net/echo_server/prj_bt.conf              |   1 +
 samples/net/echo_server/prj_frdm_k64f.conf       |   1 +
 samples/net/echo_server/src/echo-server.c        |   4 +-
 samples/net/http_server/Makefile                 |  13 +
 samples/net/http_server/README.rst               | 232 ++++++
 samples/net/http_server/prj_frdm_k64f.conf       |  29 +
 samples/net/http_server/src/Makefile             |  10 +
 samples/net/http_server/src/config.h             |  28 +
 samples/net/http_server/src/http_server.c        | 409 ++++++++++
 samples/net/http_server/src/http_server.h        |  51 ++
 samples/net/http_server/src/http_types.h         |  98 +++
 samples/net/http_server/src/http_utils.c         |  51 ++
 samples/net/http_server/src/http_utils.h         |  18 +
 samples/net/http_server/src/http_write_utils.c   | 183 +++++
 samples/net/http_server/src/http_write_utils.h   |  63 ++
 samples/net/http_server/src/main.c               | 142 ++++
 samples/net/http_server/testcase.ini             |   4 +
 samples/net/irc_bot/Makefile                     |  24 +
 samples/net/irc_bot/prj_frdm_k64f.conf           |  36 +
 samples/net/irc_bot/prj_qemu_x86.conf            |  33 +
 samples/net/irc_bot/src/Makefile                 |   1 +
 samples/net/irc_bot/src/irc-bot.c                | 940 +++++++++++++++++++++++
 samples/net/mbedtls_dtlsclient/README.rst        |   4 -
 samples/net/mbedtls_dtlsclient/src/dtls_client.c |   4 +-
 samples/net/mbedtls_dtlsclient/src/udp.c         |   4 +-
 samples/net/mbedtls_dtlsserver/README.rst        |   1 -
 samples/net/mbedtls_dtlsserver/src/dtls_server.c |   4 +-
 samples/net/mqtt_publisher/Makefile              |  14 +
 samples/net/mqtt_publisher/README.rst            | 236 ++++++
 samples/net/mqtt_publisher/prj_frdm_k64f.conf    |  36 +
 samples/net/mqtt_publisher/src/Makefile          |   8 +
 samples/net/mqtt_publisher/src/config.h          |  37 +
 samples/net/mqtt_publisher/src/main.c            | 410 ++++++++++
 samples/net/mqtt_publisher/testcase.ini          |   4 +
 samples/net/net.rst                              |   1 -
 samples/net/qemu_setup.rst                       |  31 -
 samples/net/telnet/Makefile                      |  14 +
 samples/net/telnet/README.rst                    | 137 ++++
 samples/net/telnet/prj_frdm_k64f.conf            |  44 ++
 samples/net/telnet/prj_qemu_x86.conf             |  43 ++
 samples/net/telnet/prj_qemu_x86_iamcu.conf       |  43 ++
 samples/net/telnet/src/Makefile                  |   2 +
 samples/net/telnet/src/telnet.c                  | 150 ++++
 samples/net/telnet/testcase.ini                  |   5 +
 samples/net/zoap_client/prj_bt.conf              |   1 +
 samples/net/zoap_server/Makefile                 |   2 +-
 samples/net/zoap_server/README.rst               |   7 +
 samples/net/zoap_server/prj_bt.conf              |   1 +
 samples/net/zoap_server/prj_cc2520.conf          |  15 +
 samples/net/zoap_server/src/zoap-server.c        |  30 +-
 samples/net/zoap_server/testcase.ini             |   6 +
 samples/net/zperf/README.rst                     |  38 +-
 samples/net/zperf/prj_bt.conf                    |   1 +
 samples/net/zperf/prj_frdm_k64f.conf             |   2 +-
 samples/net/zperf/src/zperf.h                    |   1 +
 samples/net/zperf/src/zperf_internal.h           |   1 +
 samples/net/zperf/src/zperf_shell.c              | 141 +++-
 samples/net/zperf/src/zperf_tcp_receiver.c       | 282 +++++--
 samples/net/zperf/src/zperf_tcp_uploader.c       |  89 ++-
 samples/net/zperf/src/zperf_udp_uploader.c       |  28 +-
 subsys/net/ip/Kconfig                            |  14 +-
 subsys/net/ip/ipv6.c                             | 106 ++-
 subsys/net/ip/l2/Kconfig                         |  11 +
 subsys/net/ip/l2/bluetooth.c                     |  41 +-
 subsys/net/ip/l2/ethernet.c                      |  63 +-
 subsys/net/ip/l2/ieee802154/ieee802154.c         |  24 +-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c    |  80 +-
 subsys/net/ip/l2/ieee802154/ieee802154_shell.c   | 101 +++
 subsys/net/ip/nbuf.c                             |  19 +-
 subsys/net/ip/net_context.c                      | 467 +++++------
 subsys/net/ip/net_core.c                         |  12 +-
 subsys/net/ip/net_if.c                           |  45 +-
 subsys/net/ip/net_private.h                      |  25 +-
 subsys/net/ip/net_shell.c                        |  11 +-
 subsys/net/ip/net_stats.c                        |  11 +-
 subsys/net/ip/net_stats.h                        |  12 +
 subsys/net/ip/tcp.c                              |  65 +-
 subsys/net/ip/tcp.h                              |  11 +-
 subsys/net/ip/utils.c                            |  44 +-
 subsys/net/lib/mqtt/mqtt.c                       |  53 +-
 subsys/net/lib/zoap/zoap.c                       |   7 +-
 tests/net/iface/Makefile                         |   4 +
 tests/net/iface/prj.conf                         |  22 +
 tests/net/iface/src/Makefile                     |   4 +
 tests/net/iface/src/main.c                       | 376 +++++++++
 tests/net/iface/testcase.ini                     |   4 +
 tests/net/nbuf/src/main.c                        | 172 +++++
 tests/net/rpl/src/main.c                         |  18 +-
 tests/net/utils/src/main.c                       | 377 ++++++++-
 124 files changed, 6560 insertions(+), 975 deletions(-)
 create mode 100644 .known-issues/doc/networking.conf
 create mode 100644 doc/api/networking.rst
 create mode 100644 doc/subsystems/networking/ip-stack-migrate.rst
 create mode 100644 doc/subsystems/networking/overview.rst
 create mode 100644 doc/subsystems/networking/qemu_setup.rst
 create mode 100644 samples/net/http_server/Makefile
 create mode 100644 samples/net/http_server/README.rst
 create mode 100644 samples/net/http_server/prj_frdm_k64f.conf
 create mode 100644 samples/net/http_server/src/Makefile
 create mode 100644 samples/net/http_server/src/config.h
 create mode 100644 samples/net/http_server/src/http_server.c
 create mode 100644 samples/net/http_server/src/http_server.h
 create mode 100644 samples/net/http_server/src/http_types.h
 create mode 100644 samples/net/http_server/src/http_utils.c
 create mode 100644 samples/net/http_server/src/http_utils.h
 create mode 100644 samples/net/http_server/src/http_write_utils.c
 create mode 100644 samples/net/http_server/src/http_write_utils.h
 create mode 100644 samples/net/http_server/src/main.c
 create mode 100644 samples/net/http_server/testcase.ini
 create mode 100644 samples/net/irc_bot/Makefile
 create mode 100644 samples/net/irc_bot/prj_frdm_k64f.conf
 create mode 100644 samples/net/irc_bot/prj_qemu_x86.conf
 create mode 100644 samples/net/irc_bot/src/Makefile
 create mode 100644 samples/net/irc_bot/src/irc-bot.c
 create mode 100644 samples/net/mqtt_publisher/Makefile
 create mode 100644 samples/net/mqtt_publisher/README.rst
 create mode 100644 samples/net/mqtt_publisher/prj_frdm_k64f.conf
 create mode 100644 samples/net/mqtt_publisher/src/Makefile
 create mode 100644 samples/net/mqtt_publisher/src/config.h
 create mode 100644 samples/net/mqtt_publisher/src/main.c
 create mode 100644 samples/net/mqtt_publisher/testcase.ini
 delete mode 100644 samples/net/qemu_setup.rst
 create mode 100644 samples/net/telnet/Makefile
 create mode 100644 samples/net/telnet/README.rst
 create mode 100644 samples/net/telnet/prj_frdm_k64f.conf
 create mode 100644 samples/net/telnet/prj_qemu_x86.conf
 create mode 100644 samples/net/telnet/prj_qemu_x86_iamcu.conf
 create mode 100644 samples/net/telnet/src/Makefile
 create mode 100644 samples/net/telnet/src/telnet.c
 create mode 100644 samples/net/telnet/testcase.ini
 create mode 100644 samples/net/zoap_server/prj_cc2520.conf
 create mode 100644 tests/net/iface/Makefile
 create mode 100644 tests/net/iface/prj.conf
 create mode 100644 tests/net/iface/src/Makefile
 create mode 100644 tests/net/iface/src/main.c
 create mode 100644 tests/net/iface/testcase.ini

Change-Id: Ie477c0aed33d281319afa27c10ec7d42a84346b8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 16:13:42 +02:00
Tomasz Bursztyka
93ed88a670 net/ipv6: Updating ll reserve should be done for all IPv6 packet.
Doing it only in net_context, prevented to do it once NS succesfully
finished. This generated an error in 15.4, where pending data had wrong
ll reserve size.

Change-Id: I0f917fb76171457e5dff2c29e44edb8f00662150
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
2612b04d80 samples: net: zperf: Set the proper UDP payload
Use a static buffer for sending UDP payload instead of reading
values from memory.

Change-Id: I037db5cd9b8784966d481c36e8cbe92d19760475
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
517fb19586 samples: net: zperf: Fix compiler warnings
Compiler was giving "Unused variables" warnings if IPv6 was
enabled and IPv4 was not, and vice versa.

Change-Id: I3b17534bb8bdef207512ea5b618e138edb420871
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
47685ef71f samples: net: zperf: Fix udp.upload command
The IP address and port number were incorrectly parsed if
user used udp.upload command.

Change-Id: Ib37d481012af5e186a1e342c92d10ddef9fe35b1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
1ec6038c48 samples: net: zperf: Initialize address family properly
The IP address family was not set correctly when setting up
the connection. This lead to connectivity error in udp.upload
command.

Change-Id: I598ff2675f97e10e2033763a497f7583c94f3840
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
1301d3f6d3 net: ipv6: Use the nexthop when sending the packet
We must use the nexthop instead of destination address
when sending the packet. The current code mixed destination
and nexthop addresses and ignored the nexthop when sending
neighbor solicitation message.

Change-Id: I53887c16ef6fcf8365f1f47ab5792cb208dd273e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Flavio Santes
53e9245b33 samples/net/http: Add the HTTP server sample application
Add the HTTP server sample application on top of the
HTTP Parser Library.

This sample application is based on TCP and HTTP chunk
transfer code found at:

https://gerrit.zephyrproject.org/r/#/c/9977/

A README file with sample output and a detailed
description of this application is also provided.

Jira: ZEP-820
Jira: ZEP-1542
Jira: ZEP-1556

Change-Id: I649104a256190577000bbac118136d5bc21f83bf
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:20 +02:00
Jukka Rissanen
6930f93fd3 net: stats: Collect bytes sent and received
Keep track of amount of bytes that are sent or received from
all network interfaces.

Change-Id: I706481aab1a7e0cf2bc78d032f2ef4ebbabe3184
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:20 +02:00
Ravi kumar Veeramally
df201a0e4b net: context: Assign a random port number when context is created
Current behaviour has an issue when UDP context is created with local
port number 0, net_conn_input() happens to treat zero port as
a wildcard ("receive packets for all ports"). net_context_bind()
for a UDP context doesn't affect its existing connection in any way.

Proposed solution is, context should be created with a random free
port assigned and bind() updates connection information from context.

Jira: ZEP-1644

Change-Id: Idb3592b58c831d986763312077b0dcdd95850bc9
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:20 +02:00
Ravi kumar Veeramally
f6c8b0b89a net: context: Skip reserved ports
The port numbers in the range from 0 to 1023 are the well-known ports
or system ports. Do not allocate them for users.

Change-Id: I4d7b4e1314759e4d8b260669946b9880282642c0
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:20 +02:00
Tomasz Bursztyka
3aa6b21c07 net/ieee802154: Fixing active scan buffer reference counting
Commit-ID 83ed3a29be changed the way
fragments are managed after being sent, and this brought a bug in the
active scan logic. Up to active scan to keep the buffer referenced
relevantly now, which is simpler than it used to be.

Reported-by: Johann Fischer <j.fischer@phytec.de>

Change-Id: I23db4bab878328b1ca3cb313e737de819177c281
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:20 +02:00
Luiz Augusto von Dentz
e89aebc4d5 net: samples: Add CONFIG_NET_L2_BLUETOOTH_ZEP1656
This enables these samples to interoperate with Linux 6LoWPAN over
Bluetooth implementation while that is being fixed, in the long term
we might remove it from the samples once Linux is fixed.

Jira: ZEP-1656

Change-Id: I8ca9fe5a27f43cebc75b6fe5a436a5e8fcee26d5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-03 15:59:20 +02:00
Luiz Augusto von Dentz
affcac5a2d net: bt: Add Kconfig to interoperate with Linux
This adds a NET_L2_BLUETOOTH_ZEP1656 which sets NET_IF_POINTOPOINT to
avoid using nbr cache with Linux peers as they send wrong link
addresses.

Jira: ZEP-1656

Change-Id: I842f4cbb99ae9d9c004494739c07189c191929fe
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-03 15:59:19 +02:00
Luiz Augusto von Dentz
2c1bef4d09 net: Introduce NET_IF_POINTOPOINT flag
This flag can be used by driver to indicate pointopoint links which should
not require destination link address to be resolved.

Jira: ZEP-1656

Change-Id: I58dd3bf48485d6203e75373497e00668317b9825
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-03 15:59:19 +02:00
Flavio Santes
20bf36601b samples/net/dns: Update README file
The DNS client sample application was updated to use IP addresses
from the prj_*.conf files. This patch updates the README file to
reflect those changes.

Change-Id: Ic72510be8da208aef19fb188560221e1c2386457
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:19 +02:00
Anas Nashif
3c8000cca5 doc: net: restructure networking documentation
Change-Id: Ic5dd009f0e890fa152e92e6c96b6a76b4a3df5a9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 15:59:19 +02:00
Anas Nashif
9051e1ab1d doc: net: use Qemu setup section in current documentation
Fix references to Qemu section and references to boards.

Change-Id: Ib2174ff698d57d3272073eecc71209e047961aaa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 15:59:19 +02:00
Anas Nashif
f75462984f doc: update networking with Qemu section
Copy the documentation from the Wiki over here, the cross linking
between online documentation and Wiki and duplication of information was
inconsistent and confusing. Put everything in one place.

Change-Id: Ia3aaec1b431477e2ec54dbec2ccaa655870b0ee3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 15:59:19 +02:00
Jukka Rissanen
16d8f59c83 net: nbuf: Do no use timeout if called from isr
The net_nbuf_get*() functions were calling net_buf_alloc()
with K_FOREVER. This can cause issue if called from isr
context. The fix is to check if we are in isr and then try
to alloc net_buf with K_NO_WAIT.

Change-Id: I809170f2cd059480d436763e19a35386d9bdf048
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:19 +02:00
Vinicius Costa Gomes
88405fcd17 samples/zoap_server: Fix errors for GET requests without payloads
It doesn't really make sense for GET requests to have payloads, we
shouldn't even be checking if they have any payloads.

Change-Id: I4bb8cccd6c733a5825c2ca5067a990937c7045a6
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-03 15:59:19 +02:00
Vinicius Costa Gomes
2d852f47d2 iot/zoap: Fix the return value of zoap_packet_get_payload()
The returning 'len' was always informing the remaining available space
in that net_buf fragment. This not the expected behaviour for
incoming packets, in this case, we really want the size for the
payload already present in the packet.

When this function is called with a packet without a payload, with
will return the available space in the packet, when the payload is
already set, it will return the size of that payload.

Change-Id: Ia4643b8c2a015ad2316bed037e457b186e420b19
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-03 15:59:19 +02:00
Tomasz Bursztyka
55751eed47 net/ieee802154/shell: Add commands to set/get radio network info
Channel, PAN-ID, short and extended address

Change-Id: Icdf94dff6f59cd155a072a609290197b37bd084c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:19 +02:00
Tomasz Bursztyka
f2872e60ad net/ieee802154/mgmt: Add getters/setters for various radio network info
Channel, pan-id, short and extended addresses.

Change-Id: Ib63dadac37d649df3efc8fdd67f5312d3a7c8e20
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:19 +02:00
Tomasz Bursztyka
2e5de5b44c net/ieee802154: Setting short address is about local node
Fix setting short address through net mgmt API. It's not about
coordinator's short address, but local one.

Change-Id: I320143e40d336a1085bf12b17a88a2c35da83504
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:19 +02:00
Tomasz Bursztyka
8d7eb6ed2b net/ieee802154: Set IEEE extended address whatever runtime mode it is
ORFD or RFD does not matter: the extended address should be set
according to device's MAC address.

Change-Id: I39d09c3a953283eeaa30b908ea159638604bd72b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:18 +02:00
Jukka Rissanen
cc8eb4144b tests: net: Add tests for network interface
Change-Id: I35f0b3f1794c65b08d32ca561b6189ee59a7a76c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
76785f0bcd samples/net/dns: Improve network configuration
- Reorganize some CONF variables and add the CONFIG_NET_SAMPLES_xxx
  variables to the DNS sample application.
- Remove all the numeric IP addresses
- Use the CONFIG_NET_SAMPLES_xxx variables to define the IP addresses

Change-Id: Ib294d338f163f03ea1b47143b489d916578c532d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
3a05189284 samples/net/dns: Move conf variables to config.h and delete unused defines
- Move the MAX_ADDRESSES macro to config.h.
  Document the meaning and usage of this macro

- Delete unused defines

Change-Id: I035feb605611e564db15cba77d6a3dce8409ca18
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
660b0324e0 samples/net/dns: Add the FRDM_K64F board to the testcase.ini file
Add the FRDM_K64F board to the DNS sample app testcase.ini

Change-Id: Iea8f7d09ed0d793711a5807f4bb67ed35ebf52c1
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Tomasz Bursztyka
12a0f71711 doc/api/networking: Add existing network protocol libraries APIs
DHCPv4, MQTT, DNS client, ...

Change-Id: I5c5d7437bb53610678eba38d307c86694ac01da9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
32eb764959 net/mqtt: Remove redundant line
Delete redundant line and let the common exit point to release
the buffers.

Change-Id: I97e0ef79803083fabd841fb3d38d67c04ff31f7b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
59b1384885 net/mqtt: Add the MQTT Publisher sample application
This commit adds the MQTT Publisher sample application for Zephyr.

The following MQTT API routines are exercised in this sample:

- mqtt_init
- mqtt_tx_connect
- mqtt_tx_pingreq
- mqtt_tx_publish
- mqtt_tx_disconnect

The following MQTT API data structures are used in this application:

- struct mqtt_ctx
- struct mqtt_connect_msg
- struct mqtt_publish_msg

This sample application exemplifies how to send MQTT PUBLISH messages
with different QoS values.

A README file is also included in this patch.

Change-Id: I2b41b276d5178a2cd1b07b031c38bff481885fff
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
02bd8411dc net/mqtt: Validate null or app level zero-length rx buffers
Don't try to process null or zero-length buffers generated by
the IP stack. Zero-length buffers are valid at the TCP layer but
contain no information for applications.

Change-Id: If66d301527f56ca8e8761789b7fd6931fc37b8e0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
9e6a6f3bce net/mqtt: Add the "malformed" callback to the MQTT ctx structure
Add the malformed callback that will be executed when a message
is received and it does not follow the MQTT v3.1.1 spec.

There is another case when this callback may be executed: when
the IP stack reception buffer's size is not enough to hold an
MQTT message.

The publisher and subscriber parser routines are updated to make
use of this callback. Inline documentation is also updated.

Change-Id: Id1d34336c4322673ca85f2db0b8d432db3c9afa8
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
4a17932d6a net/mqtt: Simplify the MQTT high-level API
1) Remove some variables pointing to user-provided data.
2) Pass the context structure instead of those variables.
3) Homogenize the use of "ctx" for all the callbacks receiving the
   struct mqtt_ctx * pointer.

Now users must use the CONTAINER_OF macro to access data required
by the MQTT callbacks.

Change-Id: I871c0bd8601a67b39187683215579f9ed0087cf9
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Flavio Santes
db6fda8835 net/mqtt: Move upwards buffer size validation
Although the buffer size validation works as it is inside the
mqtt_linearize_buffer routine, let's move it before getting a
data buffer from the buffer poll.

Change-Id: Id80af8a1e188929769463b04deaef3956b63cd00
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-03 15:59:18 +02:00
Luiz Augusto von Dentz
a94f179252 net: Add ll addresses on net_if_send_data
This makes sure ll addresses are properly set before sending reducing the
duplicated code on L2 drivers.

Change-Id: I5330c1d00a344e77555c6f31033ae42af20214bf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-03 15:59:17 +02:00
Julien Chevrier
6aae825a2d net: iface: Fix bad comparisons in net_if
Fix comparisons in net_if_get_by_index and net_if_get_by_iface:
__net_if_end is not a pointer to a net_if structure.

Change-Id: Ie8e3a457c3f0fa97c080b38b5b7d2b420c50252b
Signed-off-by: Julien Chevrier <julien.chevrier@intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
3c95a56c2a tests: net: rpl: Fix unicast NS sending
If we send unicast NS, then the destination IPv6 address needs
to be in the neighbor cache, otherwise we have a NS sending loop.

Change-Id: I11e8f5d5740248024a0becc77055786cd2e32199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
6b069f1589 net: tests: Add unit tests for net_nbuf_compact()
The compact function was never really properly tested
but it is used by other routines that have unit tests.
This commit makes sure there is a special testing for
the buffer compact function.

Change-Id: I35c108fd8459a9482ccae68a51ffa28fb2e0ae99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
d6cc2c9a36 net: nbuf: Removing dead code from net_nbuf_compact()
There is dead code that is never executed so removing it.

Coverity-CID: 157585

Change-Id: I6926289b5735b78fcb99ad493d1b05198b9e36cc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Tomasz Bursztyka
d8323e1a6c doc: Include main Network APIs doxygen documentation
Added missing dogygen definitions.

Jira: ZEP-1495

Change-Id: Ibc087f3f174b8af45b0726c0d82b77feff36d4e3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
cfff5ca126 doc: net: Migrate from Zephyr 1.6 to 1.7
This document describes the changes in Zephyr 1.7 networking
stack compared to Zephyr 1.6. This document is a high level
description of the changes between these two major Zephyr releases.
For individual changes, the application developer can find more
details in the network header file documentation in include/net/*.

Change-Id: I281d670bee0c08e07c28fc423157ddb3f2bec8f1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
cc9ec3488f samples: zperf: Enable TCP for zperf configuration
Change-Id: I0154c6d890a3bff5be2cad5ea621660bf46a158d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen
48b9b96d3f samples: zperf: Use native IP stack for TCP support
Enable zperf code to support TCP using the native IP stack
when testing the network throughput.

Change-Id: I3e58754cfff65525ad15e63adf57f1ea22e4559d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Michael Scott
56afb1065a net: tcp: Only return -ETIMEDOUT if timeout!=0 in connect
Previous commit: 6e6281af96
"net: tcp: Only return -ETIMEDOUT if timeout>0 in connect"
missed that K_FOREVER needs a semaphore taken, but has a
value of -1.

Change the logic here to timeout!=0 to handle this case.

Change-Id: Iae6a784443810130a7de267226483426fbd4f0d4
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-02-03 15:59:17 +02:00
Michael Scott
1a21a36b7e samples: net: irc_bot: add DHCPv4 support
When CONFIG_NET_DHCPV4 is selected, ignore the CONFIG_NET_SAMPLES_MY_IPV4_ADDR
setting and instead used DHCPv4.

NOTE: This commit also adds a placeholder for DHCPv6 behavior which is not
yet functional.

Change-Id: Id31fcb99be46e966babf18f94b5dec151920dedc
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-02-03 15:59:17 +02:00