Commit graph

19237 commits

Author SHA1 Message Date
Jean-Paul Etienne
4ae030c7b8 riscv32: added support for the SiFive Freedom E310 SOC
The SiFive Freedom E310 SOC follows the riscv privilege
architecture specification and hence is declared within
the riscv privilege SOC family.

It also provides support for a riscv
Platform Level Interrupt Controller (PLIC)

Change-Id: I19ff0997eacc248f48444fc96566a105c6c02663
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:07 +00:00
Jean-Paul Etienne
cd14317c41 timer: riscv_machine_timer: prevent spurious interrupt while rearming the timer
Rearming the riscv machine timer is done by first updating the
mtimecmp low value register. If the low value is updated with a
relatively small value, a timer interrupt can be generated while
updating the mtimecmp high value.

To avoid such a spurious interrupt to occur, disable the timer
interrupt while rearming the timer.

Change-Id: I50ab3f19554a9a8dfe70943b6da0d20be3de88dc
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:15:03 +00:00
Jean-Paul Etienne
1451f82aeb timer: riscv_machine_timer driver depends on SOC_FAMILY_RISCV_PRIVILEGE
Change-Id: I5cbb2845979f88eb005dfd7e0b1714b6fe6167d3
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-04-02 15:14:59 +00:00
Anas Nashif
7d5be2af73 Merge "Merge net branch into master" 2017-04-01 20:46:11 +00:00
Paul Sokolovsky
291d4716ae docs: networking: Suggest to stop QEMU-related networking daemons.
If that's not done and user forgets that they still have TAP interface
active, it may lead to all kinds of address conflicts and routing
problems.

Change-Id: Ib7b64d5e7fcaf2695ff6693a0f0513d16b8907ad
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-01 20:45:48 +00:00
Paul Sokolovsky
542c2b93d0 subsys: console: Add pull-style console API support.
This change introduces console_getchar() and console_getline() API
calls which can be used to get pending console input (either one
char or whole line), or block waiting for one. In this regard, they
are similar to well-known ANSI C function getchar/gets/fgets, and
are intended to ease porting of existing applications to Zephyr, and
indeed, these functions (shaped as an external module) are already
used by few applications.

The implementation of the functions is structured as a new "console"
subsystem. The intention is that further generic console code may be
pulled there instead of being in drivers/console/. Besides the
functions themselves, initialization code and sample applications
are included.

At this time, there're may limitations of how these functions can
be used. For example, console_getchar() and console_getline() are
mutually exclusive, and both are incompatible with callback
(push-style) console API (and e.g. with console shell subsystem
which uses this API). Again, the intention is to make a first step
towards refactoring console subsystem to allow more flexible
real-world usage, better reusability and composability.

Change-Id: I3f4015bb5b26e0656f82f428b11ba30e980d25a0
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-01 20:44:17 +00:00
Luiz Augusto von Dentz
9f5f6d6283 slist: Add parentesis to container list and node pointer
This enables casting if necessary.

Change-Id: I69d537dd1082e1e5a05aa2cacdd503d3f6c1ab95
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-01 20:36:42 +00:00
Luiz Augusto von Dentz
f20f0af255 slist: Add SYS_SLIST_PEEK_TAIL_CONTAINER
This adds SYS_SLIST_PEEK_TAIL_CONTAINER macro to access the container
directly.

Change-Id: I740138a47936ebda1e0090628f4933e921f6a43b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-01 20:36:42 +00:00
Qiu Peiyang
fe415dbf62 tests: drivers: spi: fix variable type mismatches
These were flagged by icx build.

Jira: ZEP-1887

Change-Id: Iaeedb13be23e86ebfb29a6441574b7384ae836e1
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-04-01 20:36:03 +00:00
Marti Bolivar
2a9bb7af3d toolchain: override static assertions for GCC
Provide a BUILD_ASSERT and BUILD_ASSERT_MSG that are based on
_Static_assert when that's available, as its output is easier to read.

Change-Id: Ifa96d5073b1341cab2a90e4dcd04752ee80c69bb
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:45 +00:00
Marti Bolivar
7e61e70b15 toolchain: add BUILD_ASSERT_MSG()
Like BUILD_ASSERT(), but with a message to emit on failure.

The base implementation swallows the message; compiler headers can
override it when they can do better.

Change-Id: Ib724e48554da77a51afa01468b1d5b7806f9de6b
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:45 +00:00
Marti Bolivar
f8c9c5444a toolchain: allow compiler to provide BUILD_ASSERT
Change-Id: Id71d5499d0bd8141062f854a814bd882db470323
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:44 +00:00
Piotr Mienkowski
ce6ad70c06 scripts: openocd.sh: align usage of OPENOCD_*_CMD variables
OPENOCD_PRE_CMD, OPENOCD_POST_CMD variables require adding
'-c' in front of an actual OpenOCD command. This is in contrary
to other OPENOCD_*_CMD varialbles which specify OpenOCD commands
directly. This patch aligns usage of various OPENOCD_*_CMD variables.
It is no longer required to add '-c' in front of OPENOCD_PRE_CMD,
OPENOCD_POST_CMD variables.

Change-Id: I276fab00b099694c83c3bf74aa5dd59c8d6a308b
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-04-01 12:21:36 +00:00
Marti Bolivar
5f95120779 zephyr-env.sh: only reset scripts_path on Windows
The pipeline that converts scripts_path from "C:\" style to "/c/"
style is only needed on Windows. Further, on Linux, it prepends an
extra "/" to what gets added to PATH, since the pwd output already has
a leading "/".

Fix that by only making the change when we're building on Windows.

Change-Id: Ied7e4491f171d82e8dee4c3a4dfdcf64adf46efd
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:42:31 -04:00
Marti Bolivar
bfda8a966a zephyr-env.sh: unset PWD_OPT after using it
Change-Id: I9d78983233097c725869c4467a20189e2b859bab
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:19:07 -04:00
Marti Bolivar
e3a31263ce zephyr-env.sh: fix stale comment
s/zephyr-env_install.bash/.zephyrrc/

Change-Id: I88d4a5d44b6fb97d52b8244cb3d1bcb8679b49ef
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:08:33 -04:00
Jukka Rissanen
cadfaf8858 Merge net branch into master
Main changes:

- RPL fixes
- TCP 2MSL timeout tweaking fix
- net_buf context pool crash fix
- net-shell connection status output fixes
- Packet re-routing fixes
- net_mgmt API fixes
- IEEE 802.15.4 link layer security added
- Network sample applications config option prefix changed

----------------------------------------------------------------
Jukka Rissanen (6):
      net: rpl: Temporarily disable some of the RPL tests
      net: tests: Fix nbr lookup in route tests
      net: tcp: Allow tweaking of 2MSL timeout
      net: nbuf: Do not crash if context pools are not in use
      net: shell: Fix the connection status output
      net: Check if sent packet is meant for us

Ravi kumar Veeramally (8):
      net: if: Fix triggering interface link call back
      net: icmpv6: Remove unnecessary cache ptrs for src and dst
      net: rpl: Align Kconfig options properly
      net: rpl: Add support for handling of DAO ACK
      net: rpl: Fix invalid parsing of DAO message
      net: rpl: Fix invalid parsing of DIO message
      net: rpl: Fix DAO ACK reply
      net: rpl: Fix invalid nbr lookup

Tomasz Bursztyka (29):
      net/ieee802154: Add Auxiliary Security Header definitions
      net/ieee802154: Parse and validate auxiliary security header
      net/ieee802154: Change function signature for future change
      net/ieee802154: Normalize one parameter to make it clearer
      net/ieee802154: Add generic support for link layer cipher operations
      net/ieee802154: Provide the means to create secured data frames
      net/ieee802154: Provide the means to decipher data frames
      net/ieee802154: Integrate link-layer security relevantly
      net/ieee802154: Add net mgmt requests to set/get security settings
      drivers/ieee802154: Adding support for CC2520 ccm crypto
      tests/net/ieee802154: Add a simple CC2520 crypto dev test
      net/ieee802154: Expose auxiliary security header validation function
      net: Rename Kconfig.samples and its main option for future changes
      net: Add 802.15.4 useful Kconfig application settings
      net/ieee802154: Rename <SET/GET>_CHAN to <SET/GET>_CHANNEL
      samples/net: Uses CONFIG_NET_APP_IEEE802154_* options relevantly
      samples/net: Remove the need for IEEE 802.15.4 stack in wpan serial
      net/ieee802154: Remove ORFD choice altogether.
      net/samples: Add 802.15.4 link-layer security settings for the samples
      tests/net/ieee802154: Switch l2 to ztest framework
      tests/net/ieee802154: Add a unit test for secured data frame validation
      net/ieee802154: We don't get the MFR from device drivers
      net/samples/ieee802154: Making hw sample simpler
      net/ieee802154: Simplify data FS settings function signature
      net/ieee802154: Use context's extended address when generating frame
      net/ieee802154: Use context instead of interface to reduce stack usage
      net/ieee802154: Disable ACK reply handling by default
      net/ieee802154: Remove useless __packed annotation
      net/mgmt: Mask vs event should be verified part by part

 drivers/ieee802154/Kconfig.cc2520                  |  27 +-
 drivers/ieee802154/ieee802154_cc2520.c             | 414 ++++++++++++++++++++-
 drivers/ieee802154/ieee802154_cc2520.h             |   4 +
 drivers/ieee802154/ieee802154_cc2520_regs.h        |  11 +-
 include/net/ieee802154.h                           |  66 +++-
 samples/bluetooth/ipsp/prj.conf                    |   6 +-
 samples/bluetooth/ipsp/src/main.c                  |   4 +-
 samples/net/coaps_client/prj_qemu_x86.conf         |   6 +-
 samples/net/coaps_client/src/coaps_client.c        |   6 +-
 samples/net/coaps_client/src/udp.c                 |   6 +-
 samples/net/coaps_server/prj_qemu_x86.conf         |   6 +-
 samples/net/coaps_server/src/coaps_server.c        |   6 +-
 samples/net/common/ieee802154_settings.c           |  59 +++
 samples/net/common/ieee802154_settings.h           |  15 +
 samples/net/dns_client/README.rst                  |   5 +-
 samples/net/dns_client/prj_arduino_101.conf        |  10 +-
 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                |  10 +-
 samples/net/dns_resolve/prj_qemu_x86.conf          |  10 +-
 samples/net/dns_resolve/src/main.c                 |  12 +-
 samples/net/echo_client/prj_arduino_101.conf       |   6 +-
 .../net/echo_client/prj_arduino_101_cc2520.conf    |   3 +-
 samples/net/echo_client/prj_bt.conf                |   6 +-
 samples/net/echo_client/prj_cc2520.conf            |   7 +-
 samples/net/echo_client/prj_frdm_k64f.conf         |  10 +-
 samples/net/echo_client/prj_frdm_k64f_cc2520.conf  |   7 +-
 samples/net/echo_client/prj_frdm_k64f_mcr20a.conf  |   7 +-
 samples/net/echo_client/prj_nrf5.conf              |   7 +-
 samples/net/echo_client/prj_qemu_802154.conf       |   7 +-
 samples/net/echo_client/prj_qemu_cortex_m3.conf    |  10 +-
 samples/net/echo_client/prj_qemu_x86.conf          |  10 +-
 samples/net/echo_client/prj_sam_e70_xplained.conf  |   6 +-
 samples/net/echo_client/src/Makefile               |   7 +
 samples/net/echo_client/src/echo-client.c          |  39 +-
 samples/net/echo_server/prj_arduino_101.conf       |   6 +-
 .../net/echo_server/prj_arduino_101_cc2520.conf    |   1 -
 samples/net/echo_server/prj_bt.conf                |   6 +-
 samples/net/echo_server/prj_cc2520.conf            |   5 +-
 samples/net/echo_server/prj_frdm_k64f.conf         |  10 +-
 samples/net/echo_server/prj_frdm_k64f_cc2520.conf  |   5 +-
 samples/net/echo_server/prj_frdm_k64f_mcr20a.conf  |   5 +-
 samples/net/echo_server/prj_nrf5.conf              |   7 +-
 samples/net/echo_server/prj_qemu_802154.conf       |   5 +-
 samples/net/echo_server/prj_qemu_cortex_m3.conf    |  10 +-
 samples/net/echo_server/prj_qemu_x86.conf          |  10 +-
 samples/net/echo_server/prj_sam_e70_xplained.conf  |   6 +-
 samples/net/echo_server/src/Makefile               |   7 +
 samples/net/echo_server/src/echo-server.c          |  23 +-
 samples/net/http_client/README.rst                 |   4 +-
 samples/net/http_client/prj_frdm_k64f.conf         |  11 +-
 samples/net/http_client/prj_qemu_x86.conf          |  10 +-
 samples/net/http_client/src/config.h               |  10 +-
 samples/net/http_server/README.rst                 |   4 +-
 samples/net/http_server/prj_frdm_k64f.conf         |   6 +-
 samples/net/http_server/prj_qemu_x86.conf          |   6 +-
 samples/net/http_server/src/config.h               |   6 +-
 samples/net/ieee802154/hw/prj_cc2520_1.conf        |  64 ++++
 samples/net/ieee802154/hw/prj_cc2520_2.conf        |  64 ++++
 samples/net/ieee802154/hw/prj_mcr20a.conf          |  19 +-
 samples/net/ieee802154/hw/prj_nrf5.conf            |  30 +-
 samples/net/ieee802154/hw/src/Makefile             |   3 +
 samples/net/ieee802154/hw/src/ieee802154_test.c    |  96 ++---
 samples/net/ieee802154/qemu/prj.conf               |   4 +-
 samples/net/ieee802154/qemu/prj_client.conf        |   4 +-
 samples/net/ieee802154/qemu/prj_server.conf        |   4 +-
 .../net/ieee802154/qemu/src/ieee802154_qemu_test.c |   4 +-
 samples/net/irc_bot/prj_frdm_k64f.conf             |  10 +-
 samples/net/irc_bot/prj_qemu_x86.conf              |  10 +-
 samples/net/irc_bot/src/irc-bot.c                  |  24 +-
 samples/net/leds_demo/prj_802154.conf              |   4 +-
 samples/net/leds_demo/src/Makefile                 |   7 +
 samples/net/leds_demo/src/leds-demo.c              |  11 +
 .../net/mbedtls_dtlsclient/prj_arduino_101.conf    |  10 +-
 samples/net/mbedtls_dtlsclient/prj_qemu_x86.conf   |  10 +-
 samples/net/mbedtls_dtlsclient/src/dtls_client.c   |  12 +-
 samples/net/mbedtls_dtlsclient/src/udp.c           |  12 +-
 samples/net/mbedtls_dtlsserver/prj_qemu_x86.conf   |  10 +-
 samples/net/mbedtls_dtlsserver/src/dtls_server.c   |  12 +-
 samples/net/mbedtls_sslclient/src/tcp_cfg.h        |  10 +-
 samples/net/mqtt_publisher/prj_96b_nitrogen.conf   |  10 +-
 samples/net/mqtt_publisher/prj_frdm_k64f.conf      |  10 +-
 samples/net/mqtt_publisher/prj_qemu_x86.conf       |  10 +-
 samples/net/mqtt_publisher/src/config.h            |  10 +-
 samples/net/nats/prj_qemu_x86.conf                 |   6 +-
 samples/net/nats/src/main.c                        |  24 +-
 samples/net/telnet/prj_frdm_k64f.conf              |   4 +-
 samples/net/telnet/prj_qemu_x86.conf               |   6 +-
 samples/net/telnet/prj_qemu_x86_iamcu.conf         |   6 +-
 samples/net/telnet/src/telnet.c                    |  12 +-
 samples/net/wpan_serial/prj.conf                   |   4 +-
 samples/net/wpan_serial/src/main.c                 |  12 +-
 samples/net/zoap_client/prj_bt.conf                |   6 +-
 samples/net/zoap_server/prj_cc2520.conf            |   8 +-
 samples/net/zoap_server/src/Makefile               |   7 +
 samples/net/zoap_server/src/zoap-server.c          |  17 +-
 samples/net/zperf/prj_bt.conf                      |   6 +-
 samples/net/zperf/prj_frdm_k64f.conf               |  10 +-
 samples/net/zperf/prj_qemu_x86.conf                |  10 +-
 samples/net/zperf/prj_quark_se_c1000_devboard.conf |   9 +-
 samples/net/zperf/src/Makefile                     |   7 +
 samples/net/zperf/src/zperf_internal.h             |  12 +-
 samples/net/zperf/src/zperf_shell.c                |  11 +
 subsys/net/ip/Kconfig                              |  10 +-
 subsys/net/ip/Kconfig.app                          | 106 ++++++
 subsys/net/ip/Kconfig.rpl                          | 130 ++++---
 subsys/net/ip/Kconfig.samples                      |  50 ---
 subsys/net/ip/icmpv6.c                             |  23 +-
 subsys/net/ip/l2/ieee802154/Kconfig                |  58 +--
 subsys/net/ip/l2/ieee802154/Makefile               |   2 +
 subsys/net/ip/l2/ieee802154/ieee802154.c           |  30 +-
 subsys/net/ip/l2/ieee802154/ieee802154_frame.c     | 292 +++++++++++++--
 subsys/net/ip/l2/ieee802154/ieee802154_frame.h     | 103 ++++-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c      |  75 +++-
 subsys/net/ip/l2/ieee802154/ieee802154_security.c  | 198 ++++++++++
 subsys/net/ip/l2/ieee802154/ieee802154_security.h  |  36 ++
 subsys/net/ip/l2/ieee802154/ieee802154_shell.c     |   4 +-
 subsys/net/ip/nbuf.c                               |  12 +-
 subsys/net/ip/net_core.c                           |  12 +-
 subsys/net/ip/net_if.c                             |   6 +-
 subsys/net/ip/net_mgmt.c                           |  11 +-
 subsys/net/ip/net_shell.c                          |  80 ++--
 subsys/net/ip/rpl.c                                | 187 +++++++---
 subsys/net/ip/tcp.c                                |   6 +-
 tests/net/ieee802154/crypto/Makefile               |  12 +
 .../hw => tests/net/ieee802154/crypto}/prj.conf    |   8 +-
 tests/net/ieee802154/crypto/src/Makefile           |   1 +
 .../ieee802154/crypto/src/ieee802154_crypto_test.c | 310 +++++++++++++++
 tests/net/ieee802154/crypto/testcase.ini           |   5 +
 tests/net/ieee802154/l2/prj.conf                   |   6 +-
 tests/net/ieee802154/l2/src/Makefile               |   2 +
 .../net/ieee802154/l2/src/ieee802154_fake_driver.c |  26 +-
 tests/net/ieee802154/l2/src/ieee802154_test.c      | 206 ++++++----
 tests/net/mgmt/src/mgmt.c                          |   6 +-
 tests/net/route/src/main.c                         |  82 +---
 tests/net/rpl/prj.conf                             |   1 +
 tests/net/rpl/src/main.c                           |  17 +-
 137 files changed, 2795 insertions(+), 967 deletions(-)
 create mode 100644 samples/net/common/ieee802154_settings.c
 create mode 100644 samples/net/common/ieee802154_settings.h
 create mode 100644 samples/net/ieee802154/hw/prj_cc2520_1.conf
 create mode 100644 samples/net/ieee802154/hw/prj_cc2520_2.conf
 create mode 100644 subsys/net/ip/Kconfig.app
 delete mode 100644 subsys/net/ip/Kconfig.samples
 create mode 100644 subsys/net/ip/l2/ieee802154/ieee802154_security.c
 create mode 100644 subsys/net/ip/l2/ieee802154/ieee802154_security.h
 create mode 100644 tests/net/ieee802154/crypto/Makefile
 rename {samples/net/ieee802154/hw => tests/net/ieee802154/crypto}/prj.conf (86%)
 create mode 100644 tests/net/ieee802154/crypto/src/Makefile
 create mode 100644 tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c
 create mode 100644 tests/net/ieee802154/crypto/testcase.ini

Change-Id: I41c259c48daf010ad4f4ece1f43503caf94f4eb6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 15:58:02 +03:00
Tomasz Bursztyka
8108a608ff net/mgmt: Mask vs event should be verified part by part
It needs to check if current event matches:

- cb's layer
- cb's layer code
- cb's command

If none match, it will not raise the event.

Fixing the unit test as layer must be always != 0.

Jira: ZEP-1940

Change-Id: Iadd63e751fa6e534a10e7da9cae0f5bb5a384461
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 12:15:29 +00:00
Tomasz Bursztyka
8292dc16d4 net/ieee802154: Remove useless __packed annotation
These structs are not mapped to network data, and allocated on stack.

Change-Id: Ib00e15c3d0cdb21fd124ef6f61ec010100bcc9bf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
dc7be7c54f net/ieee802154: Disable ACK reply handling by default
Most (if not all) 802.15.4 devices can handle ACK replies by
themselves.

Change-Id: I0319d59de767b20eb67c1592bacaa4a7b7015cad
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
e716b4dcb0 net/ieee802154: Use context instead of interface to reduce stack usage
Now that interface is not directly used in data and mac frame creation,
let's just pass context pointer.

Change-Id: If002e6790d044eeffc57cb5685ac9525fbd6e43c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
0948149b92 net/ieee802154: Use context's extended address when generating frame
Now that RFD is default, the extended address can be changed through net
mgmt API, and thus no longer be the same as device's generated mac address.

Change-Id: I07ee647615c2caa1994712147c6c8a2b4306900d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
0df2a2fdbe net/ieee802154: Simplify data FS settings function signature
There is no need of interface anymore.
After previous changes, it appears that net_if parameter is not used so
we can remove it.

Change-Id: Id3570f50865696818a9be2280172e2e25fc537f7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
e027645c88 net/samples/ieee802154: Making hw sample simpler
- Let's use samples settings
- Enable both net and 15.4 shell modules
- Change prj_*.conf accordingly

Change-Id: If7e32a42c8dc7026d0580b1e94e819e1eda82e5b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
5e3354dad5 net/ieee802154: We don't get the MFR from device drivers
commit id 7a11439020 changed this.
Hopefully that changed did not affect anything.

Reducing minimal frame length and applying the change everywhere where
relevant.

Change-Id: I5ae203751bfcf70cef833620106d2c2d0e33b7a5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
82709802a9 tests/net/ieee802154: Add a unit test for secured data frame validation
Change-Id: I3e35d13d1fdfacb6625dfe1b7b30cc2354a7ee93
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka
cca117d8b9 tests/net/ieee802154: Switch l2 to ztest framework
Change-Id: Ibce93d4652e3991a06e870fc81e952788f0c6465
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
d2f8a5a27f net/samples: Add 802.15.4 link-layer security settings for the samples
And use them accordingly in the common code part.

Change-Id: Id91b76e5baea607c0d68eebcde6f84e4e35ca44c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
e3c0310d98 net/ieee802154: Remove ORFD choice altogether.
ORFD was a hack, from the beginning of the IEEE 802.15.4 Soft MAC stack,
but is now useless and can therefore be removed.

Change-Id: I74d5e1995993f4a0749b6d9d553406d5ae162bda
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
7b8af87fdf samples/net: Remove the need for IEEE 802.15.4 stack in wpan serial
It can uses CONFIG_NET_APP_IEEE802154_* options instead.

Change-Id: I2501ca2015cfc1e68c6c384cb32c21084d2cb30d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
26a4df620f samples/net: Uses CONFIG_NET_APP_IEEE802154_* options relevantly
In order to simplify when 802.15.4 is selected on these samples, let's
setup the device through a common code.

For this to work, RFD is now the default.

Change-Id: I46590864442f77d83f681cc0e854c94344648856
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
35dd54d1d7 net/ieee802154: Rename <SET/GET>_CHAN to <SET/GET>_CHANNEL
It's more readable and along with other part of the system.

Change-Id: Ib4be787d74310d838f38b1f1d5624e7357da8969
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
1a647613a4 net: Add 802.15.4 useful Kconfig application settings
These should be used by samples to fix basic 15.4 settings.

Change-Id: I31ad1540008ac760b7aef720e520bf8e72d3a805
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka
0f18ce44f9 net: Rename Kconfig.samples and its main option for future changes
s/SAMPLES/APP for name shortening. Applying the change where relevant.

Not only IP addresse will be available as samples settings there but
also IEEE 802.15.4 channel, pan_id, and more for instance.

Change-Id: I05dd24989bd0c804d9588092d67044a3e063bc88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:26 +02:00
Tomasz Bursztyka
98cace4a96 net/ieee802154: Expose auxiliary security header validation function
This will be needed for Thread/MLE.

Change-Id: Ib421da66cfc4da8111ff131f08cac74a11674928
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Tomasz Bursztyka
7f50b56c0e tests/net/ieee802154: Add a simple CC2520 crypto dev test
It will first run the datasheet example.

Change-Id: Ic4da5ba9170a253cfdff4b17010d72dc86376555
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Tomasz Bursztyka
3226b95a5f drivers/ieee802154: Adding support for CC2520 ccm crypto
This will provide the feature through Crypto API.

Change-Id: If6953a54b393544b019755ae73571effe0724e69
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Tomasz Bursztyka
e771f174e5 net/ieee802154: Add net mgmt requests to set/get security settings
These requests are used to set/get the key, the mode and the level of
the IEEE 802.15.4 link layer security.

Only implicit key mode is supported for now.

Change-Id: Ifbc9a5d08f9fbf0d51d6c3e4b650cfdce3d263db
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Tomasz Bursztyka
165f8b4d29 net/ieee802154: Integrate link-layer security relevantly
Initialize the ciphers.

Once the header is parsed and validated, we get all the necessary info
to decrypt the frame properly.

Change-Id: I3142fa572c7566b40efe18cf9d4e3f2b4bce0612
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
aa24613347 net/ieee802154: Provide the means to decipher data frames
It's not only about decrypting and authentifying but also setting the
right frag's length after that.

Change-Id: Ifc766b212b37d4e3593c210f6646ee85dff2ab6d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
5e115ba935 net/ieee802154: Provide the means to create secured data frames
Take into account the current security context to compute the header
size.

Provide the function to fill-in the aux security header in a frame.

Finally, call the generic encryption function which will process the
frame relevantly according to the given security context.

For now, only implicit key mode is supported.

Change-Id: I5412c32179e70217c0946b1b54d9a752375d522f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
9d78dba0a1 net/ieee802154: Add generic support for link layer cipher operations
This provides the means to authentify with/without encryption or
decryption of a frame following a generic 15.4 security context.

Change-Id: Ia5dbb7f43936a8131112fe4b16c9780e30f904c1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
fb55449882 net/ieee802154: Normalize one parameter to make it clearer
Some call use a boolean for it, and since it's supposed to be 1 or 0
let's ask for a boolean always.

Change-Id: If4fbe5d58d5c25fb2a86719435c59af53ea02445
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
fb0e2d44ee net/ieee802154: Change function signature for future change
When applying security, there will be needs for accessing payload as
well, thus providing the whole frag directly instead of a data pointer
on the ll part.

Change-Id: Ia97a1f07f2a12fc5cdf085c3cc6350d50b419cae
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
1ee5f3b578 net/ieee802154: Parse and validate auxiliary security header
This will ensure basic auxiliary security header fields are relevantly
filled-in as well as moving the parsing buffer pointer to the right
position for further parsing.

Change-Id: Ib09e312add783b13bf8b59a81a2ffe64eb6f8dc2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Tomasz Bursztyka
e089f14427 net/ieee802154: Add Auxiliary Security Header definitions
These will be used to parse and create 802.15.4 frames with security
enabled.

Change-Id: Icad214c8d7aa658b8483bf601b091b266e1b8d77
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:32 +02:00
Jukka Rissanen
d593914b17 net: Check if sent packet is meant for us
If the destination IP address is one of our own address,
then reroute it back to us.

Jira: ZEP-1966

Change-Id: I8b93fc5425f3f18b0b9e85ca9a57cb122129c47f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Jukka Rissanen
039e215233 net: shell: Fix the connection status output
The fields in "net conn" output were unaligned and looked
generally very ugly.

Change-Id: I56b29982d4f6b984405944d155bbb6c682383318
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Jukka Rissanen
11305ec928 net: nbuf: Do not crash if context pools are not in use
It is possible that CONFIG_NET_CONTEXT_NBUF_POOL is set but
application has not defined any pools. In this case the tx and
data pool pointers will be NULL in net_context struct and we
must use the default pools instead.

Change-Id: I286f34c87d9182aace71e0a61f038945810e4916
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Jukka Rissanen
6df4ee9691 net: tcp: Allow tweaking of 2MSL timeout
The default timeout (4 min) is very long. Allow tweaking the
value via Kconfig option.

Change-Id: Iddfd48b96f3612b9bba7caa4d64357505df9644d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00