Commit graph

42559 commits

Author SHA1 Message Date
Jukka Rissanen
5604782d6c net: contiki: Send RS, RA and NS ICMPv6 messages properly
Allocate a separate buffer when sending RS, RA and NS ICMPv6
messages to the network.

The ICMPv6 messages are:
RS = router solicitation
RA = router advertisement
NS = neighbor solicitation

Change-Id: Ibe5a1701f78f72dce6460f77e9f659b16c355640
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
1b1cb8e8fa net: contiki: Debug print enhancements in IPv6 ND code
Debug prints were missing line feeds + spaces in neighbor
discovery code.

Change-Id: I1373af38cc7eae103d1a1da527430f2eb63e6b7a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
f9a7e27220 net: contiki: Add Kconfig option to disable ND
User is able to disable IPv6 neighbor discovery.
Normally ND should be enabled but for testing purposes
the ND can be turned off as it simplifies the network
setup.

The default value atm is not to run ND because
we do not have a proper network setup. If user is
running qemu image, then ND should be disabled because
ND does not work properly with tun device.

Change-Id: I0ab7d6ee2ea3bc70918d9adf6f44473f71b3bd29
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
df30c05771 net: contiki: Fix compile error when sending IPv6 NS
Neighbor solicitation message sending had a typo.

Change-Id: Ia2a8b5c0eef60acc093463eb24f33bbe8fb93421
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
e37ed46b17 net: contiki: Timer handling fixes
Now we can wakeup properly if there are multiple Contiki etimers
in the system.

Change-Id: I356818f4b79427c9bf26afca31b1a0766760ca3d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
b342e41bb4 net: contiki: Fix clock_delay function
The clock_delay() function sleeps now correctly either
in micro or nano kernel.

Change-Id: I1df71b64c5f0b46d963ee117252e41be3ddfb1df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Jukka Rissanen
cd83fcd536 net: Enable timeouts and timers kernel support
IP networking depends on CONFIG_NANO_TIMEOUTS and
CONFIG_NANO_TIMERS support so select them automatically
in Kconfig.

Change-Id: Ib3a86ca5a2006da545bed8c13b631d6a8c45ea99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
18b98614a4 Bluetooth: Make signed_value static in periperal sample
This variable is not used outside of c file.

Change-Id: I89b34fb6dd2cdd9dd111b6e33829f170d0ba00ae
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Arkadiusz Lichwa
cf7423a9d2 Bluetooth: Add LE Connection Update Complete Event handler
Adds handler for LE Connection Update complete event.

Change-Id: Ie33b7b01c5b7f828b41225f8ae1337205812fcdd
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:15:40 -05:00
Arkadiusz Lichwa
0f507833f8 Bluetooth: Add defines for LE Connection Update Complete event
Adds HCI layer event defines to be used by LE Connection Update
Complete event handler.

Change-Id: I5c3502054acd4f838a33c55df8d1eefe1acec6b4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:15:40 -05:00
Arkadiusz Lichwa
992e18df97 Bluetooth: Handle LE Remote Connection Parameters Request Event
Adds Remote Connection Parameter Request Event handler and command response
handlers to support LL Connection Parameter Update procedure (BT 4.1).

< HCI Command: LE Connection Update (0x08|0x0013) plen 14                                                                                                           [hci1] 86319.053586
        Handle: 42
        Min connection interval: 38.75 msec (0x001f)
        Max connection interval: 58.75 msec (0x002f)
        Connection latency: 0x0000
        Supervision timeout: 32000 msec (0x0c80)
        Min connection length: 0.625 msec (0x0001)
        Max connection length: 0.625 msec (0x0001)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                           [hci1] 86319.053597
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11                                                                                                                           [hci0] 86319.053600
      LE Remote Connection Parameter Request (0x06)
        Handle: 42
        Min connection interval: 38.75 msec (0x001f)
        Max connection interval: 58.75 msec (0x002f)
        Connection latency: 0x0000
        Supervision timeout: 32000 msec (0x0c80)

	...

< HCI Command: LE Remote Connection Parameter Request Reply (0x08|0x0020) plen 14                                                                                   [hci0] 86319.055663
        Handle: 42
        Min connection interval: 38.75 msec (0x001f)
        Max connection interval: 58.75 msec (0x002f)
        Connection latency: 0x0000
        Supervision timeout: 32000 msec (0x0c80)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Complete (0x0e) plen 6                                                                                                                         [hci0] 86319.055687
      LE Remote Connection Parameter Request Reply (0x08|0x0020) ncmd 1
        Status: Success (0x00)
        Handle: 42
> HCI Event: LE Meta Event (0x3e) plen 10                                                                                                                           [hci1] 86319.055694
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 42
        Connection interval: 38.75 msec (0x001f)
        Connection latency: 0.00 msec (0x0000)
        Supervision timeout: 32000 msec (0x0c80)
> HCI Event: LE Meta Event (0x3e) plen 10                                                                                                                           [hci0] 86319.055692
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 42
        Connection interval: 38.75 msec (0x001f)
        Connection latency: 0.00 msec (0x0000)
        Supervision timeout: 32000 msec (0x0c80)

Change-Id: Ief5d7bd404ce476e48a4d66983a03928d9db11d0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk
f535c0674e Bluetooth: Add possiblity to set advertising mode
This patch adds possibility of setting advertise mode.
If no advertising mode is set, use default value (discoverable).

Change-Id: I86456ca52ad54a2fd4e4c6443a79087ddeb99ec6
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
109d6fb21b Bluetooth: Make bt_uart_open parameters explicit void
Change-Id: I87826f2ab662bb07428cb0ba1edded0ab26d2d5b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk
03706d4644 Bluetooth: Add advertising type argument set possibility
Bluetooth shell now supports advertising type set while starting
advertise.

Change-Id: I1e672b4c9315368dcef38398834acc5541c1843b
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
cfa51f89f1 Bluetooth: Strip command extra spaces in shell app
This makes shell a bit more convenient to use.

Change-Id: I50490eb3cf9434723737a71fb382316876ba6291
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
e28d358d09 Bluetooth: Add explicit help command
This commands print list of all available commands.
On unknown command only short info about 'help' command is
printed.

Change-Id: I780f4fd8da7292192260a0e0af8815fe4e385ae2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
ea80649a83 Bluetooth: Refactor command parameters handling in shell app
Reduce usage of static variables making code easier to follow.
Also improve robustness in case of too many parameters provided.

Change-Id: I6a3f0162a4fb301479ed36c54ceca2967bb7e389
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc
022f1897e0 Bluetooth: Don't print help in shell app for empty input line
If empty input was provided simply reprint prompt instead of printing
uage information. This makes it similar to linux shell.

Change-Id: Ie4d9e1e7cb011ddf14f490188335ddc44289ffcf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk
106656bae9 Bluetooth: Add missing if statement brackets
Style fix - add missing brackets for single instruction if statements.

Change-Id: If37f886949fb8587d6973a19bd2df92af03f7a87
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk
798db87306 Bluetooth: Fix foreach attr lower range for att exec write
The minimal/start valid handle value is 1.

Change-Id: Ief3be01d0bf76193350b7632aedebc559d368810
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Andrei Emeltchenko
eba54d6610 Bluetooth: Refactor btshell app
Use more robust approach when registering shell callbacks. Instead of
allocating maximum number of callbacks use exact memory which is
needed.

Change-Id: I96db75375e8d24df328adc0622c7817a3328f860
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:39 -05:00
Grzegorz Kolodziejczyk
e989683d83 Bluetooth: Fix setting proper conn data for read by type rsp
Att data structure passed to read_type callback wasn't set properly
with connection data. This cause parsing att struct set to 0 (casted
in cb, set in att_read_type_rsp). Wrong att data caused parsing wrong
mtu size and whole conn structure.

Change-Id: Ib0aa4b8edca4965afd746e7186a08cfa34e62cf3
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:39 -05:00
Grzegorz Kolodziejczyk
7b3e771c91 Bluetooth: Print 16-bit dbg uuid as 4-byte hex
UUID format in 4-byte hex is more readable format than unsigned int.

Change-Id: I5e7fa3771d628705b9991c0064c102313573b8e4
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
df8426aad1 net: tools: Move tools directory to net/ip
The net/ip/contiki/tools directory was not in proper place
as it contains also non Contiki code. The net/ip/tools is
a more suitable location.

Change-Id: I1eb621680d4247d56d67ea977120f3c67c013599
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
23a0543aee net: apps: Add coap observe client
Add sample CoAP application for observe client functionality.

Change-Id: Ie2ee5d191bcc68ec634367c9b36e46ea4261d6b5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
088bb9cf0f net: coap: Observe client needs to allocate net_buf
The observe client routines need to allocate a net_buf that
will hold the sent UDP data.

Change-Id: Ia04aacdde266aa93de1b9941eeed0c8292ca83b8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
73e861d351 net: coap: Retransmit needs to allocate net_buf
When a transaction is retransmitted, we need to allocate a
net_buf that will hold the actual UDP packet to be sent.

Change-Id: Ie0d51694b5531938cd1da5c330a308e3e9fd1764
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
5165b908b4 net: coap: Add coap_context_connect() for client
Add coap_context_connect() function so that client can use
it both in DTLS and normal connections.

Change-Id: Ibd8cff904e79a97f97ed6ff20d92078eff110e35
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
5042669536 net: coap: Avoid floating point arithmetics
Use only integer arithmetics when calculating the timeout
value.

Change-Id: Ifc61e1eee4a9a680e9c4f8c89f146417d6cc5ba4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
bfa8358b24 net: coap: Tweaked the debug print when transaction alloc fails
If the transaction allocation fails, then print additional
information in order to find the place of the failure.

Change-Id: Idd59969b2c5eff53170b51a471583ec8c837416a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
b9cc0e27f3 net: coap: Add util function to initialize the message id
The mid needs to be init from server and client code so
create a new function for it.

Change-Id: I662b64c207ac69288648ffbdc950896edd5ade52
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
c796f3cfcc net: contiki: Use Zephyr provided timer API
Refactor etimer and timer Contiki APIs to use the native
Zephyr timers. The Contiki way did not work well anyway
as we do not really have the process concept in Zephyr.

Change-Id: I14743707f3cf43eddfe914717b069204cde4bd65
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
320df470b7 net: contiki: Clock returned wrong number of seconds
The clock_seconds() API returned wrong number of seconds since
initialization.

Change-Id: I4f0f6197327f4ebe12e2c37588d9611ec40d7643
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
48186c99f5 net: Get debug info about available net buffers
Print additional information about how many net buffers
are available when allocating (get) or de-allocating (put)
them. The prints are only available if Kconfig option
CONFIG_NETWORKING_WITH_LOGGING is set.

Change-Id: I85e6a5813356d8fe00f0ba633c3ebf5379e56bff
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
4d745b70b0 net: Create separate net_buf pool for RX and TX use
Have a separate network buffer pool for received and transmitted
data. This way incoming packet flood cannot prevent from sending
IP packets out.

Change-Id: I2aae3bcb4ea63f36355f758de44532b167edfdb8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
458ed33fa7 net: apps: Implement CoAP test server
The CoAP test server runs in Zephyr and it receives CoAP messages
sent by coap client. The server can receive both plain or DTLS
encrypted CoAP messages. The server has various resource plugins
available but currently activates only three that are needed
by coap-client tester.

Change-Id: I6465a3a057eaf8b412699bba57bf7213548f0377
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
c00a7aa320 net: tools: Add CoAP client
Add simple CoAP client that can be used to test
the CoAP server running in Zephyr inside qemu.
The coap-client is run in the host.

Change-Id: I50e4b0e13aa657a0d805b0438050b8b9187d3839
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
6ed897f907 net: coap: Initial client support
Adding CoAP client support to Kconfig and Makefile.

Change-Id: I857169feac8b6c4347af4369b0cdfb806c6aedb0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
20b9a6f845 net: coap: Activate Erbium CoAP support
Add CoAP switches to Kconfig and enable them in Makefile.

Change-Id: I3d5e18f34c0ab0853838c2e883748dd4ae62aed2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
8848f33030 net: coap: Use CoAP context also in non-DTLS case
The use of CoAP context is needed as we do not have
global buffers any longer. This commit adds support
for CoAP context when user does not have DTLS enabled.

Change-Id: Ief716e2a3290bd1f7e5a3286a20deba690b3c1c5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
77b15eba04 net: coap: Port DTLS code to Zephyr
Make the DTLS code in CoAP context to work in Zephyr.

Change-Id: I0c9cd30a02fa6b3f0221f78e1dadd1d476bad646
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
39e5eeef9d net: coap: Initial port to Zephyr
Initial port of er-coap code into Zephyr.

Change-Id: Icb45903387eb08418a3610c1bd0933a9a9c6f8dd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
036eda7b9f net: coap: Use uIP debug macros
Use the debug macros from uip-debug.h so that they are
in one place.

Change-Id: I342d727d4c6af9a655729db6245668968bee4b07
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
d60155d02f net: rest-engine: Initial commit
This is originally from git@github.com:YanziNetworks/netcontiki.git
commit e7d7ee5b142fb7b0695677dac9cc1899620b0fe0

Change-Id: I606b26420b9df841f03bc955039f25970553e481
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Jukka Rissanen
7da5d379e1 net: coap: Initial commit importing er-coap
This is originally from git@github.com:YanziNetworks/netcontiki.git
commit 02bb8eed066c012b4b6033cbe17a31ff15879a24

Change-Id: I4b19302266a6ff562532c493bb34b7cd9a27ee5d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:39 -05:00
Mariusz Skamra
252ddb1565 Bluetooth: Shorten LE Conn Param define names
Shorten LE Remote Connection Parameters Request Event
HCI define and struct name.

Change-Id: Ia094b16caa2716f24afd4cc7db57404050fafeef
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:15:39 -05:00
Szymon Janc
8ac1577641 Bluetooth: SMP: Remove not need double debug
More informative debug is already printed below.

Change-Id: Iff70fef4922bbce649647773a2bc6eb624a13795
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:39 -05:00
Szymon Janc
46f04f3e00 Bluetooth: SMP: Fix not storing IRK on re-pair
conn->dst might already contain identity address from previous
pairing. In order to store IRK distributed in new pairing we
should check address used in connection.

Change-Id: If4bfaf445d31684125246cc98cfad1aab45875ca
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:39 -05:00
Szymon Janc
9764e3dc84 Bluetooth: Implement security_changed callback in shell app
This callback is called when security level of connection changed.

Change-Id: Ifec130163fffe291cd012c99247017bd31173660
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:38 -05:00
Szymon Janc
57daca9341 Bluetooth: Add callback for security changed
This callback is called if security level of a connection was changed.

Change-Id: I268da245cf4b7f6d2bfbd57969ce2da6c34fc69f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:38 -05:00