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>
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>
Style fix - add missing brackets for single instruction if statements.
Change-Id: If37f886949fb8587d6973a19bd2df92af03f7a87
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
The minimal/start valid handle value is 1.
Change-Id: Ief3be01d0bf76193350b7632aedebc559d368810
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
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>
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>
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>
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>
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>
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>
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>
Use only integer arithmetics when calculating the timeout
value.
Change-Id: Ifc61e1eee4a9a680e9c4f8c89f146417d6cc5ba4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
The clock_seconds() API returned wrong number of seconds since
initialization.
Change-Id: I4f0f6197327f4ebe12e2c37588d9611ec40d7643
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
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>
Adding CoAP client support to Kconfig and Makefile.
Change-Id: I857169feac8b6c4347af4369b0cdfb806c6aedb0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add CoAP switches to Kconfig and enable them in Makefile.
Change-Id: I3d5e18f34c0ab0853838c2e883748dd4ae62aed2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
Make the DTLS code in CoAP context to work in Zephyr.
Change-Id: I0c9cd30a02fa6b3f0221f78e1dadd1d476bad646
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Initial port of er-coap code into Zephyr.
Change-Id: Icb45903387eb08418a3610c1bd0933a9a9c6f8dd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
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>
This callback is called when security level of connection changed.
Change-Id: Ifec130163fffe291cd012c99247017bd31173660
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
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>
There is no need to define for each descriptor its own read handler.
Each string descriptor will use generic string read handler if
possible.
Change-Id: I468a082c6875400ec4515588131132ef27cc8082
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Adds HCI layer defines to be used by LE Remote Connection Parameter
Request routines.
Change-Id: I7274a33c704c47d81612dd67bd732ba48d3aa1c8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Adds new error codes to be used by Remote Connection Parameter
Request handlers.
Change-Id: Ief163350c677f251ea30c0ff2f1b70b86ee2a5f6
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
bt_conn role can be set when LE Connection Complete event is received.
Controller indicates to both Hosts forming the connection their role
in this connection.
Change-Id: I35455eff54afa30665611415ac52e19089f2e649
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
When identity is resolved only Identity Address should be used for
identifying connection.
Change-Id: Ic179286b09afced4997a755f1977eea818bc6e54
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This callback is called if identity was resolved for remote device
that was using Resolvable Private Address while connection. From
now on only Identity Address is used.
Change-Id: I5976be575a8e4ad8c13f56d7bc274d751ae37511
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Since initiator and responder addresses are already tracked it is
no longer needed to store source address in bt_conn structure.
Change-Id: I048e4d4659f4b7d29b101f9f3c5708f66c773906
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
When remote device initiate pairing but its IRK is already known
identity address was used to calculate confirmation value. This
resulted in 'Confirm Value Failed' error and pairing failure.
To avoid any confusion simply track initiator and responder addresses
used for connection.
This fix re-enabling security with iPhone if device was unpaired
only on iPhone side.
Change-Id: I07d9589bee5fea7f6b028472b1709090a5755e31
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
When sending security request for connection with pending high
security level, authentication requirements should indicate that
MITM is required.
< ACL Data TX: Handle 64 flags 0x00 dlen 6
SMP: Security Request (0x0b) len 1
Authentication requirement: Bonding, MITM, Legacy,
No Keypresses (0x05)
Change-Id: Ie78e021726063b0eee415bfa7189962fe0b2d94b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
When re-pairing was successful (indicated by enabling encryption with
STK) old keys are no longer needed as those will be replaced by keys
distributed in new pairing.
Change-Id: If2a81e8e94f35eb04ce9a7e4d782094632cbd77a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The -i (interface) option was not described in usage.
Change-Id: I50d01f0e639d3258234c5573abd8836a7144584e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add note about possible firewall issue in host.
Make sure you run echo-server as a root user.
Change-Id: I9ebe06db799eef8664d7d7ccb38827280e338f9d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
So return 0 if all the tests run ok, and !=0 if some failed.
Change-Id: Ib66d84dbcc6cc29e5e46609b1e2b1b1748ce6fcc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The test application name was printed incorrectly.
Change-Id: I1686dd886c26cd94dbf2482fe904bd61e66d4a78
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use the nano_fifo_get_wait() API when waiting network packets.
This function will block until there is data in the socket.
The timeout version called nano_fiber_fifo_get_wait_timeout()
is not working at the moment.
Change-Id: I42bddf8921cae0ed3caec8226b6086833534ae65
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>