Commit graph

19237 commits

Author SHA1 Message Date
Anas Nashif
43b9e7dfe1 net: doc: add section about networking with qemu
Change-Id: I478231b6932c379201deaf4e1ca9ff57b43bd05f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-16 14:04:20 -05:00
Bogdan Davidoaia
d4efb9a21f samples: thermometer: use convert to double function from sensor.h
Remove the convert_to_double function and use sensor_value_to_double
from sensor.h.

Change-Id: I92ef4219057f431917f4c8e9d46d4ee2074b423b
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-16 13:15:14 +00:00
Bogdan Davidoaia
3a95ae158f MAINTAINERS: fix email address typo in sensor drivers section
Change-Id: I8b5118748cafa33f58126662f68406b18ae16733
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-16 13:55:53 +02:00
Bogdan Davidoaia
30162aedf1 sensor: remove sensor value type
Remove the type field from the sensor value structure. All values will
have the type previously defined by SENSOR_VALUE_TYPE_INT_PLUS_MICRO.

This simplifies the interface, as apps will know what value type to
expect. Apps that prefer to use double values can optain them using the
sensor_value_to_double function.

Change-Id: I3588d74258030eb16c3f89d8eead13cca4606b18
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-15 01:09:33 +00:00
Anas Nashif
662a2d6476 Merge "Merge net branch into master" 2017-01-14 13:11:34 +00:00
Benjamin Walsh
7ddec7b471 tests: add test for k_timer_user_data_set/get()
Change-Id: I1baaa4d1a4c1626b3acdbeb4b0bfe58c9b8fff0c
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-14 13:06:01 +00:00
Benjamin Walsh
e4e98f9d7b kernel: add user data API to timers
Similar to what was available with nano timers in the original kernel,
allow a user to associate opaque data with a timer.

Fix for ZEP-1558.

Change-Id: Ib8cf998b47988da27eba4ee5cd2658f90366b1e4
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-14 13:06:00 +00:00
Anas Nashif
bfcdfaf941 sanitycheck: riscv: add vector to recognised sections
Change-Id: I7f1692eb1bd51b8efc16919780aebaf890b8872c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-13 20:00:16 +00:00
Jean-Paul Etienne
d65dae20e3 tests: kernel: threads_scheduling: increased stack size to 512 for riscv32 architecture
Otherwise, not passing sanitycheck

Change-Id: I6dba149750a7d4266fd52851f7e0b139efdba210
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 20:00:00 +00:00
Jean-Paul Etienne
142e3cb0f3 tests: legacy: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I2faa823226cd76d129d2bc3db961c9b862aaf784
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:44 +00:00
Jean-Paul Etienne
fa12f10196 tests: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I43a5c5112d694efdc14c5a0bcb4cafdc196d2680
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:30 +00:00
Jean-Paul Etienne
c8c1be485f boards: added support for the zedboard_pulpino board
zedboard_pulpino
1) has a 16750 uart, which is compatible with the uart_ns16550 driver.
2) make use of the pulpino timer driver

Change-Id: Ifda710fc8dea547ada05bb42e604d7cfdff284d5
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:58:27 +00:00
Jean-Paul Etienne
60030c9a80 boards: added support for the qemu_riscv32 board
The qemu_riscv32 board makes use of:
1) the uart_riscv_qemu driver
2) the riscv_qemu_timer driver

Change-Id: I413e3990a66bc62a0d15d82ebca6940b381fed43
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:58:09 +00:00
Jean-Paul Etienne
dae36b97e8 riscv32: added support for the riscv32-qemu soc
Change-Id: I7cf71f7a99fed7c83ed761ead9295697929d767d
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:57:51 +00:00
Anas Nashif
9f418fe944 libc: add support for risc v
Change-Id: Iaaf87ef48057c52478816771836d8d40b2b05554
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-13 19:57:19 +00:00
Jean-Paul Etienne
67dcd1b0b0 gpio: added support for the pulpino GPIO controller driver
tested with blinky, button and disco apps

Change-Id: I4b520d4f3e42c97e4a723747ce4a6c67ca9f1d18
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:57:03 +00:00
Jean-Paul Etienne
716d25e1e2 libc-hooks: added USED_RAM_SIZE and MAX_HEAP_SIZE definitions for riscv32
added USED_RAM_SIZE and MAX_HEAP_SIZE definitions for
SOC_RISCV32_QEMU and SOC_RISCV32_PULPINO.

Otherwise, not passing sanitycheck

Change-Id: Ia32b12e1694dc472e9f7f9eb10c5f2e12e928c3a
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:56:44 +00:00
Jean-Paul Etienne
7cf3688740 serial: added support for the riscv-qemu UART driver
riscv-qemu UART:
1) comprises only one register that is used to send or
   receive characters in a polling fashion.
2) does not have a FIFO and is not interrupt-driven.

Change-Id: I9408f1776eba4cec4aa203a5da759ec04bcddf1f
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:56:24 +00:00
Jean-Paul Etienne
23cef9e655 timer: added support for the riscv-qemu timer driver
The riscv-qemu timer driver does not implement
TICKLESS_IDLE

Change-Id: I3eeb5abb05b3f16b55ab9343c2045295b3010cfd
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:56:09 +00:00
Jean-Paul Etienne
ec76a4bb63 timer: added timer driver for the pulpino SOC
The pulpino_timer driver does not implement TICKLESS_IDLE
for the time being.

Change-Id: I0cce8c8a7e203d551a924863462e6c86af4c98ff
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:55:50 +00:00
Jean-Paul Etienne
2a8cfca4cf riscv32: added support for the pulpino soc
pulpino soc has custom-extended riscv ISA that is accounted
for if CONFIG_RISCV_GENERIC_TOOLCHAIN is not set.
(ex: bit manipulation asm opcodes)

Change-Id: I4dafc4ebc2fedcc4eb6a3dedd0412816afea6004
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:55:05 +00:00
Jean-Paul Etienne
c76abeeae5 kernel: updated default IDLE_STACK_SIZE to 512 for RISCV32
Default 256 bytes stack size for idle task is not enough, as
stack grows/shrinks by a multiple of 16-bytes in the
RISC-V architecture.

Increase it to 512 bytes for RISCV32 architecture

Change-Id: I8321c48e4c1a877b252ba5561f3cbdd1fe475fc7
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:54:35 +00:00
Jean-Paul Etienne
4c6ab7cfcd unified: added _MOVE_INSTR for RISCV32 architecture
added _MOVE_INSTR for RISCV32 architecture

The store instruction has a different syntax in RISC-V,
compared to the other architectures. Hence, for each
architecture, specify the entire load instruction within
the _MOVE_INSTR variable.

Change-Id: Iedc421e73411876abd8b698f7d4b46081b473d79
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:53:57 +00:00
Jean-Paul Etienne
cd83e85edc arch: added support for the riscv32 architecture
RISC-V is an open-source instruction set architecture.
Added support for the 32bit version of RISC-V to Zephyr.

1) exceptions/interrupts/faults are handled at the architecture
   level via the __irq_wrapper handler. Context saving/restoring
   of registers can be handled at both architecture and SOC levels.
   If SOC-specific registers need to be saved, SOC level needs to
   provide __soc_save_context and __soc_restore_context functions
   that shall be accounted by the architecture level, when
   corresponding config variable RISCV_SOC_CONTEXT_SAVE is set.

2) As RISC-V architecture does not provide a clear ISA specification
   about interrupt handling, each RISC-V SOC handles it in its own
   way. Hence, at the architecture level, the __irq_wrapper handler
   expects the following functions to be provided by the SOC level:
   __soc_is_irq: to check if the exception is the result of an
                 interrupt or not.
   __soc_handle_irq: handle pending IRQ at SOC level (ex: clear
                     pending IRQ in SOC-specific IRQ register)

3) Thread/task scheduling, as well as IRQ offloading are handled via
   the RISC-V system call ("ecall"), which is also handled via the
   __irq_wrapper handler. The _Swap asm function just calls "ecall"
   to generate an exception.

4) As there is no conventional way of handling CPU power save in
   RISC-V, the default nano_cpu_idle and nano_cpu_atomic_idle
   functions just unlock interrupts and return to the caller, without
   issuing any CPU power saving instruction. Nonetheless, to allow
   SOC-level to implement proper CPU power save, nano_cpu_idle and
   nano_cpu_atomic_idle functions are defined as __weak
   at the architecture level.

Change-Id: I980a161d0009f3f404ad22b226a6229fbb492389
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:52:23 +00:00
Jean-Paul Etienne
ba776a1fd1 scripts: added Makefile to handle an external riscv32 toolchain
Compiling Zephyr with an external riscv32 toolchain would
require the following env variables to be exported:

export ZEPHYR_GCC_VARIANT=riscv32
export RISCV32_TOOLCHAIN_PATH=/PATH/TO/TOOLCHAIN/BINARY

Change-Id: I2072ed9079a4cabd27837ab39b947bc0a0a1a8b4
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:52:22 +00:00
Tomasz Bursztyka
85a22063a8 Merge net branch into master
Main changes:

- Bluetooth L2 exposing net mgmt API and a dedicated shell module
- mbedtls DTLS client/server samples
- Bug fixes (mostly TCP, more to come soon)

----------------------------------------------------------------
Andy Ross (2):
      net: tcp: Signal EOF with a NULL buffer in the callback
      net: tcp: Don't leak net_conn_handles

Flavio Santes (6):
      samples/net: Remove legacy reference in Makefile
      samples/net: Update DNS logging info
      samples/net: Update zperf Makefile
      samples/net: Rename prj conf files to avoid breaking the build
      samples/net: Update the zperf/README.rst file
      samples/net: Update DNS client README file to RST format

Johann Fischer (4):
      ieee802154: conf: add common log level
      samples: ieee802154: rename cc2520 to hw
      net: ieee802154: fix validate_mac_command_cfi_to_mhr
      net: ieee802154: inform about unsupported frames

Kumar Gala (1):
      net: Remove NET_SLIP choice from Kconfig

Luiz Augusto von Dentz (13):
      net: mgmt: Make NET_MGMT_GET_* macros return meaningful values
      net: mgmt: Decode event fields
      net: echo_client: Fix using CONFIG_NETWORKING_WITH_BT
      net: echo_client: Don't start sending packets if interface is not UP
      net: bt: Fix not showing any logs
      net: bt: Add connect management command
      net: bt: Add shell support
      net: bt: Add scan management command
      net: bt: Add scan shell command
      net: bt: Add disconnect management command
      net: bt: Add disconnect shell command
      net: echo_client: Enable CONFIG_NET_L2_BLUETOOTH_SHELL in prj_bt.conf
      net: zoap_server: Enable connecting with bluetooth

Michael Scott (7):
      net: net_context: state setting is a value not individual bits
      net: tcp: replace seq/ack/wnd value shifts with system calls
      net: ip: on synack copy local/remote data prior to net_tcp_register
      net: ip: set local address family during TCP connect
      net: ip: set context state to NET_CONTEXT_CONNECTED on synack success
      net: ip: reword appdata debug message in packet_received
      net: ip: save TCP seq/ack values in tcp_synack_received

Sergio Rodriguez (5):
      samples/mbedtls_dtlsclient: Using printk instead of printf
      samples/mbedtls_dtlsclient: Change Readme files to rst format
      samples/mbedtls_dtlsclient: Remove hardcoded IP adresses
      samples/mbedtls_dtlsclient: IPv6 client version
      samples/mbedtls_dtlsserver DTLS server example app using mbedTLS

Tomasz Bursztyka (3):
      samples: net: Echo apps need different IP to be able to work
      net: mgmt: Silently ignore net_mgmt_event functions if not enabled
      samples: net: Fix dhcpv4 building with net mgmt event support

li zj (2):
      net: dhcpv4 : set ciaddr 0.0.0.0 when send DHCPV4_MSG_TYPE_REQUEST
      net: icmpv4 : calculate ipv4 header chksum

 drivers/ieee802154/Kconfig                                         |  57 ++--
 drivers/ieee802154/ieee802154_cc2520.c                             |   6 +-
 drivers/ieee802154/ieee802154_uart_pipe.c                          |   2 +-
 include/net/bt.h                                                   |  64 +++++
 include/net/net_context.h                                          |   9 +-
 include/net/net_mgmt.h                                             |   8 +-
 samples/net/README                                                 |  19 --
 samples/net/dhcpv4_client/prj_arduino_101.conf                     |   3 +
 samples/net/dhcpv4_client/prj_qemu_x86.conf                        |   1 -
 samples/net/dns_client/README.rst                                  | 231 ++++++++++++++++
 samples/net/dns_client/README_IPv4                                 | 187 -------------
 samples/net/dns_client/README_IPv6                                 |  74 ------
 samples/net/dns_client/README_arduino_101                          |  51 ----
 samples/net/dns_client/prj_qemu_x86.conf                           |   1 -
 samples/net/dns_client/sample_output_IPv4.txt                      |  46 ++++
 samples/net/dns_client/sample_output_IPv6.txt                      |  39 +++
 samples/net/dns_client/src/main.c                                  |   2 +-
 samples/net/echo_client/prj_arduino_101_cc2520.conf                |   2 +-
 samples/net/echo_client/prj_bt.conf                                |   3 +
 samples/net/echo_client/prj_cc2520.conf                            |   2 +-
 samples/net/echo_client/prj_frdm_k64f_cc2520.conf                  |   2 +-
 samples/net/echo_client/prj_qemu_802154.conf                       |   2 +-
 samples/net/echo_client/prj_qemu_x86.conf                          |   9 +-
 samples/net/echo_client/prj_slip.conf                              |   9 +-
 samples/net/echo_client/src/echo-client.c                          |  47 +++-
 samples/net/echo_server/prj_arduino_101_cc2520.conf                |   2 +-
 samples/net/echo_server/prj_cc2520.conf                            |   2 +-
 samples/net/echo_server/prj_frdm_k64f_cc2520.conf                  |   2 +-
 samples/net/echo_server/prj_qemu_802154.conf                       |   2 +-
 samples/net/echo_server/prj_qemu_x86.conf                          |   1 -
 samples/net/echo_server/prj_slip.conf                              |   1 -
 samples/net/echo_server/src/echo-server.c                          |   5 +
 samples/net/ieee802154/{cc2520 => hw}/Makefile                     |   0
 samples/net/ieee802154/{cc2520 => hw}/prj.conf                     |   2 +-
 samples/net/ieee802154/{cc2520 => hw}/src/Makefile                 |   0
 samples/net/ieee802154/{cc2520 => hw}/src/ieee802154_test.c        |   0
 samples/net/ieee802154/qemu/prj.conf                               |   2 +-
 samples/net/mbedtls_dtlsclient/README                              | 121 ---------
 samples/net/mbedtls_dtlsclient/README.rst                          | 136 ++++++++++
 .../{README_arduino_101 => README_arduino_101.rst}                 |  25 +-
 samples/net/mbedtls_dtlsclient/prj_qemu_x86.conf                   |   6 +-
 samples/net/mbedtls_dtlsclient/src/Makefile                        |   2 -
 samples/net/mbedtls_dtlsclient/src/dtls_client.c                   |  52 +++-
 samples/net/mbedtls_dtlsclient/src/udp.c                           | 125 ++++++++-
 samples/net/mbedtls_dtlsclient/src/udp_cfg.h                       |  30 +--
 samples/net/mbedtls_dtlsserver/Makefile                            |  24 ++
 samples/net/mbedtls_dtlsserver/README.rst                          | 144 ++++++++++
 samples/net/mbedtls_dtlsserver/prj_qemu_x86.conf                   |  22 ++
 samples/net/mbedtls_dtlsserver/src/Makefile                        |  17 ++
 samples/net/mbedtls_dtlsserver/src/dtls_server.c                   | 428 ++++++++++++++++++++++++++++++
 samples/net/mbedtls_dtlsserver/src/udp.c                           | 253 ++++++++++++++++++
 samples/net/mbedtls_dtlsserver/src/udp.h                           |  34 +++
 samples/net/mbedtls_dtlsserver/src/udp_cfg.h                       |  37 +++
 samples/net/mbedtls_dtlsserver/testcase.ini                        |   4 +
 samples/net/wpan_serial/prj.conf                                   |   2 +-
 samples/net/wpanusb/prj.conf                                       |   2 +-
 samples/net/zoap_client/prj.conf                                   |   1 -
 samples/net/zoap_server/Makefile                                   |   9 +-
 samples/net/zoap_server/prj.conf                                   |   1 -
 samples/net/zoap_server/prj_bt.conf                                |  18 ++
 samples/net/zoap_server/src/Makefile                               |   5 +
 samples/net/zoap_server/src/zoap-server.c                          |  22 +-
 samples/net/zoap_server/testcase.ini                               |   6 +
 samples/net/zperf/Makefile                                         |   1 -
 samples/net/zperf/README.rst                                       |  47 +++-
 samples/net/zperf/{prj_galileo_ethernet.conf => prj_galileo.conf}  |   0
 .../{prj_galileo_ethernet_prof.conf => prj_galileo_prof.conf}      |   0
 samples/net/zperf/prj_qemu_x86.conf                                |   1 -
 subsys/net/ip/Kconfig                                              |   2 +-
 subsys/net/ip/dhcpv4.c                                             |   7 +-
 subsys/net/ip/icmpv4.c                                             |   3 +
 subsys/net/ip/l2/Kconfig                                           |  21 +-
 subsys/net/ip/l2/Makefile                                          |   1 +
 subsys/net/ip/l2/bluetooth.c                                       | 247 ++++++++++++++++-
 subsys/net/ip/l2/bluetooth_shell.c                                 | 151 +++++++++++
 subsys/net/ip/l2/ieee802154/ieee802154_frame.c                     |   4 +-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c                      |   3 +
 subsys/net/ip/net_context.c                                        |  39 ++-
 subsys/net/ip/net_mgmt.c                                           |  10 +-
 subsys/net/ip/tcp.c                                                |  13 +-
 80 files changed, 2326 insertions(+), 645 deletions(-)
 create mode 100644 include/net/bt.h
 create mode 100644 samples/net/dns_client/README.rst
 delete mode 100644 samples/net/dns_client/README_IPv4
 delete mode 100644 samples/net/dns_client/README_IPv6
 delete mode 100644 samples/net/dns_client/README_arduino_101
 create mode 100644 samples/net/dns_client/sample_output_IPv4.txt
 create mode 100644 samples/net/dns_client/sample_output_IPv6.txt
 rename samples/net/ieee802154/{cc2520 => hw}/Makefile (100%)
 rename samples/net/ieee802154/{cc2520 => hw}/prj.conf (95%)
 rename samples/net/ieee802154/{cc2520 => hw}/src/Makefile (100%)
 rename samples/net/ieee802154/{cc2520 => hw}/src/ieee802154_test.c (100%)
 delete mode 100644 samples/net/mbedtls_dtlsclient/README
 create mode 100644 samples/net/mbedtls_dtlsclient/README.rst
 rename samples/net/mbedtls_dtlsclient/{README_arduino_101 => README_arduino_101.rst} (72%)
 create mode 100644 samples/net/mbedtls_dtlsserver/Makefile
 create mode 100644 samples/net/mbedtls_dtlsserver/README.rst
 create mode 100644 samples/net/mbedtls_dtlsserver/prj_qemu_x86.conf
 create mode 100644 samples/net/mbedtls_dtlsserver/src/Makefile
 create mode 100644 samples/net/mbedtls_dtlsserver/src/dtls_server.c
 create mode 100644 samples/net/mbedtls_dtlsserver/src/udp.c
 create mode 100644 samples/net/mbedtls_dtlsserver/src/udp.h
 create mode 100644 samples/net/mbedtls_dtlsserver/src/udp_cfg.h
 create mode 100644 samples/net/mbedtls_dtlsserver/testcase.ini
 create mode 100644 samples/net/zoap_server/prj_bt.conf
 rename samples/net/zperf/{prj_galileo_ethernet.conf => prj_galileo.conf} (100%)
 rename samples/net/zperf/{prj_galileo_ethernet_prof.conf => prj_galileo_prof.conf} (100%)
 create mode 100644 subsys/net/ip/l2/bluetooth_shell.c

Change-Id: Ia8dd7ec706dd128ba6af61390323554d5b7dc183
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-13 18:12:22 +01:00
Luiz Augusto von Dentz
fb5ea68762 net: zoap_server: Enable connecting with bluetooth
Change-Id: Iae05264f8677afb49c5060c13ad3e89c86c89929
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 17:05:53 +00:00
Johann Fischer
6b79ed0428 net: ieee802154: inform about unsupported frames
Be nice and inform user about unsupported and dropped frames.

Change-Id: Iaf0e7ed660a926c45dac9fc36b788c4c786eac11
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-01-13 14:38:59 +00:00
Luiz Augusto von Dentz
5ea0612f69 net: echo_client: Enable CONFIG_NET_L2_BLUETOOTH_SHELL in prj_bt.conf
This makes it possible to setup a Bluetooth connection using net_bt shell
commands.

Change-Id: Ie4ae7e61345315ef987a00b6b5a28c0419f6b1c8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:37:53 +00:00
Luiz Augusto von Dentz
8b185ecc50 net: bt: Add disconnect shell command
Change-Id: Ibb3a6e580751549ab5330296d6cd9f9cae4903ab
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:37:42 +00:00
Luiz Augusto von Dentz
e13a899280 net: bt: Add disconnect management command
This adds NET_REQUEST_BT_DISCONNECT which can be used to disconnect
IPSP in case it is connected.

Change-Id: I8da00b02ee08611bef5f4c0708936b2d31fd2a93
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:37:30 +00:00
Luiz Augusto von Dentz
1112c2d382 net: bt: Add scan shell command
Change-Id: Ieecf4e3ed91641582fe6a8e5512eb13fe3b8e76e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:37:13 +00:00
Luiz Augusto von Dentz
4eae48ee64 net: bt: Add scan management command
This adds NET_REQUEST_BT_SCAN which can be used to scan peripherals
advertising IPSS UUID.

Change-Id: I2463079d182b4da080e6ef94d883c7c1e24a454c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:37:04 +00:00
Luiz Augusto von Dentz
1bcd12d0d3 net: bt: Add shell support
This adds a shell module called "net_bt" that exposes Bluetooth L2
management commands.

Change-Id: Ia6da1d38cfd51502119758a8f6abbb6d1cd31743
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:36:42 +00:00
Luiz Augusto von Dentz
b434d0f50b net: bt: Add connect management command
Connect command can be used to initiate a connection, which in IPSP
terminology refer to a router role.

Change-Id: I12b9428924c88a9c68d3adbfe9016a0dd690aade
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:36:26 +00:00
Luiz Augusto von Dentz
348f46bf6e net: bt: Fix not showing any logs
Including logging/sys_log.h before net_core.h prevents SYS_LOG_LEVEL,
etc, to be set properly.

Change-Id: Iaa7aa98110aa455162836be1d9560fbfc03569df
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:36:06 +00:00
Luiz Augusto von Dentz
a70c65d6ff net: echo_client: Don't start sending packets if interface is not UP
If the interface is not UP wait for MGMT event if that is enabled.

Change-Id: I4866c23d1e6f5b1a7cf212434d794673d7e756ce
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:35:55 +00:00
Luiz Augusto von Dentz
04aaab61ca net: echo_client: Fix using CONFIG_NETWORKING_WITH_BT
CONFIG_NETWORKING_WITH_BT no longer exist, instead
CONFIG_NET_L2_BLUETOOTH shall be used.

Change-Id: Ide353b7620228e431c535768b37749994caf8e8b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:35:42 +00:00
Luiz Augusto von Dentz
331c29f96c net: mgmt: Decode event fields
This decodes the event layer, code and type when debugging is enabled.

Change-Id: I23c6fb200f3287a138e46df9f472c9982898675d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:34:51 +00:00
Luiz Augusto von Dentz
56261b21cc net: mgmt: Make NET_MGMT_GET_* macros return meaningful values
They should return the same value as in NET_MGMT_LAYER and
NET_MGMT_LAYER_CODE.

Change-Id: Ia95adcd3b6b6aaf0ed29f3260bc54784ca532d8f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-13 14:34:35 +00:00
Tomasz Bursztyka
4695e895c8 samples: net: Fix dhcpv4 building with net mgmt event support
It was missing for arduino_101.

Jira: ZEP-1574

Change-Id: I08fc0961b94f5f7b1b787ebf52e7d9922e38006c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-13 11:38:17 +01:00
Tomasz Bursztyka
55d653f52f net: mgmt: Silently ignore net_mgmt_event functions if not enabled
When CONFIG_NET_MGMT_EVENT is not set, it will still be able to compile
code using net_mgmt_event related functions.

Change-Id: I6824c57093636867ea4228338aa6c02913975510
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-13 11:35:41 +01:00
Johann Fischer
133f2c07d2 net: ieee802154: fix validate_mac_command_cfi_to_mhr
Change-Id: I4baa9e8e079531f1759584c22869c97b72ab2588
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-01-13 10:29:04 +01:00
Andy Ross
fc35e649ff net: tcp: Don't leak net_conn_handles
net_context_put() forgot to release the conn_handler field causing
subsequent failures in net_conn_register() when they ran out.

Change-Id: I0d306b5035199422fa8788338ac9da8d1900d5f9
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-01-13 10:29:03 +01:00
Andy Ross
96294b79a7 net: tcp: Signal EOF with a NULL buffer in the callback
TCP didn't actually have a way to signal synchronous receipt of a FIN
packet.  Extend the recv_cb API to allow a NULL buf argument with
status==0 (by analogy to Unix's zero-length read) to signal EOF.

Update docs too, and also echo_server which wasn't prepared to handle
this situation.

Change-Id: I7dc08f9e262a81dcad9c670c6471898889f0b05d
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-01-13 10:29:03 +01:00
li zj
9a87e403ac net: icmpv4 : calculate ipv4 header chksum
In icmpv4, after calling setup_ipv4_header() function,
only calculate ICMP chksum, not calculate ipv4 header chksum,
ipv4 header chksum still 0, the other side will drop this pack.

Change-Id: I1550a4c8c7ab63132d70ba6ce19a7caf78ad84e6
Signed-off-by: li zj <279939902@qq.com>
2017-01-13 10:29:03 +01:00
li zj
0fc1d808a3 net: dhcpv4 : set ciaddr 0.0.0.0 when send DHCPV4_MSG_TYPE_REQUEST
When router receive dhcpv4 request with ciaddr not 0.0.0.0,
some router reply NAK, dhcpv4 never successful.

Change-Id: I4b66b18f7d30ad5a1b638fdca0bb204ed078d551
Signed-off-by: li zj <279939902@qq.com>
2017-01-13 10:29:03 +01:00
Michael Scott
a972d03ce7 net: ip: save TCP seq/ack values in tcp_synack_received
The tcp_synack_received() function ends with a call to send_ack().
However, if we don't update the sequence and ACK values, we'll send back
headers with 0 values and the destination will try resending over and
over.

Fix this by saving the seq and ack values when a TCP_SYN is flagged
in the header (which should be the case almost any time this function
is used as a callback).

Change-Id: I57f07ce719f2b6e2fb34c96c867d2e1c37f342ba
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-13 10:29:03 +01:00
Michael Scott
f23ca0e5e1 net: ip: reword appdata debug message in packet_received
Trivial text tweak for clarity.

Change-Id: I470d54d86de7ddc4e83e3ad871448c244134c117
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-13 10:29:03 +01:00
Michael Scott
742b5e22ea net: ip: set context state to NET_CONTEXT_CONNECTED on synack success
Once SYNACK has been received for a TCP connection, we need to set the
net context state to NET_CONTEXT_CONNECTED or else calls to sendto()
will fail with -ENOTCONN.

Change-Id: Idd78e1dcdd5ac0bca5d3fba40b59ab8fde6b8729
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-13 10:29:02 +01:00