Commit graph

18591 commits

Author SHA1 Message Date
Matthias Ringwald
34b6c53c46 Bluetooth: Controller: Kconfig company id and subversion number
Add Kconfig option to set the Controller's company id and
subversion number.

Change-id: I3508aba18bf0b79fd423c7b4142b6fc57eaf55d7
Signed-off-by: Matthias Ringwald <matthias@bluekitchen-gmbh.com>
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Vinayak Chettimada
0d75faf02d Bluetooth: Controller: Add advertisement event indication feature
Add a Controller event that indicates everytime
advertisement event has been transmitted on air.

Change-id: I4722488bbfeca987e66983faf5b26467407a89c9
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Vinayak Chettimada
d8f28bc96a Bluetooth: Controller: Fix RSSI feature conditional compilation
Add ARG_UNUSED on rssi_ready local variable when the RSSI
feature is compiled out.

Change-id: I04f8f11cbc3530f7b85ffa72f27373e213b6e35e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Kaustav Dey Biswas
4b534bc403 Bluetooth: SDP: Server: Send service search response
Now that we have all the records which has the uuids in the
service serach pattern, take the handle of each of those records,
prepare and send the service search response.

> ACL data: handle 256 flags 0x02 dlen 17
    L2CAP(d): cid 0x0040 len 13 [psm 1]
        SDP SS Req: tid 0x6b6f len 0x8
          pat uuid-16 0x0100 (L2CAP)
          max 256
          cont 00
< ACL data: handle 256 flags 0x00 dlen 26
    L2CAP(d): cid 0x0040 len 22 [psm 1]
        SDP SS Rsp: tid 0x6b6f len 0x11
          count 3
          handles 0x10000 0x10001 0x10002
          cont 00

Change-Id: I85ec8ee384d0bf8090265577ec3ef805e75d4766
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2017-03-21 17:05:42 -07:00
Luiz Augusto von Dentz
4fb0724a55 Bluetooth: ipsp: Fix checking for NULL pointer
This may cause static analyser error such as the following:

  Null-checking "tmp" suggests that it may be null, but it has already
  been dereferenced on all paths leading to the check.
             if (tmp) {

Change-Id: Id04f8d052d8128003d5b91f7a8303940529ef261
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-21 17:05:42 -07:00
Carles Cufi
e4aa74125c doc: Fix minor issues in Windows installation guide
Minor fixes and cosmetic changes.

Change-Id: Ibf98f84934b523860adf27acc743fd1ec359e773
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-03-21 13:46:16 +00:00
Carles Cufi
b4aff7dc79 arch: nrf5x: Define additional compiler macros
The current nordic hal layer in ext/ requires additional macros to
include the correct files. This will be corrected in an upcoming version
of the hal layer itself but for now add the required macros so that
users can benefit from the hal peripheral code.

Change-Id: I95127d0a98d7e882fdc779f961718fa223d504eb
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-03-21 13:38:59 +00:00
Anas Nashif
3dc9af66ca sensors: BME280: added support for SPI communication
Support connection via SPI and keep I2C as the default.

Jira: ZEP-1698
Change-Id: I42a76131577a37429375364deb07e451107f5d81
Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-21 10:39:27 +01:00
Anas Nashif
23a4eca861 panther: set SPI slave select for bme280
Change-Id: If1bd1a3f3fa1855907fbc356066b97013fe37996
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-20 23:08:15 -04:00
Jean-Paul Etienne
4b8ae8863c riscv32: riscv-privilege: Platform-Level Interrupt Controller support
Updated the riscv-privilege SOC family to account for SOCs supporting
a Platform-level Interrupt Controller (PLIC) as specified by the
riscv privilege architecture.

riscv-privilege SOCs supporting a PLIC have to implement the following
list of APIs:
void riscv_plic_irq_enable(uint32_t irq);
void riscv_plic_irq_disable(uint32_t irq);
int riscv_plic_irq_is_enabled(uint32_t irq);
void riscv_plic_set_priority(uint32_t irq, uint32_t priority);
int riscv_plic_get_irq(void);

Change-Id: I0228574967348d572afc98a79257c697efc4309e
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-03-20 23:19:36 +00:00
Jean-Paul Etienne
d1bd80a4a9 riscv32: added the riscv-privilege SOC_FAMILY
added the riscv-privilege SOC_FAMILY, under which all
riscv SOCs supporting the riscv privilege architecture
specifcation shall reside. These SOCs shall notably have
a common base for handling IRQs.

Moved riscv32-qemu under the riscv-privilege SOC_FAMILY

Change-Id: I5372cb38e3eaed78886f22b212ab4f881ef30b3f
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-03-20 23:19:35 +00:00
Inaky Perez-Gonzalez
c9cff15a8a samples/shell: print the actual params passed
The params command is not printing the arguments, which makes this not
so useful to verify how things work, so added it to the sample.

Change-Id: I2d71ee064f12c7353ba83144824ae46803e2ad39
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-03-20 21:48:54 +00:00
Carles Cufi
6f422bae81 doc: Add MSYS2 to the Windows setup guide
Since MSYS2 is far more stable, reliable, maintained and easy
to set up than MinGW as a Windows development environment,
default to it for the official Windows Getting Started guide,
including instructions to compile for both x86 and ARM with it.

Change-Id: Iaba61498b3b16a8ee1edbff953de16c275282c7b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-20 21:46:06 +00:00
Michał Kruszewski
46a00d4b7c scripts:nrf: Add 'make flash' for nrf boards.
Tested on nrf52_pca10040 and nrf51_pca10028 using hello_world sample.

Change-Id: I7cdf1d21e7f8232da737a06e5afbfb1eaec05cde
Signed-off-by: Michał Kruszewski <mkru1992@gmail.com>
2017-03-20 13:44:58 +00:00
Anas Nashif
7d7b3b732b Merge "Merge net branch into master" 2017-03-19 20:51:32 +00:00
Piotr Mienkowski
b6480cd5ae flash: openocd: make 'make flash' target work without Zephyr SDK
At present 'make flash' target for boards that support flashing with
OpenOCD works only with Zephyr SDK. This patch enables flashing
without Zephyr SDK as long as openocd itself is installed.

Change-Id: I4594d795225e54b7638839d590e4c0620f9ca88c
Jira: ZEP-1893
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-03-19 20:22:22 +00:00
David B. Kinder
3e20df33fc doc: Add 1.5 release notes to release-notes.rst
The only copy of the release notes for releases prior to 1.6 is on
the zephyrproject.org/downloads site.  Preserving the release notes
history in the git repo would be a good thing.  Here are the notes
for 1.5 (more to come).

Also added an auto table-of-contents header to make it easier to
navigate.

Change-Id: Ibd8b5a8d3816f7f5c376216adc2d52bb9467214d
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-03-18 23:34:18 +00:00
David B. Kinder
570ad1d328 doc: add example clarifing duration/period
A recent mailing list question asked for clarify about
the duration and period parameters for starting a timer.

Change-Id: I9bf8dd93dbbb9bbb94c95c2d7072f446ea1d6b01
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-03-18 23:33:20 +00:00
Carles Cufi
1436e44aa6 build: Add support for MSYS2
MSYS2 is a modern fork of Cygwin that is widely supported
and provides frequent releases and good support. It is
also the framework used by the official Windows Git port.
This patch adds MSYS2 support so that builds on Windows using
MSYS2 work properly.

Change-Id: Ia5743a410d1cff983a7aab37f8e3d8228cb8ae8e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-03-17 17:34:56 +01:00
Jukka Rissanen
cfaf64c042 Merge net branch into master
Main changes:

- HTTP sample application Basic Auth support
- DNS parsing fixes
- SLIP MAC address can be set from Kconfig
- SLIP driver memory corruption fix
- IPv6 neighbor unreachability detection (NUD) fixes
- ICMPv6 fixes
- Compiler warning fixes
- IEEE 802.15.4 CC2520 MAC address can be set from Kconfig
- Multiple k_delayed_work_init() call fixes in network stack
- 6lo (IPv6 header compression) fix
- Atmel SAM family GMAC ethernet driver update
- RPL protocol header fixes
- mbedtls CoAP fixes
- Management API supports now synchronous event waiting
- RX and TX thread startup fix
- net_buf leak fixes in error cases

----------------------------------------------------------------
Flavio Santes (6):
      samples/http: Match header field ctr with Kconfig variable
      net/http: Move some statements to the right place
      samples/net/http: Add the HTTP Basic Authentication routine
      net/dns: Fix wrong name in DNS answer type routine
      net/dns: Fix DNS answer RR computation
      tests/net/dns: Add routines to evaluate DNS responses

Inaky Perez-Gonzalez (1):
      drivers: slip: Allow specifying the MAC address from config file

Jukka Rissanen (32):
      net: ipv6: Add debug function to convert nbr state to string
      net: ipv6: Print IPv6 neighbor state changes
      net: ipv6: Send NS when neighbor is added
      net: ipv6: Return the prefix lifetime in seconds
      net: shell: Print more detailed neighbor information
      net: ipv6: Wrong timer was used when reachability timer expired
      net: ipv6: Add more debugging to reachability timer
      net: ipv6: Properly enter DELAY state in NUD
      net: utils: Byte to hex converter had wrong prototype
      samples: net: zperf: Fix compiler warnings
      net: tests: nbuf: Fix compiler warnings
      net: shell: Add cmd to remove IPv6 neighbor from cache
      net: shell: Pretty print the neighbor cache info
      net: tests: Fix the default MAC address
      net: Synchronize TX and RX threads startup
      net: Ignore everything in RX if interface is not up
      net: ipv6: Use net_nbuf_unref() to get better debug prints
      net: ipv6: Make sure there is data to be sent
      net: ipv6: Clear pending buf if NS cannot be sent
      net: ipv6: Enhance debug print when handling pending packet
      drivers: slip: Use always the initialized network interface
      net: Print error if buf or interface are NULL when receiving pkt
      net: ipv6: Make config options more fine grained
      drivers: slip: Fix memory corruption when receiving packet
      net: ipv6: Cancel the prefix timer before setting it again
      net: ipv6: Prefix length was incorrectly set
      net: icmp: Gracefully timeout net_buf get in RX path
      net: icmp: Update ICMP statistics for every ICMP packet
      net: icmp: Fix return values of ICMP error send function
      net: tcp: Print TCP trace in one line
      samples: net: coaps_client: Fix the parameters when setting callbacks
      drivers: ieee802154: cc2520: User can set the MAC address

Luiz Augusto von Dentz (5):
      net: if: Don't check NET_IF_UP in net_if_prepare_events
      net: bt: Fix warnings when debug is enabled
      net: if: Make sure k_delayed_work_init is only called once
      net: ipv6: Make sure k_delayed_work_init is only called once
      net: rpl: Make sure k_delayed_work_init is only called once

Michael Scott (2):
      net: 6lo: Fix typo in compress bit calculation
      net/http: let HTTP_SERVER, HTTP_CLIENT and HTTP_PARSER select HTTP

Paul Sokolovsky (2):
      net: connection: Move proto2str() to utils.c, rename to net_proto2str()
      net: context: For bind debug logging, include context protocol.

Piotr Mienkowski (1):
      drivers: Update Atmel SAM family GMAC Ethernet driver

Ravi kumar Veeramally (9):
      net: core: Fix IPv6 RPL extension parsing
      net: rpl: Add RPL header revert utility
      net: ipv6: Fix handling of RA 6CO options
      net: icmpv6: Add support for HBH and RPL option handling
      net: context: Fix setting of appdata ptr and length
      net: rpl: Fix compilation warnings about format specifier
      net: rpl: Add API to access default rpl instance
      net: Modify IPv4/6 packet finalize API's
      net: samples: leds_demo: Fix memory leak

Sergio Rodriguez (2):
      samples: mbedtls coap: Fixing entropy source
      samples: mbedTLS coap: Cleaning prj.conf for QEMU

Tomasz Bursztyka (7):
      net/ieee802154: Add missing line breaks in the shell module
      net/ieee802154: Fix net mgmt request to get core settings
      net/mgmt: Add a function to wait on a event synchronously
      net/mgmt: Add a network interface based synchronous event listener
      tests/net/mgmt: Add 2 unit tests around synchronous event listeners.
      net/mgmt: Remove a useless k_sem_init() and use K_SEM_DEFINE instead
      net/mgmt: Remove the list node before unlocking the semaphore

 .known-issues/doc/networking.conf                 |  12 +
 drivers/ethernet/Kconfig.sam_gmac                 |  16 +-
 drivers/ethernet/eth_sam_gmac.c                   |  82 +++++-
 drivers/ethernet/eth_sam_gmac_priv.h              |   6 +-
 drivers/ieee802154/Kconfig.cc2520                 |  37 +++
 drivers/ieee802154/ieee802154_cc2520.c            |  15 +-
 drivers/slip/Kconfig                              |  11 +
 drivers/slip/slip.c                               |  64 ++++-
 include/net/net_mgmt.h                            |  92 ++++++-
 samples/net/coaps_client/src/coaps_client.c       |  17 +-
 samples/net/coaps_server/prj_qemu_x86.conf        |   5 +-
 samples/net/coaps_server/src/coaps_server.c       |  13 +-
 samples/net/echo_server/prj_sam_e70_xplained.conf |   3 -
 samples/net/http_client/prj_frdm_k64f.conf        |   1 -
 samples/net/http_client/prj_qemu_x86.conf         |   1 -
 samples/net/http_server/README.rst                |  21 ++
 samples/net/http_server/prj_frdm_k64f.conf        |   1 -
 samples/net/http_server/prj_qemu_x86.conf         |   1 -
 samples/net/http_server/src/config.h              |   9 +
 samples/net/http_server/src/http_server.c         |  19 +-
 samples/net/http_server/src/http_server.h         |   2 +
 samples/net/http_server/src/http_types.h          |   4 +-
 samples/net/http_server/src/http_write_utils.c    |  18 ++
 samples/net/http_server/src/http_write_utils.h    |   4 +
 samples/net/http_server/src/main.c                |   1 +
 samples/net/leds_demo/src/leds-demo.c             |  36 ++-
 samples/net/zperf/src/zperf_udp_receiver.c        |   2 +-
 samples/net/zperf/src/zperf_udp_uploader.c        |  24 +-
 subsys/net/ip/6lo.c                               |   2 +-
 subsys/net/ip/Kconfig.ipv6                        |  10 +-
 subsys/net/ip/connection.c                        |  24 +-
 subsys/net/ip/icmpv4.c                            |  28 +-
 subsys/net/ip/icmpv6.c                            |  78 ++++--
 subsys/net/ip/ipv4.c                              |   8 +-
 subsys/net/ip/ipv4.h                              |  10 +-
 subsys/net/ip/ipv6.c                              | 305 +++++++++++++++-------
 subsys/net/ip/ipv6.h                              |  65 +++--
 subsys/net/ip/l2/bluetooth.c                      |   8 +-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c     |   2 +-
 subsys/net/ip/l2/ieee802154/ieee802154_shell.c    |   8 +-
 subsys/net/ip/net_context.c                       |  98 +++----
 subsys/net/ip/net_core.c                          |  30 ++-
 subsys/net/ip/net_if.c                            | 189 ++++++++------
 subsys/net/ip/net_mgmt.c                          | 108 +++++++-
 subsys/net/ip/net_private.h                       |   6 +-
 subsys/net/ip/net_shell.c                         |  68 +++--
 subsys/net/ip/rpl.c                               | 223 +++++++++++-----
 subsys/net/ip/rpl.h                               |  30 ++-
 subsys/net/ip/tcp.c                               |  85 +++---
 subsys/net/ip/utils.c                             |  18 ++
 subsys/net/lib/dns/dns_pack.c                     |   4 +-
 subsys/net/lib/dns/dns_pack.h                     |  11 +-
 subsys/net/lib/http/Kconfig                       |   6 +-
 subsys/net/lib/http/http_server.c                 |  10 +-
 tests/net/6lo/src/main.c                          |   4 +-
 tests/net/arp/src/main.c                          |  10 +-
 tests/net/context/prj.conf                        |   3 +
 tests/net/context/src/main.c                      |  10 +-
 tests/net/dhcpv4/prj.conf                         |   1 +
 tests/net/dhcpv4/src/main.c                       |  24 +-
 tests/net/iface/src/main.c                        |  10 +-
 tests/net/ip-addr/src/main.c                      |  10 +-
 tests/net/ipv6/src/main.c                         |  10 +-
 tests/net/lib/dns_packet/src/dns_packet.c         | 266 ++++++++++++++++++-
 tests/net/lib/http_header_fields/prj.conf         |   1 -
 tests/net/mgmt/src/mgmt.c                         |  57 +++-
 tests/net/mld/src/main.c                          |  12 +-
 tests/net/nbuf/src/main.c                         |  28 +-
 tests/net/route/src/main.c                        |  14 +-
 tests/net/rpl/src/main.c                          |  10 +-
 tests/net/tcp/src/main.c                          |  10 +-
 tests/net/udp/src/main.c                          |  10 +-
 72 files changed, 1780 insertions(+), 661 deletions(-)

Change-Id: I6f911be46eec8ae760fc5077d473aca6c47e91ae
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 14:23:11 +02:00
Luiz Augusto von Dentz
7aa5ae1feb net: rpl: Make sure k_delayed_work_init is only called once
k_delayed_work_init shall only be called once per work and not every
time before as that can trash the workqueue list if the work is pending.

Change-Id: Ib04b6689c59d03328687b0b579e80012dbd2f853
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-17 11:37:48 +02:00
Luiz Augusto von Dentz
64ccc1d5df net: ipv6: Make sure k_delayed_work_init is only called once
k_delayed_work_init shall only be called once per work and not every
time before as that can trash the workqueue list if the work is pending.

Change-Id: I454f40b63133bb7d6239dbe902858932bacfc454
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-17 11:37:48 +02:00
Jukka Rissanen
2b487646d6 drivers: ieee802154: cc2520: User can set the MAC address
Allow user to set the four last bytes of a MAC address.
By default the bytes are selected randomly but for testing
purposes we need a way to specify the address in advance.

Change-Id: Ic9820a8026b327d1ee5025ab77fdc77f5778de67
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:45 +02:00
Jukka Rissanen
3a1a4d3105 samples: net: coaps_client: Fix the parameters when setting callbacks
The RX callback and timeout parameters were reversed in call to
mbedtls_ssl_set_bio().

Change-Id: I285694e57a024ac3ce735e496daad690f94737ac
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:45 +02:00
Jukka Rissanen
9337dd8c22 net: tcp: Print TCP trace in one line
Print TCP header information in one line as there is really no
need to use multiple lines. Also use debug level when printing
the header info so that it is only seen if debugging is activated.

Change-Id: I27f314ca060239545769dec07148897da3426436
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:45 +02:00
Luiz Augusto von Dentz
1b19e16d40 net: if: Make sure k_delayed_work_init is only called once
k_delayed_work_init shall only be called once per work and not every
time before as that can trash the workqueue list if the work is pending.

Change-Id: Ib6398a6a843dd4d820529487ad76a9dc9d9e152e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-17 10:34:45 +02:00
Michael Scott
081246737c net/http: let HTTP_SERVER, HTTP_CLIENT and HTTP_PARSER select HTTP
Due to commit 8308b9bd2d ("net/http: Add the HTTP/1.1 API")
every user of CONFIG_HTTP_PARSER would need to add CONFIG_HTTP to
their .conf files.  Which is fine for intree samples/tests as they
have been adjusted, but the rest of world working on Zephyr apps
will need to make this changes as well.

Instead, we should have each of the following select HTTP instead of
depend on it, which will make future use of these configs and their
dependencies more intuitive:
HTTP_SERVER
HTTP_CLIENT
HTTP_PARSER

NOTE: As cleanup, this commit also removes the CONFIG_HTTP added to
samples and test .conf files.

Change-Id: I81cfaa19e37333b1bf98778f8147814780e7f77c
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-03-17 10:34:45 +02:00
Luiz Augusto von Dentz
9f8d1c17d9 net: bt: Fix warnings when debug is enabled
This fixes warnings when using %u to print the result of sizeof.

Change-Id: I5391456c855ec2785af22467d9d0f355bbb1e577
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-17 10:34:44 +02:00
Piotr Mienkowski
c54b3c7e8f drivers: Update Atmel SAM family GMAC Ethernet driver
Networking stack has split one global DATA pool to RX and TX DATA pools
and also added net_buf pool support to each context. Update the driver
to support this new design. Since the GMAC TX descriptor list has a fixed
size but the number of TX DATA buffers is no longer limited updating the
TX descriptor list has to be guarded by a semaphore.

Tested on Atmel SMART SAM E70 Xplained board

Change-Id: I181e1cdd183e173b85d5d1711b6e78cd5165666d
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
430e271751 net: icmp: Fix return values of ICMP error send function
The return code from net_icmpv{4|6}_send_error() was not correct
if the error message could be sent. Now 0 is returned if sending
succeed, and <0 otherwise.

Change-Id: Iff67f097a9d9519c9f11d4cbc9cf428a7c74ec1b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
8ae7bb257f net: icmp: Update ICMP statistics for every ICMP packet
Update statistics for every sent, received and dropped
ICMPv{4|6} packet.

Change-Id: Ibe6f02e8222adb3db1f1dbd0cde1ed251710eb43
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
d233f91388 net: icmp: Gracefully timeout net_buf get in RX path
If we are replying ICMPv{4|6} message, then do not wait forever
for a free buffer. In a busy system, this might lead to non-progress
in RX path if we receive lot of packet from the network and never get
a free buffer.

Change-Id: Iaef92541b8745f872a07bc6e2052d0393d4d1e8b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Michael Scott
d48ef44d25 net: 6lo: Fix typo in compress bit calculation
commit 2e3e93dccb ("net: 6lo: Fix compress bit calculation") adds
a bit shift to the compress bit calculation, however it's typo'd as
a greater than comparison causing get_6co_compress() to return a
boolean value rather than the shifted version of the calculation.

Change-Id: Idacac2c032a03f1f75a78c94bed4c70428b8c77a
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
0a259d6bd0 net: ipv6: Prefix length was incorrectly set
The IPv6 prefix address length was incorrectly set in net_if
after RA was received from the network. The incorrect "len"
variable was used instead of correct "prefix_len" in the prefix
info struct.

Change-Id: Ifeaf150b9960414d2ad200053a3bd5290dc8d365
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
51dea40f80 net: ipv6: Cancel the prefix timer before setting it again
If the earlier prefix timeout is not cancelled before setting
it again, the system will hang.

Change-Id: I6e271294c8e5d43e3ceae4780b5d1c26bab2b296
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
f7a5612ba2 drivers: slip: Fix memory corruption when receiving packet
It is possible that the slip->last pointer is not set during
the startup of the slip driver if we receive some garbage bytes.
This in turn caused memory to be overwritten in random places.

Jira: ZEP-1737

Change-Id: Ia2ce193b81a8f707b7ca63497d497ea70699bb32
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:44 +02:00
Tomasz Bursztyka
82545373ee net/mgmt: Remove the list node before unlocking the semaphore
The caller semaphore was released too early, this can cause the caller
to re-use the data and possibly corrupt the memory, if caller yields
and is run before this management thread. Solution is to first remove
the node from the list and then unlock the semaphore.

Change-Id: I02cef53559d776f32a5959380e6b7122cd5198c5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:44 +02:00
Jukka Rissanen
157c383260 net: ipv6: Make config options more fine grained
Add CONFIG_NET_IPV6_NBR_CACHE option that is the base for both
neighbor discovery (ND) and duplicate address detection (DAD).

Both ND and DAD can be disabled if needed. If NBR cache is
disabled, then ND and DAD are disabled too.

Note that it makes not much sense to disable DAD or NBR cache
as IPv6 will not work properly without them. It is possible
to disable ND but then the neighbor information needs to come
via other sources like RPL.

Change-Id: I57c8668ad828b3a153dfc58eea78bf5f7ac3938a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
a623209f62 net: Print error if buf or interface are NULL when receiving pkt
Although very unlikely, I saw crashes at startup that could
be because of the buf or iface were null.

Change-Id: I8649eeb4f24fcd7d9f2acaeefaba4e6593388e91
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
207128a869 drivers: slip: Use always the initialized network interface
No need to always look through all the network interfaces
when receiving packet as we support only one interface and
it is always the same one.

Change-Id: Ic0bfabc8409160352081cac1a6c3dbbfa35fe390
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
312a9cbb32 net: ipv6: Enhance debug print when handling pending packet
The fragment pointer is good to print here.

Change-Id: If09e684bbe0f9f5d3f961c4af8f86fb3ff364671
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
b18dd41b2d net: ipv6: Clear pending buf if NS cannot be sent
If for some reason the neighbor solicitation cannot be sent,
then we need to unref the pending packet as that would never
be freed otherwise.

Change-Id: Ied12a9b3a027a2aad3fafd0b5b36c56b5f042c28
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
ff6365c928 net: ipv6: Make sure there is data to be sent
If we are trying to send a IPv6 network packet and there
is no data, then print error.

Change-Id: Ia0e7bebae513f1bcf984e189566ae7e10a90bbfc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
13c1037885 net: ipv6: Use net_nbuf_unref() to get better debug prints
When going through fragments in update_ll_reserve(), use
net_nbuf_unref() in order to get better memory allocation
debug prints.

Change-Id: Ia7ee15b32800acdebeb28125465515132c55e179
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
185f36034f net: Ignore everything in RX if interface is not up
No need to receive anything if network interface is down.

Change-Id: I22d62aeaf4fbef54608818bf6c8073ec2e9a7c09
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
318afc4519 net: Synchronize TX and RX threads startup
Make sure that both the TX and RX threads are running before
we turn the network interface up.

Change-Id: Ie7e5938403e90e1ae76047c221cf9fd2f5a1167b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Inaky Perez-Gonzalez
e1a6c7d472 drivers: slip: Allow specifying the MAC address from config file
The current state of affairs will not allow to set a MAC address and
thus will initialize a random MAC address.

However, when we are in a situation where we are trying to interface
Zephyr OS QEMU VMs with physical targets for testing, this is not
practical. We need to create a macvtap interface, on which we need to
set the MAC address of the Zephyr OS SLIP device so packets can be
routed.  There is no way to guess which random address is going to be
used, and there is no practical way to query it.

So this patch adds a CONFIG_SLIP_MAC_ADDR config
setting. slip_iface_init() is changed to take the code from
slip_get_mac() for initializing the MAC address (which should be
happening there anyway) and if CONFIG_SLIP_MAC_ADDR is set, it takes
that one -- otherwise goes to generate a random one.

Change-Id: I55a68f2743604f310d41c934783eca82084d7e94
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen
fc2542b88b net: tests: Fix the default MAC address
Use the proper MAC address space (00-00-5E-00-53-xx) dedicated
for documentation and specified in RFC 7042 ch 2.1.2.

Change-Id: If8ef9e4ee4e041ad005060664ebafe60df0a6bf9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Tomasz Bursztyka
1dfd399d77 net/mgmt: Remove a useless k_sem_init() and use K_SEM_DEFINE instead
Change-Id: I95ec89ad67f9d40df6773056d5af6a9df1332ca3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:43 +02:00
Tomasz Bursztyka
87b80191b6 tests/net/mgmt: Add 2 unit tests around synchronous event listeners.
Test net_mgmt_event_wait() and net_mgmt_event_wait_on_iface()

Change-Id: I82ba70a697f0d13aa2e1eef2110e139b3621c119
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:42 +02:00