diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-26 15:02:48 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-26 15:02:48 +0000 |
commit | 10cdcaa9bc6a49d98dcd3b3c1bf3c807ff82a578 (patch) | |
tree | 2629e08af3fac35107ff6a42b535d6d925847793 /input | |
parent | 5d6c22d60f55e477d42a546da9c04339c735789b (diff) |
Check if the HCI_LM_ENCRYPT is already active
Diffstat (limited to 'input')
-rw-r--r-- | input/storage.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/input/storage.c b/input/storage.c index fab7d6c2..5f467efb 100644 --- a/input/storage.c +++ b/input/storage.c @@ -219,6 +219,11 @@ int encrypt_link(bdaddr_t *src, bdaddr_t *dst) if (ioctl(dd, HCIGETCONNINFO, (unsigned long) cr) < 0) goto fail; + if (cr->conn_info->link_mode & HCI_LM_ENCRYPT) { + /* Already encrypted */ + goto done; + } + if (hci_authenticate_link(dd, htobs(cr->conn_info->handle), 1000) < 0) { error("Link authentication failed: %s (%d)", strerror(errno), errno); @@ -231,6 +236,7 @@ int encrypt_link(bdaddr_t *src, bdaddr_t *dst) goto fail; } +done: free(cr); hci_close_dev(dd); |