An OCF is a 10-bit value as defined by HCI, and therefore requires a
16-bit integer to store it.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed assert due to incorrect implementation of stopping of
advertiser role under directed advertisement timeout, and
also, fixed assert due to adv stop ticker not being stopped
on advertisement disable from thread mode.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added checks for advertiser and initiator/target addresses
received in CONNECT_IND when performing directed
advertising.
This is required to pass TP/CON/ADV/BV-04-C [Directed
Advertising Connection].
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When directed advertisements timed out, connection context
associated was not being released. Subsequent connectable
advertising or connection creation failed.
This is now fixed by releasing the connection context on
directed advertisement timeout.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If the CONFIG_NET_TCP_TIME_WAIT support is disabled, then do not
start to wait for reply to sent FIN in active close, but unref
the corresponding net_context in order to close the connection
as soon as possible.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Refactor whitelist handling into generic filter management in
preparation for future resolving list ID address filters.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Rename bt_gatt_unregister_service to bt_gatt_service_unregister to be
consistent with other APIs such as bt_gatt_service_register.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This initial commit adds the following:
* Handling of privacy HCI commands
* New Link Layer filter module for both whitelist and resolving list
* Advertising RPA generation with timeouts
Follow-up commits will expand the functionality.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Enforce the logical dependency between SMP, RPA generation and privacy
in the Kconfig files for the Bluetooth subsysem.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
For consistency with the return value and to conform with other naming
schemes, rename mem_is_zero() to mem_nz().
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This is unmaintained and currently has no known users. It was
added to support a Wind River project. If in the future we need it
again, we should re-introduce it with an exception-based mechanism
for catching out-of-bounds memory queries from the debugger.
The mem_safe subsystem is also removed, it is only used by the
GDB server. If its functionality is needed in the future, it
shoudl be replaced with an exception-based mechanism.
The _image_{ram, rom, text}_{start, end} linker variables have
been left in place, they will be re-purposed and expanded to
support memory protection.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Use globally available find_lsb_set in Zephyr instead of a
custom find first set function.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Moving the net_buf_pool objects to a dedicated area lets us access
them by array offset into this area instead of directly by pointer.
This helps reduce the size of net_buf objects by 4 bytes.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The net_pkt_split() was incorrectly checking fragA pointer
even before it was allocated.
The unit test is fixed and converted to ztest.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
gatt-unregister-service can be used to remove the test service at
runtime causing service changed to be indicated:
00:1b:dc:07:31:88 (public)> gatt-unregister-service
[bt] [DBG] gatt_indicate: (0x0011e100) conn 0x0011d880 handle 0x0008
[bt] [DBG] bt_att_req_send: (0x0011e100) conn 0x0011d880 req 0x0011db00
[bt] [DBG] att_send_req: (0x0011e100) req 0x0011db00
Unregistering test vendor service
< ACL Data TX: Handle 3585 flags 0x00 dlen 11
ATT: Handle Value Indication (0x1d) len 6
Handle: 0x0008
Data: 0a001000
> ACL Data RX: Handle 3585 flags 0x02 dlen 5
ATT: Handle Value Confirmation (0x1e) len 0
Jira: ZEP-2225
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
With the introduction of Service Changed support it is now possible to
unregister services at runtime.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
GATT is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes applications able to select the value used for the
GAP appearance attribute.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In certain cases a response may happen even before number of complete
packets is generated by the controller:
[bt] [DBG] att_req_destroy: (0x0011cfe0) req 0x0011daa0
[bt] [DBG] att_process: (0x0011cfe0)
[bt] [DBG] att_req_sent: (0x0011d780) conn 0x0011d820 att 0x0011d9a0
att->req 0x00000000
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In preparation towards Privacy 1.2, move implementation that
swapped scan response PDU double buffer to same place as
where adv data PDU double buffer is swapped. So that, change
in AdvA in adv data PDU can be reflected in scan response
PDU buffer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added fix to avoid adv data set function call from
corrupting a ADV_EXT_IND PDU under LE Extended Advertising.
Also, avoid redundant code execution under directed
advertising.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Only ADV_IND, ADV_DIRECT_IND, and CONNECT_IND PDUs can have
ChSel bit set in Advertising channel.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The Bluetooth subsystem assumes execution of its system threads in
cooperative priority, including the system workqueue and the thread
that interact with the controller (i.e. calling bt_send). This commit
adds a compile-time check for the system workqueue priority and
documentation for the bt_send API call.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed compile error due to the missing header file
dependency on bluetooth/hci.h, for bt_addr_le_t, in the
Link Layer header file.
Merge of PR #475 introduced the new dependency that broke
compilation after merge of #474.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added a callback function ll_adv_scan_state_cb from the
Controller that gets called on either an advertiser or a
scanner getting started as the Controller's first enabled
state. The callback is also called on the Controller's
last disabled advertising or scanning state.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing implementation to reset the advertiser state
when directed advertisements stop without a connection being
established.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add Bluetooth Link Layer LE Advertising Extensions commands
for manual testing the feature during development. First one
being advx command to start non-connectable non-scannable
extended advertising.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In order to reuse code, the reset() function is used both to handle the
reset HCI command but also to initialize the internal HCI variables when
bringing up the system. In the latter case, avoid setting the reset bit
in the state atomic and signalling the polling API, since that is not
required during initialization.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
As a preparation for advanced filtering (Controller-based privacy) this
commit refactors whitelisting so that it becomes its own module and
actually correctly performs state tracking to avoid modifying the
whitelist when it's in use.
Additionally it also removes the duplicate separate entries for
advertising and scanning, since the specification only allows one single
global whitelist singleton.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add internal functions to read advertiser and scanner filter
policy if the roles are enabled. This is required to
restrict updates to whitelist and resolving lists when
filter policy are being used by the roles.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Under invalid host behavior, trying to start advertising
while already active would corrupt the advertiser context.
This is fixed by having an explicit flag to check whether
advertiser is already running.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Under invalid host behavior, trying to start scanning while
already active would corrupt the scanner context. This is
fixed by having an explicit flag to check whether scanner is
already running.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
From
http://pubs.opengroup.org/onlinepubs/7908799/xns/netinetin.h.html:
in_addr_t
An unsigned integral type of exactly 32 bits.
[] the in_addr structure [] includes at least the following member:
in_addr_t s_addr
In other words, POSIX requires s_addr to be a single integer value,
whereas Zephyr defines it as an array, and then access as s_addr[0]
everywhere. Fix that by following POSIX definition, which helps to
port existing apps to Zephyr.
Jira: ZEP-2264
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>