User can activate RPL timer debugging by setting
CONFIG_NETWORK_IP_STACK_DEBUG_RPL_TIMERS config option.
Change-Id: I66079640e4135a0f85620cc4eca04612eee1a890
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can activate RPL OF debugging by setting
CONFIG_NETWORK_IP_STACK_DEBUG_RPL_OF config option.
Change-Id: I9c7b59eb6d782702b5a9159f4915d3f58f732d5c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can activate ICMPv6 RPL debugging by setting
CONFIG_NETWORK_IP_STACK_DEBUG_RPL_ICMPV6 config option.
Change-Id: I957ec5d32149ede00f87f63de28a4a7f43936c1a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can activate generic RPL debugging by setting
CONFIG_NETWORK_IP_STACK_DEBUG_RPL config option.
Change-Id: I3b044c6308d6f20cb42d21edb59119321aa8bfbb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User is able to use either sicslowmac or nullrdc plugin for
RDC (Radio Duty Cycle) layer. Default is sicslowmac.
Change-Id: I51f72f0d5de67a271178b51f29644bea39ffa19f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Make debug messages fit in one line which is much more readable.
Change-Id: Ia0087bdea03d2eb34fca104850cf3acd3f61ebe6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can toggle 802.15.4 network driver debugging from Kconfig.
Change-Id: I63f8e319172bce0561123416d18397468da671bf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set CONFIG_NETWORK_IP_STACK_DEBUG_15_4_FRAMING
to get debugs from 802.15.4 packet framing code.
Change-Id: I58155df19b6d63686a96ea410801d45632eb566b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set CONFIG_NETWORK_IP_STACK_DEBUG_15_4_MAC
to get debugs from 802.15.4 MAC layer code.
Change-Id: Ie385c586caad1602869260146a1ea92d961b73c3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set CONFIG_NETWORK_IP_STACK_DEBUG_6LOWPAN_COMPRESSION
to get debugs from generic 6lowpan fragmentation code.
The generic code is shared between 802.15.4 and Bluetooth
bearers.
Change-Id: Iae6dcebe8fb4269e15bac5dcec2b63e79b4abcd3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set CONFIG_NETWORK_IP_STACK_DEBUG_15_4_6LOWPAN_FRAG
to get debugs from 802.15.4 6lowpan fragmentation code.
Change-Id: I3a199cf9e5696a1017a290d182a0d7176b1c259e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can activate debugging in network stack when packets are
received and sent by setting CONFIG_NETWORK_IP_STACK_DEBUG_RECV_SEND
option in config file.
Change-Id: I7b45b6f9053664a03aa7dde79e7000b6063ac822
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
siscslowpan_fragmentation would only free net_buf on failure.
nullmac does not touch the net_buf, this results in all net_buf
being exhausted eventually.
csma always frees the net_buf, so in case of failure there is a double
free with the one from siscslowpan_fragmentation.
Fix:
ref net_buf before every send, unref on every callback and once at the end,
regardless of result. Don't free or ref the net_buf in csma.
Also, replaced some code in fragment() with a call to send_packet()
Change-Id: I4f329810ace07c09cde8f7522a83a1d6681f0906
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
When using the CSMA MAC driver, a new packet can be queued before
all the fragments of the previous one were sent. The transmit_packet_list()
function will start sending the old fragments with the new net_buf context.
Keep a per-context neighbor_list to avoid that
Change-Id: I9d41a923c48f597cc95a8f8c9f67884c5caac02c
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
When using the CSMA MAC driver, all send() calls but the last one
return without uip_last_tx_status(mbuf) being updated. If a mbuf
has uip_last_tx_status(mbuf) != MAC_TX_OK and is freed, the next time
it is allocated the first send() call will appear to fail and the packet
will be dropped.
Change-Id: I0fb388714f8071947fa0641fbe03e063550328db
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
If the client is waiting for a response but the link is disconnected it
should be notified as the request may never be complete otherwise.
Change-Id: I1fb83b63d8effb4ef2a8f838566c1e68deae9f2c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Need to use the network buffer when sending CoAP serial message
because the message was constructed to net_buf.
Change-Id: I9422ff3f5f93945f1f9f91f2ed8572e3715338ce
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
User can set the desired number of network packets that are
sent. There is an example config that sends 10000 packets
and then stops the test application.
Change-Id: I5aa9049236f7bebdc9ea9997b9eb1f672c6adcbf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The commit cd8d4eb2b7 caused
compilation error in coap.
Change-Id: Ie6fb24d7f213a12936d75a2a2fac350e4965e0b8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This allows to create outgoing BR/EDR connection and cancel pending
connection before it succeed.
Change-Id: I5c08bb2e89f79c09fa7930f860d6080d902186a1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
When user creates a socket using net_context_get(), the function
requires local endpoint IP address. This should not be a NULL
pointer because the storage for that IP address was statically
allocated inside the function. Because of this the user needs
to allocate the storage for this and pass that local IP address
to the function. The net_context_get() will fill that local
address to sane value if user passes ANY address (== all bytes
are zeroes) to it.
Change-Id: I88314957f07912d9ecbe517a2402822401d81bd9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
csma MAC driver queues outgoing frames, returning an OK status code immediately.
This defeats logic in sicslowpan fragmentation driver that drops remaining fragments
on send failure. The result is packets reported as sent successfully when they were
not, fragments sent that cannot be reassembled by receiver, packets dropped before
the first fragment even reached the radio driver.
nullmac MAC driver sends frames synchronously, resulting in sicslowpan driver working
as intended.
The MAC driver used by 802.15.4 is selectable now, nullmac is default but csma can be
used instead.
Change-Id: I261d551421a8f55634acb1c528f8f82bea49332d
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
Move network testing setup from echo-server to common net_testing.h
file which makes the application much simpler.
Change-Id: I6f68826916c870ad7db597d30f20245bada70091
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The link layer header length isn't always taken into account when
determining the application layer data offset. To avoid potential data
corruption, add the link layer header length where appropriate.
Change-Id: Id718dec8cd5991b561cb13e1304ffdb3dda09da5
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Put together specific for BR/EDR interfaces.
Change-Id: Icfc4d0ebd129b8fcbb547a7f21336cd4c950657c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Reorganizes mostly by using preprocessor (indirectly Kconfig options)
strictly LE-SMP related interfaces and security interfaces shared
between LE and BREDR connections.
Change-Id: I90daa36d72403cd5b73e6791714fcaf7f1fbe8e5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
The Read Response only contains a Characteristic Value that is less
than or equal to (ATT_MTU – 1) octets in length. Include also equal.
Change-Id: I139d1460159aafa2187e04cddd8df57d42807c67
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
There were no spaces around printed IPv6 address which
makes it hard to read.
Change-Id: Ia5f8dad7d21fe8a9a4feb9976b1a90fe624102ab
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
bt_auth_cancel can be used to cancel any type of pairing.
Change-Id: Ia1a6ba834186ab6d5082d3eb473319c2d70cf4a7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
As per 7.8.12 the check on timeout (time unit ajdusted) must be:
timeout * 10 > (1+latency) (max * 1.25 *2).
Change-Id: I0181b3ab2e1ad38bce9312b6bd83e49082d49024
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
This add following handling of LE SC debug keys:
- if debug keys are disabled locally generated public/private keys
is checked to not match debug keys by accident
- if debug keys are enabled those are used as local public/private
keys pair allowing sniffing of encrypted air traffic
- tracking of remote device using debug keys
- debug keys are discarded after disconnection regardless of bonding
flag being set or not
- due to HCI interface limitation debug keys are not supported for
HCI based ECDH and compilation error will be rised for such
configuration
Change-Id: Ie147b1893c4a6b9542b4d2c261973a7acbd8de96
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This uses ATT Indicate Value command to indicate changes and wait for
confirmation response.
Change-Id: I123a00e374929d779f96a02440215c32c0e79423
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds the callback necessary to parse Confirm PDU:
< ACL Data TX: Handle 3585 flags 0x00 dlen 8
ATT: Handle Value Indication (0x1d) len 3
Handle: 0x001d
Data: 00
> ACL Data RX: Handle 3585 flags 0x02 dlen 5
ATT: Handle Value Confirmation (0x1e) len 0
Change-Id: I870058150f27718541eae959dcd5d9d7c6414ad3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If the received packet is discarded either if it was not meant
for us or it was malformed, then do not print anything.
This helps in an environment where there are lot of traffic
in the network.
Change-Id: I8db8dcec472ccceb9ba8b6cb7cee6c5f13ee34f0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Next discovery for primary and secondary services shall start from the
next handle.
Change-Id: I8bc7ccd9a84848d75b2d9ef0484429599b0c750f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This handles Reject command which currently only affects pending
Connection Request where the remote may actually respond with Reject
when it is not implemented.
Change-Id: I0095259230955ee7dd605fad9339a7b5e8f1611b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Do not depend on uart_pipe_send return value. Just assume
uart_pipe_send call to uart_poll_out sent data through uart.
Change-Id: Ifc7119f94b625d4f2895d92d44d660013bf50145
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
NETWORKING_WITH_15_4_TI_CC2520 is already depends on
NETWORKING_WITH_15_4, so no need to select again.
Change-Id: I74970a6d550a049dc69734048d1e6eaa13be36b6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Few configuration related header files were missing license
header.
Change-Id: Id4ef8273a80eb41f39248dd33ccefbeb30ef57dd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of new config option for debugging, lets re-use the
existing logging option CONFIG_NETWORKING_WITH_LOGGING that
is found in Kconfig. Unselecting that option will turn off
the debug messages in IP stack.
Change-Id: I4c1e0e91f3959304b7dc2b62d2bf73ec87cd1114
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This fixes warnings when compiling without
CONFIG_NETWORKING_WITH_LOGGING.
Change-Id: I50ee7004ba5c662ef2d6ff32b5dd3e1e41a92b5b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If enabled, the stack usage is now printed every 60 secs.
Also changing the code to use the kernel ticks clock API.
Change-Id: I44eabd0c372dfb8983ef379e12e38e5bf94a99d2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The network timers will now use the fiber wakeup to let the
network timer fiber to get the next event. This enables the
timer fiber to sleep much longer and only wakeup when there
is something to do.
Change-Id: Ia69d92392c02b884c036793de41b38b6489c4d2e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adds HCI protocol type for Secure Simple Pair Complete event and enables the
event in controller.
Then implements the initial SSP Complete event handler with catching
the status of SSP process.
Change-Id: Ic7cc5b4cab8a1b4120285815c24eeb6483d748df
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Enables IO Capability Request event in controller.
Adds handler to react on controller's IO Capability Request event during
incoming pairing.
As a initial case respond to the request with negative reply setting
reason as 'pairing not allowed'.
Change-Id: I161c7ab7f1031a78cfa50444f41624232e5c5146
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Those two indicate SMP failure, so while in keys distribution phase,
if we receive Pairing Failed, or there is SMP Timeout, the keys
distributed so far shall considered as invalid and cleared.
Another flag SMP_FLAG_KEYS_DISTRO is needed to save the old keys
if this failure appears before distribution of new keys.
Change-Id: I9a917740c02955aa149170b84ae547f5c8c4b7ad
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Enables IO Capability Response event in controller and adds remote IO Capability
and authentication fields to connection object.
Initializes them using IO exchange values delivered in SSP IO Capability
Response event data set representing remote as a part of incoming pairing
process.
Change-Id: Ia73a912f6fb633d1d1bb086ef3af9a280ac5a864
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Turns on Secure Simple Pairing mode in controller. Since there's a prerequisite
the controller is 4.0+, turning the mode is unconditional.
Change-Id: Id4a10ccf8892a430b0daaa6750835516b17b7e8a
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
It will be possible to enable/disable debug messages from IP stack from
make menuconfig, instead of modifying the relevant files to do so.
Change-Id: I065f10bcc2bc3579081b2fcdb1c47e12d148e2f1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Changes the local netbuff name to be more generic and to be used later in code
initializing BR/EDR stack.
Change-Id: Iae177237c813a46cbd10720a7af3474632154678
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This makes sure NETWORKING_WITH_6LOWPAN and 6LOWPAN_COMPRESSION_IPHC are
selected properly and update IPSP sample to only include the minimal
config options so it can test if this is working properly.
Change-Id: I2565cbd4f79d91eaba348d43933aa893c6dc6ace
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Original copyright notice was lost when the file was copied
from Contiki.
Change-Id: I5e008b92cb3898255a7940dc2c61320014222610
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The file names and types were incorrectly described in comments
in net/ip/contiki/sicslowpan/ directory.
Change-Id: Id6aba238a08ec603a57f9a438dbf6fab202220f8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of returning a 'void *', the nanokernel fiber_delayed_start()
family of routines now return a handle of type nano_thread_id_t.
Consequently, the nanokernel fiber_delayed_start_cancel() family of
routines now accept a parameter of type nano_thread_id_t instead of
'void *'.
The complete list of affected nanokernel routines is:
fiber_delayed_start() fiber_delayed_start_cancel()
fiber_fiber_delayed_start() fiber_fiber_delayed_start_cancel()
task_fiber_delayed_start() task_fiber_delayed_start_cancel()
Change-Id: Ibd4658df3ef07e79a81b7643a8be9ea5ffe08ba0
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
It is more intuitive for the end user to enable IPSP by
selecting the BT network driver which then automatically
enables relevant Bluetooth options. The earlier way
required user to select L2CAP dynamic channel support
first before he could activate IPSP and this is not very
logical and user friendly.
Change-Id: Idde0da80a2a19670e217ae9a9a4717e8399559e7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Since the return value of these callbacks is a number of bytes ssize_t
is more appropriate than int.
Change-Id: I3406fb382975d62f51e7a195666d0ae88364fd2c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Currently the packet is dropped if some other packet needs to
be sent instead. This does not make much sense in Zephyr so
activate packet queueing where the saved packet is sent later.
The queueing can happen e.g., with neighbor discovery where
the packet to be sent requires ND to be done before the actual
application packet is being sent.
Change-Id: Ia321d641eec5acfbc9f8f581de712801a483e32d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the user unsets CONFIG_NETWORKING_WITH_LOGGING, it will mean he
really doesn't want to get any network stack logging output.
Change-Id: I0629a045adbf8916327a8a9ba69b6e6e9ee2e7d9
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Fixing this issue:
net/ip/l2_buf.c:81:31: note: in expansion of macro 'NULL'
#define inc_free_l2_bufs_func NULL
^
net/ip/l2_buf.c:88:2:
note: in expansion of macro
'inc_free_l2_bufs_func'
inc_free_l2_bufs_func(buf);
^
Change-Id: Ie58f23af479ec4f2dd625b1f0f36720bbe54f928
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Instead of manually creating bit shifts for individual bits use the
BIT() macro that exists for this purpose.
Change-Id: I599ecc16b3a2cffe8a355e19816c405e51937e91
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Including zephyr.h instead of microkernel.h will also bring in
sysgen.h, which may not be available at the time these files are used
during the build.
Change-Id: I5e9e33a06a5877c6077bceebbab1bee6479fddc0
Signed-off-by: Iván Briano <ivan.briano@intel.com>
Keys storage is present also for non bonded devices. Add helper
that checks for actual keys being present in storage that may be
used inline.
Change-Id: Icfc758e3ac89e88ca48948e5193878cf5689611a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If remote device indicates no bond pairing there is no point in
storing any keys. If no keys are stored key storage is freed on
disconnection. Keeping key storage around while device is connected
is important for GATT being able to check encryption key size also
for paired but not bonded devices.
Change-Id: If80e9d4c6da02e73c8730972a7a388b0b7d14ba6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This add an error to the output which helps detects failures in case
debug is not enabled.
Change-Id: I2f4ed357ccf288c15b231d637bf1986af9ecbf37
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Introduce BT_GATT_ERR macro to make it possible for application
callbacks to return exact ATT error codes.
Change-Id: I971536508e75036fbddc40b3f33e5201e11940bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
For now this only exposes the various ATT error codes.
Change-Id: If568782e90dca22871681d2d3b2d81ae4cb8e5e4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In preparation of creating a public att.h rename the existing internal
header appropriately.
Change-Id: I8588712bc5aa57d391c5ce0886c99692e5a2823e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This fix not being able to stop advertising while connected due to
invalid use of BT_DEV_ADVERTISING flag.
Change-Id: If5578fa2c69dd18d6623d05ae44d4710cce9a9e5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
BT_DBG already add a new line so that '/n' is not necessary.
Change-Id: I7b25470386e2a7228a684665301d2d28d1360808
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth links are point to point so it shouldn't be necessary to do
neighbor discovery, futhermore it blocks transmission if the remote
doesn't respond which seems to be the case with Linux.
Change-Id: Ic8997f9c5bc832ba71f71e20e6317ee0c79d250d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If other peers were present but not in CONNECTED state temporary
connection reference was leaked.
Change-Id: Icc32bfe1a86f92a9d8472991476ebfd26c889d84
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Channel context was cleared before calling bt_gatt_disconnected
which resulted in passing NULL conn to it.
Change-Id: I486d1cf6662716584c2c973366a9c9654f499802
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
During endup pairing as acceptor update security level and link encryption
state on connection complete event.
Change-Id: I6189a3c6675c080e3ab2610c81b617294dbd98d5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
To skip around forward declaration in next security update patch,
move up part of strictly BR/EDR related code.
Change-Id: Id44fc831f629e66660edbc43c187cbf9a88b771d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
When during legacy incoming pairing (as acceptor) the runtime is passed to user
to enter a PIN, mark such interaction and keep it valid until proper
authentication reply API handlers are called.
Change-Id: If63015f5beb256873925602adc6a8e5ff9d3b00f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
As a pairing acceptor starts tracking 16 octets PIN entered by user
when pairing devices working in Security Mode 3. Based on PIN tracker
state, the generated link key is saved in keys database as combination of
un/authenticated and legacy key type.
Change-Id: I4cbb20942fb38697d952971df807aec8b16c74e4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Check server instead of psm after lookup.
Change-Id: I80fe916432b69b376f04083980f1208aa7befbb1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
A helper for the (fairly common) task of decoding individual 8-bit
values.
Change-Id: Id7e97df152232d5dd9861cf1e107877f1b8febaa
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Applications may want to fine-tune the stack size of the fiber that's
used to make callbacks into the application.
Change-Id: I2cd3e79283fe85359389528e84d9bcc21e3e19f6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
legacy_pairing_rsp is used only for legacy pairing. Fix following
with CONFIG_BLUETOOTH_SMP_SC_ONLY set.
CC net/bluetooth/smp.o
net/bluetooth/smp.c: In function 'legacy_pairing_rsp':
net/bluetooth/smp.c:1207:16: warning: implicit declaration of function
'legacy_get_pair_method' [-Wimplicit-function-declaration]
smp->method = legacy_get_pair_method(smp, remote_io);
^
net/bluetooth/smp.c:1209:8: warning: implicit declaration of function
'legacy_request_tk' [-Wimplicit-function-declaration]
ret = legacy_request_tk(smp);
^
net/bluetooth/smp.c:1216:10: warning: implicit declaration of function
'legacy_send_pairing_confirm' [-Wimplicit-function-declaration]
return legacy_send_pairing_confirm(smp);
^
net/bluetooth/smp.c: At top level:
net/bluetooth/smp.c:1201:16: warning: 'legacy_pairing_rsp' defined but not
used [-Wunused-function]
static uint8_t legacy_pairing_rsp(struct bt_smp *smp, uint8_t remote_io)
^
Change-Id: I0d65efa71859c23cf5b6f0bfa3386a23543bf907
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If controller based ECC is to be used and it is not supported
LE SC are disabled.
Change-Id: I4cf48152fe28cb5678434925de63caaaba493d68
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Since now TinyCrypt is always enabled there is no need for HCI
backup code.
Change-Id: I6cf9c2bd15dc9a6c0dd98cd7aff0ea137eb0be8b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
TinyCrypt provides implementation of AES CMAC so there is not need
for internal implementation in SMP code.
Change-Id: I15fe0daf8fca8c44b002636983b46502419c57a5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This can be useful for both LE and BR/EDR connections so it sits
outside of those specific structs. The values are intentionally
matching the HCI values so for the HCI case we can just do a direct
assignment.
Change-Id: Id78d304bb61e5fd941f2c35351758c1eecc6ab6a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
User is able to tweak the stack sizes of 802.15.4 RX and TX fibers.
These fibers are responsible for receival and transmission of
6LoWPAN 802.15.4 network packets.
Change-Id: I28dea287c1d939333fef0c1ac4eb890295c7bd9e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User is able to tweak the stack sizes of RX, TX and timer
fibers. These fibers are responsible for receival, transmission
and re-transmission of IP network packets.
Change-Id: I43238180e628ed47f431ece0bc6dfcdfb035325f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There is no need to keep help message in quatation marks as those
will be shown in menuconfig.
Change-Id: If47e7bb029cfc17c7def971c563178ba38120731
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This enables use of ECC from TinyCrypt. Since ECC is heavy this option
is separated from general use of TinyCrypt in SMP code.
Change-Id: Ia550e4a5f89240c8e15d2b5acccc21993b44b471
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
There are many situations when encoding data when we need to insert
single bytes to the buffer. With this helper the encoding code stays a
bit more readable.
Change-Id: Ibc0ce43af5ae25a1baa0f1adbc5816ae7c04e3bb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This allows to use ECC implementation from TinyCrypt instead of
controller based ECC.
Change-Id: I09bdff78899c1ac5cd1d10243d4c00c4d0a75d83
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The option is named CONFIG_TINYCRYPT_ECC_DH.
Change-Id: Ice30857d368582f5bc5d2f47e8ce6b1a89e29128
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If application needs to send large packets, the 802.15.4
fragmentation code needs to store the fragments somewhere.
Currently this somewhere is stack which means that we
need to increase the stack size quite a lot.
Change-Id: I9b08563e77c021e5ac103e637e331d7b977563cc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There is no need to keep this in bt_dev structure as this is not
used outside of SMP code.
Change-Id: I24a1d9daffb4d382bf1ed07a5645e4cbdafa3c5e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
These are needed both by nble as well as the HCI stack and will likely
also be of use for applications.
Change-Id: Ifd10ae6df25151162d9d5491466324b4a42f5506
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a single option for enabling use of TinyCrypt library for
crypto. This option selects all required TinyCrypt options
depending on BT features enabled. Thanks to this applications
only need to select single option instead of set of required
TinyCrypt features.
Change-Id: I2862e9ad3e204635f2ed3199433982bcfb7112f6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This allows to use pseudo random numbers generator provided by
tinycrypt instead of constant using of HCI LE Rand command.
HCI LE Rand commands are used only to initialize and re-seed PRNG.
Using tinycrypt for NRPA increase size of sample shell application
from 86852 to 89700 bytes.
Change-Id: I06e7392d087908caf37cd3ae648ea0bd5cc4ce61
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The l2_buf struct contains variables that Contiki uses
for it's state management. It is important that we
initialize these variables into sane values otherwise
there will be hard to catch errors like overwriting
memory in other parts of the system.
Change-Id: Id0f552a6f0f2858fc6e8e4964ada0715a40f46f8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add read parameters to read callabck
Merge bt_gatt_read_multiple functionality into bt_gatt_read.
This makes it easier for application to handle all types of reads
as same sematics is kept for them.
Instead of destroy callback, call read_func with NULL data to
indicated that read has completed. This makes it clear when
read is completed and parameters used for it are no longer needed.
Thanks to this application doesn't need to abuse user data destroy
callback for detecting if read has completed. Since destroy callback
is no longer needed it is removed.
Also note that bt_gatt_read doesn't take any user data parameter
and that destroy callback was acctually called with read parameters.
If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_read_params.
Change-Id: I8d6ea136b1e61c1dae73cca868b53c48c45a5492
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This removes destroy callback for userdata as bt_gatt_subscribe
doesn't take any user data parameters and that destroy callback
was acctually called with subscribe parameters.
We assume subscription is active if bt_gatt_subscribe returned 0
(ie write command was sent). This is due to remote might be sending
notifications before reply to write.
Also note that bt_gatt_subscribe doesn't take any user data parameters
and that destroy callback was acctually called with subscribe
parameters.
If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_subscribe_params.
Change-Id: I58ac9cd481ffa08ccc2d7a0464ca75f61fb280c5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Parameters should be checked according to specification. Previous
implementation don't check properly given timeout. Additional check of
lower timeout limit was required.
Change-Id: Id6d302de9c8c9952c0f61107a1ef8d9fa727bffb
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
When building 128b UUIDs, the uint16_t needs to be swapped in the
big order case only, as explained in the comments
Change-Id: Ia998d333c9a22c9989763f3729fe42c0edf16545
Signed-off-by: Louis Caron <louis.caron@intel.com>
Applications should be able to update the connection parameters.
Change-Id: I446f64fcd0b27b605e636e566fb35a362a92de96
Signed-off-by: Louis Caron <louis.caron@intel.com>
Instead of destroy callback, call discovery_func with NULL attribute to
indicated that discovery has completed. This makes it clear when
discovery is completed and parameters used for it are no longer used.
Thanks to this application doesn't need to abuse user data destroy
callback for detecting if discovery has completed.
Also note that bt_gatt_discover doesn't take any user data parameter
and that destroy callback was acctually called with discovery
parameters.
If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_discover_params.
Change-Id: Iec4eb9795975ef2555502e13a682e13ff37742e0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Applications that need it can retrieve the connection
parameters at any time, connected callback for example,
and eventually handle the connection update callback or
not, this gives maximum flexibility for handling these
parameters and requesting change.
Change-Id: Iba7d30ade045875ebc721fd332e031d9008e248c
Signed-off-by: Louis Caron <louis.caron@intel.com>
Sometimes the timer fiber was flooding stack usage to console.
Change-Id: I3518cc08f3c8d3ed8ccc19e7bbb6356811e28ab7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In anticipation of supporting a local static random address in the
future it makes more sense to call BT_LE_ADV_ADDR_PUBLIC
BT_LE_ADV_ADDR_IDENTITY.
Change-Id: I4826f1dfb50b54e13a35cbe7ee74e28641c81ad1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We need ICMPv6 support if IPv6 is enabled.
Change-Id: I5e6ffe83d8299916bb268d136264f3e5cf6f91e6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The ICMPv6 NA (neighbor advertisement) packet length was not set
correctly so no NA message was sent.
Change-Id: I7ddf41545f4b07da669d29f2529f5b04d3bc8b75
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IPv6 neighbor discovery is needed when dealing with real
brearers like 802.15.4, so enabling ND by default.
In Qemu and if SLIP is used, then the ND needs to be disabled
as it does not work properly with tun devices.
Change-Id: I8baf11e71fb546b698a0a3d18fcacb142744db60
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
An all zeroes address is in principle not valid, but prototype devices
have been seen using it. To avoid false-positives with the
bt_conn_lookup_state_le() API use a NULL pointer rather than
BT_ADDR_LE_ANY to indicate that any connection in the specified state
is of interest.
Change-Id: I42a1946e47173b17be295b1b7e97a654dbdcdc6a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There are always 2 additional bytes for SDU length in first packet
and those needs to be taken into account.
Change-Id: I3c202cd969524036b42d919bc001e75b8c2faaa0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If link is already encrypted controller issues "Encryption Key
Refresh Complete" for "LE Start Encryption".
Failing to update keys resulted in invalid security level being set.
Change-Id: I8d8dd1682937bd35a35111366ec6ebdaa619db7c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
There are no more users of this API, and the only user it had in the
past was quite a special corner case. Just remove it for the time
being.
Change-Id: I696139b493f9ca75530665de25a4a4e03fc0ac5b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Introduce new UUID API with bt_uuid, bt_uuid_16 and bt_uuid_32
structs. The specific size structs are derived from the common bt_uuid
struct to make it possible to use CONTAINER_OF().
Change-Id: I9cb03c73406acb7768d410fdf29eae75d252163c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Destination CID identifies the channel endpoint on the device
sending the response. So in disconnection response DCID matches
CID used for TX.
Change-Id: Id42d61536bcc208e868ac889c738e7c40bcf5a9a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The l2cap_chan_le_send_sdu code was not taking into account that
bt_l2cap_send adds its on headers which means buf->len != ret won't
stop once the last remaining segment is sent since it reuses the
original buffer len is not consumed.
Change-Id: I774da976fb4f71127ae30adf1e02d52946fb9592
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Buffer returned by l2cap_chan_create_seg should be unreffed if
disconnected.
Change-Id: Ib794ecc98618eddc9d92b2dc2edf829c50123418
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
To access the 16-bit value of GATT UUIDs it's quite overkill to first
create anonymous UUID structs and then access the value member from
them. We can simplify this a lot with the help of the recently added
UUID value definitions.
Change-Id: Ib58012c20d07b3e60e5911cea6feb73301d1323c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This enables simpler permissions as it is not longer needed to include
BT_GATT_PERM_READ or BT_GATT_PERM_WRITE.
Change-Id: I0c749b75bedb125bda8ea451474c82eec13d3c38
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The current format used is a swap of RFC 4122 thus the 16 bit values do
come at the end not at the beggining and data need to be swapped.
Change-Id: I38a27cdf82a28d28e47675f719772278d85deaaa
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In legacy passkey entry method confirm value is sent first.
Change-Id: Ic379650dab64715be6d281fa8d3389f5ff34a978
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Use uint8_t for pointer arithmetic when clearing SMP context so that
correct memory is cleared.
Change-Id: I8b88bc4c2eb181397bce5fb80a6ab250086cb17d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The ICMPv6 RA payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().
Change-Id: I3dc64cfce669de54283db290cfb009b2c6ea7225
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The ICMPv6 NS payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().
Change-Id: I5bf53695c811c27a75320fea7331d91782a9748a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The ICMPv6 RS payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().
Change-Id: Iddedb7b6674f30c7943c0ba59c0afc7d244a1e0d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Delivers a valid Link Key to controller if found or responds negative
to Link Key request to controller.
Change-Id: I98061110a60b066421f35db44455925cbcd3076e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Get access to available link encryption related handlers.
Change-Id: Ifcf4cf3af11368ca68cd93d3023a020bb01a7b74
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This patch adds two missing includes necessary for building IPv4
support.
Change-Id: I381d0951df4ee615867743dbde551666b603fecc
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
Applies '__stack' tag where necessary to ensure that stacks are
properly aligned.
Change-Id: Ibbce5d4656f69db6c9b5006d15e0a0eb231c7af4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
FIFOP setting is a wrong assumption to know if radio is on.
Transmission runs on clock basis instead of pre-set loop counter. Thus
removing useless config option relevantly as well.
Opmitizing a bit the code as well, and making cc2520_on() public for
testing purpose.
Change-Id: I4495d1d6c19d10dcbc18f7e2fd5041720ec1f438
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Integrating it into network stack. Centralizing all in drivers/802.15.4
Change-Id: Ia2916ff652afe5fe736f6560c2ed4a911a5f0679
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Use existing macros from Zephyr and apply proper code style.
Change-Id: Ia3d572054aa702ce33ceae04eff931cfb900c45c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Updates connection object keys using generated link key and mark the
key as legacy after successful pairing initiated by remote.
Change-Id: Idcd02ea12c45f6f19f6675a2d6161a8349dde170
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Updates keys interfaces allowing to store and locate legacy link key
in keys database.
Change-Id: Ibd50edff890e998e3c6f80ee7f1442dff7a7c91f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This make more sense since the handles are normally self allocated by
the stack.
Change-Id: I198dd9c3ef6259cff8a0e528514918ec18990dea
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This add bt_gatt_attr_next function that can be used to iterate to next
attribute which is convenient if original attribute is known and using
bt_gatt_foreach_attr would require a lookup and another function to pass
as callback.
Change-Id: I1bd522fd4ae784e08aa375b35320191cbfc03a54
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
We shouldn't respond with an error if the read of UUID failed.
It's because we don't know if this UUID was the one that client
requested in the Find by Type Value request.
Change-Id: I34c336b9afc3520194fbddaaee8a44d51beabad5
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This fixes bug where wrong service handles have been sent while
discovering the primary services. We should skip Secondary Service
contained in range 0x0006-0x0009 in this case:
> ACL Data RX: Handle 64 flags 0x02 dlen 13 [hci0] 619772.398445
ATT: Find By Type Value Request (0x06) len 8
Handle range: 0x0001-0xffff
Attribute type: Primary Service (0x2800)
UUID: Generic Access Profile (0x1800)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 619772.403821
ATT: Find By Type Value Response (0x07) len 4
Handle range: 0x0001-0x0009
With this patch:
> ACL Data RX: Handle 64 flags 0x02 dlen 13 [hci0] 618945.922607
ATT: Find By Type Value Request (0x06) len 8
Handle range: 0x0001-0xffff
Attribute type: Primary Service (0x2800)
UUID: Generic Access Profile (0x1800)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 618945.927933
ATT: Find By Type Value Response (0x07) len 4
Handle range: 0x0001-0x0005
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Change-Id: I7bb743e8787bc294ba447be5e21e250f0128ec68
This enable applications to build with a single table representing the
database where attributes don't have to store a pointer to the next
attribute thus reducing its size.
Change-Id: I4c84e2d50f9088a2f9879068890f0646e586e007
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes invalid att pointer dereference to get the tx MTU size.
Change-Id: Ifc7911ee58fd4ddff10d1839aff5df9a6e805de8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This fixes bug where wrong service handles have been sent while
discovering the primary services. We should skip Secondary Service
contained in range 0x0006-0x0009 in this case:
ATT: Read By Group Type Response (0x11) len 13
Attribute data length: 6
Attribute group list: 2 entries
Handle range: 0x0001-0x0009
UUID: Generic Access Profile (0x1800)
Handle range: 0x000a-0x000e
UUID: Unknown (0xaa50)
With this patch:
ATT: Read By Group Type Response (0x11) len 13
Attribute data length: 6
Attribute group list: 2 entries
Handle range: 0x0001-0x0005
UUID: Generic Access Profile (0x1800)
Handle range: 0x000a-0x000e
UUID: Unknown (0xaa50)
Change-Id: I8121521e76476826296a2bedf9e18ef008f81363
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Add API definition and stubs for directed advertising.
Change-Id: Ib22d3acb6d2e76b0c638b26b8e07860cd189f640
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
All of the authentication APIs deal with bt_conn objects. For
consistency it makes therefore sense to use the proper bt_conn name
space with them.
Change-Id: I47912d542373df511524cc6ad2532d6c9a76ca68
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
To have some proper split of conn.h and bluetooth.h APIs make sure all
bt_conn related ones are in conn.h. This also helps avoid forward
declarations for some upcoming patches where we need bluetooth.h
defines from within conn.h.
Change-Id: Ief3d32118a6749fb5785dab6cb3fee4ebb86ddb4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
It's not a good idea to silently truncate the data if we got a too
large array from the app.
Change-Id: Ie4541599c6846efd53c81310c8d1e4dd5ec00cee
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The advertising data and scan response data HCI commands are almost
identical so we can save some code size by having a helper function
for them.
Change-Id: I9f80477ab7837c0a8efa0f9219552ea1426978d4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This option will be used to determine if bt_gatt_attr need to store the
next attribute or if it directly accessible by index.
Change-Id: I98fd43931d67d6c3be3b7a130e6fd2f97f2c4a3a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This way we can pass any errors back to the application.
Change-Id: Ic53b858a73436e1c9c4d03e358aeffae7fd837ab
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is essential so that the application can be notified of
connection failures and also be able to know the reason for the
disconnection.
Change-Id: I30108958963f6aeac690612bb26738dc4c67ca80
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is a minimal fix as for now only LE fixed channels are supported.
Change-Id: Id88cae49f5cdbe3b9d3695995929d601a3b561bd
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This function is always called with valid connection.
Change-Id: I756990a22f7c56939fd8e92c498d722a0467ab84
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
There is no need for using conn security calback while l2cap
channel provides encryption callback.
Change-Id: I84872bca7a7b4334b52810bafd0faa2bb1e381de
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The authentication APIs may fail, so it's fair to give the application
a chance to catch these errors.
Change-Id: I323df86b94a823b201fe22d412e6bbcaa9029550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use __packed so that enums consume the smallest possible size (in our
case the same as uint8_t).
Change-Id: I0440113e88a24509f406375d99173ddb54890925
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Update the advertising API according to what has recently been
discussed and agreed upon.
Naming-wise the most important change is the removal of "EIR" which
was confusing since this is mainly used with LE at the moment. The
Core Specification Supplement consistently uses the generic terms data
and data type to describe what we're dealing with here, so the new
names are bt_data and BT_DATA.
Another change is to detach the actual data from the struct by
converting it from an array to a pointer. This is not only essential
for supporting BR/EDR (which has a different length) but to also
minimize memory usage.
Another change is to require the caller of bt_le_adv_start() to
provide the array lengths of the ad and sd paramters. This way we
don't have to have the empty (8-byte) element at the end of each
array.
Lastly, the bt_le_adv_start() logic is slightly modified so that it
will always clear the respective data if necessary. Previously the
user might have been left with a previous callers data if it passed
NULL to the API.
Change-Id: I318026ceb1b52bb688edf4dcfed82613bd15c3e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Allow to query for connection info in every state. For BR/EDR
connection destination address is valid in every state. For LE
addresses are initialized to BT_ADDR_LE_ANY until connection is
completed.
Change-Id: I0f0abcd0ff0119a82ef8eeb40c8ee3af25eb89b4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This timeout is used only on LE link to cancel ongoing LE connection.
For BR/EDR link controller will handle page timeout.
> HCI Event: PIN Code Request (0x16) plen 6
Address: XX:XX:XX:XX:XX:XX (Sony Mobile Communications AB)
< HCI Command: LE Create Connection Cancel (0x08|0x000e) plen 0
> HCI Event: Command Complete (0x0e) plen 4
LE Create Connection Cancel (0x08|0x000e) ncmd 1
Status: Command Disallowed (0x0c)
Change-Id: I6a03da7f935f0c560d57f18abc16069d79e2be69
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
If connection was not found or PIN handler is not present legacy
pairing should be terminatde with negative PIN reply.
Change-Id: I8a8658f6eb28173537f39226c3792957a28aa7b2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Move PIN checks up to caller and make pin_code_reply handle just
HCI command.
Change-Id: I159aada8f097407d8ccdc53031ea280e69204091
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
There is no need for tracking if connection object exists.
Change-Id: I14047631b4697f892139a414c248542a2b3ae3d6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Always enable in connection object context fields related to security
requirements and encryption.
So far they were enabled only when Kconfig BLUETOOTH_SMP option is on.
Change-Id: Ib7da9ba1df97df5c08b00769c8ba078dfa63ff56
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Converts bt_keys type to atomic_t flags to enable consistent and
compact key type management.
Change-Id: Ie384168da6d5d0d1b305a33988ce7689ba3a4c6a
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Removing unneeded check makes code consistent since there is check only
in one branch. Moreover since code is executed in tx_fiber frag cannot
be NULL (result of bt_conn_create_pdu()).
Change-Id: Id2f19279f604ad52019d9c334bc29641e4341037
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Print two digits (0 prepended) till 0x0F. Do not print any
count in the beginning of output.
Change-Id: I07e8437f827604565fc8b86d81a105b3986f0a72
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
CoAP context send message data pointer is internal to coap.
ip_buf_appdata points &uip_buf(buf)[UIP_IPUDPH_LEN]. coap
internal data pointer assignment to ip_buf_appdata is wrong.
So copy data to ip_buf_appdata.
Change-Id: I3f11da382a227572c9080b210104a5b8e3dc34b4
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
In Read By Type response, GATT Server shall send UUID of a included
service only if this service UUID is 16 bit. Otherwise GATT Client
will send Read Request to get 128 bit UUID.
Fix tested with PTS.
> ACL Data RX: Handle 64 flags 0x02 dlen 11 [hci0] 1125351.430506
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0xffff
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 12 [hci0] 1125351.435346
ATT: Read By Type Response (0x09) len 7
Attribute data length: 6
Attribute data list: 1 entry
Handle: 0x0002
Value: 01000200
> ACL Data RX: Handle 64 flags 0x02 dlen 7 [hci0] 1125351.605504
ATT: Read Request (0x0a) len 2
Handle: 0x0001
< ACL Data TX: Handle 64 flags 0x00 dlen 21 [hci0] 1125351.613432
ATT: Read Response (0x0b) len 16
Value: efcdab89674523b10040510450aa00f0
Change-Id: Ie07ec7930663b04dc134ee1c5a95c4e0670f5926
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
According to Core Specification 4.2 Vol 3, Part G, 3.3.3.4,
Server Characteristic Configuration descriptor shall be:
"Readable with no authentication or authorization.
Writable with authentication and authorization defined by a
higher layer specification or is implementation specific."
So there shall be separate authorization permissions
for write and read access.
Change-Id: Ia2850acbb976571743bf96cf9cbe0c1128534073
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Changes the nanokernel semaphore API so that the timeout parameter must be
specified when invoking nano_isr_sem_take(), nano_fiber_sem_take(),
nano_task_sem_take() and nano_sem_take().
This obsoletes the following APIs:
nano_fiber_sem_take_wait()
nano_fiber_sem_take_wait_timeout()
nano_task_sem_take_wait()
nano_task_sem_take_wait_timeout()
nano_sem_take_wait()
nano_sem_take_wait_timeout()
Change-Id: If7a4bce1bd8ec8d6410d04f3c16ff1922ff0910e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Changes the nanokernel FIFO API so that the timeout parameter must be
specified when invoking nano_isr_fifo_get(), nano_fiber_fifo_get(),
nano_task_fifo_get() and nano_fifo_get().
This obsoletes the following APIs:
nano_fiber_fifo_get_wait()
nano_fiber_fifo_get_wait_timeout()
nano_task_fifo_get_wait()
nano_task_fifo_get_wait_timeout()
nano_fifo_get_wait()
nano_fifo_get_wait_timeout()
Change-Id: Icbd2909292f1ced0bad8a70a075478536a141ef2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
If pairing is rejected due to unsatisfying auth requirements
pending response buffer should be freed.
Change-Id: I8bbdad5fac8cd6dbcd674c7ad9725cf44ef79004
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This patch introduce new Kconfig option that is used to indicate if
device should operate in Secure Connection Only Mode. Enabling this
option removes support for LE Legacy Pairing.
Change-Id: If224b6786f4c840959fe87a31f0224bc1e21f90e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
We can calculate the length with strlen() and there should be no need
to consider anything else except nul-terminated C strings.
Change-Id: I02ec4b1dddbb1bd457f035926c86b27f4c2ab050
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Enables generate link key notification event when legacy PIN code
pairing is done well and give possibility to grab the link key for
later connections.
Change-Id: I5e661c203bbebfa8aa931662a479a1b921f7ace9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
When PIN code authentication is requested now there's a way
for user to respond with negative reply.
Change-Id: I800bf535f6ae98ee367393c686d6897f50b5fe8b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Using empty eui64 array resulted in net_set_mac() failure and
address was never set. This used to work only due to
linkaddr_node_addr being being global (and hence zeroed).
Change-Id: Ie21de35a628956c6221b6f1e4c96a1807a1d2804
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This introduces bt_uuid_copy which can be used to copy UUID values.
Change-Id: I22d996bcace454769ac871a43b9acebe8b23db39
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Enables get basic connection info support for non-LE connections.
Change-Id: If295b552567886256cfc1e215bfe3149d2f1f60c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Unmasks pin code request to be able service
pairing request from legacy 2.0 devices.
Change-Id: I5c09232d8e6e2c7673a35205e0bfeb8c8240388e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Moves object handling user authentication callback interface exposed
in public API to hci core module and exports internally LE SMP
authentication handlers.
The stack authentication API methods call based on connection type
the correct internal methods. Currently only LE SMP backend
is implemented.
Make getting local io capa in runtime.
Change-Id: I17459096616a620467b4fa01c53fd4bc0b59af9b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
If GATT client is enabled but SMP is disabled NULL SMP backend
needs to provide bt_smp_sign stub.
LD zephyr.elf
net/built-in.o: In function `bt_att_send':
net/bluetooth/att.c:1747: undefined reference to `bt_smp_sign'
Makefile:757: recipe for target 'zephyr' failed
make[2]: *** [zephyr] Error 1
Change-Id: Ia740d6c7ca7d65b78f7ecb781275d1f4d635baf7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This fix a regression where incorrect confirm function was used
for legacy pairing.
Change-Id: Ia39aed6b8e9a3cb24b451cdb0219f41ceb5e6c6e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
The fragments we create should not be greater than the connection ACL
MTU (which the code already does correctly) but they can also not be
greater than the buffer has room for data. Fix this by taking the
minimum of the connection MTU and the buffer tail room.
Change-Id: I27462d7e8752773c632d212b28e53a8cf6519972
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This was not building due to bt_l2cap_create_pdu API change.
CC net/bluetooth/smp_null.o
net/bluetooth/smp_null.c: In function 'bt_smp_recv':
net/bluetooth/smp_null.c:59:2: warning: passing argument 1 of 'bt_l2cap_create_pdu' from incompatible pointer type [enabled by default]
buf = bt_l2cap_create_pdu(conn);
^
In file included from net/bluetooth/smp_null.c:32:0:
net/bluetooth/l2cap_internal.h:136:17: note: expected 'struct nano_fifo *' but argument is of type 'struct bt_conn *'
struct net_buf *bt_l2cap_create_pdu(struct nano_fifo *fifo);
Change-Id: I5fd8ce63da09af1c123b1092624d48edc009756b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
BT_STACK depends on BT_STACK_DEBUG_EXTRA, therefore moving it there.
It also allows to use BT_STACK in drivers, at the moment only
Bluetooth stack uses it.
Change-Id: I41e0e0d49dae6abef2dc3a8d1d109127787d3db0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This is in preparation for LE SC only mode support where slave LTK
support is not compiled in.
Change-Id: Ia30ca08010f8aa42752c4a422fd0ddc1fbdb4f31
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Make sure the name reflects that it is used only for legacy pairing.
Change-Id: I757311991e9f879f377978b8adb02c7f9758b6b2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
All legacy pairing code is now separated in dedicated helper functions
(with 'legacy' prefix). Main code flow is LE SC oriented and legacy
pairing is always handled as exception from LE SC code:
if (!atomic_test_bit(&smp->flags, SMP_FLAG_SC)) {
return legacy_foo(smp);
}
This is in preparation for enabling LE SC only mode.
Change-Id: I89705e6b780014417adaed41bd3beaf4791d8d3f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This function is not used outside of smp.c file.
Change-Id: Ib2158330959f2b4b1d63695480e82ac506243ab8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
In order to support more standard descriptors, the PF macro and helper
function are added.
Change-Id: I52db3c32f40f39b9c6bfdb9573d0a614d0f3295e
Signed-off-by: Louis Caron <louis.caron@intel.com>
In order to support more standard descriptors, the UD macro and helper
function are added.
Change-Id: Ic9a82658668107b40abc5c98002fe5091dc10f08
Signed-off-by: Louis Caron <louis.caron@intel.com>
This patch replaces bt_gatt_attr_func_t with bt_gatt_discover_func_t
to be used as a type of discovery callback. The reason is
bt_gatt_attr_func_t don't return bt_conn which could be used
later on to issue other commands and to application to know
from which connection this results come.
Change-Id: I1f26c72ad5c8a0b97485a337c7005d34281586d7
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Include expected opcode to print together with received opcode.
Change-Id: Iacc73c12f22fe0585e2753d709646bacd3e73d32
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
We use fiber_delayed_start() for starting delayed fiber. Make use of
fiber_delayed_start_cancel() instead of
fiber_fiber_delayed_start_cancel().
Change-Id: I2399290496ed2a2b21b2a780d884881839f36767
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Instead of storing a pointer to the status (4 bytes) we can just copy
its value directly (1 byte). Since the previous variable is a 16-bit
opcode the smaller 1-byte variable should fit within the same 4-byte
word, saving 4 bytes from the stack.
Change-Id: I406c60c7b2563ba6397ab75cf1dbe3d346b6c0ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This makes it simpler to add the services directly into GATT services
table.
Change-Id: I090c7f9396329cf524947dd6647230c663a55f60
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Add basic color logging support. Error logs will be printed in red
whereas warn() logs in yellow. The support is behind a Kconfig option
in case someone needs to build the stack for a terminal that doesn't
support the ANSI color codes.
Change-Id: I080e32db68f87e81f1bb54aa4c634f7cd38f1e33
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
PROJECTINCLUDE is not required in app makefiles.
Change-Id: I3751b7c51c453dfe47d207bb11d171138668c4e7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Whenever selects BR/EDR support in Kconfig, make BLUETOOTH_CONN
option be set as well due to for BR/EDR devices fundamental behaviour
is interact with others by making ACL based connections.
Change-Id: Ieffd2fc6aa47278112be177e5a7e2021e50b0fa3
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
As a cleanup of just made disconnection don't touch LE specific
actions.
Change-Id: I0c7c42f47ac8f6683380124df571fa2b2afbf526
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Enables getting by host connection complete event and handle
internal state of related to the event connection object.
Change-Id: Ie6252ff33cc2e1fff5a4ce746fda7c3a59bf8aab
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
Defines helper routine to look up conn pool object for existance
of instance matching requested bluetooth address.
Change-Id: I31e05afb2346c7dab14e7ba1bd2f4e1378876ae0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
To conform to API convention rename BT_CONN_TYPE_BREDR to BT_CONN_TYPE_BR.
Updates stack code so far uses it.
Change-Id: Ia759ef68bbdb232e3b0992740e0536d310e19010
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>