OSDN Git Service

Fix multi-advertising when LE Privacy is not available
authorArman Uguray <armansito@google.com>
Sat, 18 Jul 2015 07:00:50 +0000 (00:00 -0700)
committerArman Uguray <armansito@google.com>
Mon, 20 Jul 2015 20:48:53 +0000 (20:48 +0000)
commit6670e3157c8510bc4b944c6a16d92db56adbb76c
treead332526433120e2b3e7e8f6d202d97fb7b124bd
parentf0e9c46646bf49db05a1dcbecdc0bd64d086f623
Fix multi-advertising when LE Privacy is not available

This patch fixes a bug that caused all multi-advertising instances to be
initialized with Instance ID 0 (which is not allowed by the stack), if LE
privacy is not available. The problem was that the internal data structures that
represent advertising instances were not getting their |inst_id| field
initialized where it's supposed to.

Although far from clean, this code worked before. The culprit for the regression
is "f9fdf890 Random address does not get written properly", which moved the
initialization of instance IDs from the loop in BTM_BleEnableAdvInstance to
btm_ble_multi_adv_enb_privacy. The latter never gets called if privacy is not
available, which leads to partially initialized structures.

Obviously both of these places were wrong to begin with. I saw the word
"init" in a function called btm_ble_multi_adv_init. I figured this might have
something to do with initializing, so I moved the logic there.

Bug: 21267281

Change-Id: I38b9a2a71cd3f45feb267a13bf29f93564ee6075
stack/btm/btm_ble_multi_adv.c