Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp122390ybb; Fri, 27 Mar 2020 17:34:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuJ6WHbsab+/L3BDN0CBPLiRCzTsT26psDG4T+wysZCrWpthn57l+bjSNXAhFw0KqXB6xvh X-Received: by 2002:a9d:4802:: with SMTP id c2mr1112601otf.78.1585355695148; Fri, 27 Mar 2020 17:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585355695; cv=none; d=google.com; s=arc-20160816; b=MCZ5fgpwiKwz11z53Q/lE27ffnf0nc+s6DTMDeYVSNwNV53B9HK7WE7agNENf0oMab 43OydhUv5TVt/hHblmJLyXhzwGF8TMnAuVmYZUxLkESYwP26lYrIOCB48fMyvcMxIC5y bEBkHb2OAwh0uW0FERJ1QXX4BoNZAL+g+WWO7piKzb1VHJwG/4kC06t5WIrVwCF+k+R7 nPCIJ1MUBuI7nW+fjfBX/6GFHMEh/UkPigSF8yqu0TrCDFmFIhKmbmclPr7TBlTTtkus 8jr07PtT9/8G3WT+SRyIIh3QT9hp7pkRrjcyW5LTHqVey3l8Kn8ynQmgMXYSBU3oOveJ dljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=kKshlVtPK/i5aoOvtr9DXwO8XdpBwa9/c+UGMUDDAvI=; b=Zv7gQ015KaVWNyYY3eiKSmY+yxRxwfI43XEcfP7FWUQSqbA8o8lC0LsM35Bs14FR1r Vy3xZ8lv0mkQbf+gkf6/B9LWuUB0LpPW0TfKrZZsJELWSJPUBweBsIOTvINaZ17we7jD 2If7H1EGdXxhh+p8M40QfC7IogbI4cuI54tsHn3X6fsgF0gExV3nV2fooxp+XfLyLrET gIbUlBex3YzLjPYPmhEKSJYyNmFXbxIVxbsB/Sbm9h2UJnNW7P9PYMixUEMt7ig7MZ8f W6xJRSa03DZ2B6cusAEbBbQVIEhTT+srKi1/BF3WDLvga2lU6C40f3SPe9wMH+CuD8qi G/tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Y9GWKv6E; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n24si591932otr.217.2020.03.27.17.34.27; Fri, 27 Mar 2020 17:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Y9GWKv6E; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgC1Adf (ORCPT + 99 others); Fri, 27 Mar 2020 20:33:35 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:51658 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbgC1Adf (ORCPT ); Fri, 27 Mar 2020 20:33:35 -0400 Received: by mail-pj1-f66.google.com with SMTP id w9so4584612pjh.1 for ; Fri, 27 Mar 2020 17:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=kKshlVtPK/i5aoOvtr9DXwO8XdpBwa9/c+UGMUDDAvI=; b=Y9GWKv6EYAnG832k0igCzlvY0PxMl78P/uumYIn6HrM/2GlbK1QyjvEPv2tUS05MZ9 4HYwG6czoyVi6K/HV6LwgE+4pSxGirvnuqZp/yRI3Wz2+hlZZ2yr74BVPnNrA2zFoYsU E5mRhLGX46skQ4H+8MrcwwKf5+FZk2/1D7Ghw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kKshlVtPK/i5aoOvtr9DXwO8XdpBwa9/c+UGMUDDAvI=; b=kvLBNSluKLMAMk4i8sW+CVoj6L6I3OJLf95SuPyjq998mfrbHvuhsRPGCTHqXY67G7 aFsVmy9qI3+z3BRBeOMvYIfOdQqsVD8QU3ifCA6bAqwGoebS46wJ6/zzVK/gwPlSTmMV U8L5q2X764deLkSAfPiyn5mQ3CbHGmm4Bj5QbKtiXS9EHrF4CdQLVVp5Qb1OVEcTOwp5 kPGdiegLcn8h16SSkJCx0EzEIt1CDzvtL7HzifbZQIQYnDsby5+gJyMS+eJcvmQdgkBN Rgs8zhO8jbcQ/OJc5+pVWVasejv1G6Z1H+scZWK1oqKYteEdj5kC39YibBdZdFNcwQY4 pfPw== X-Gm-Message-State: ANhLgQ1/tVNDppM78toOLAEp9LBFqia/+Qvy66/rBLW4zFBf/VbWVEgY pEdBgfWG6DLS8lECxpW6YDQURbc2Tzc= X-Received: by 2002:a17:90a:cb14:: with SMTP id z20mr2089015pjt.170.1585355613609; Fri, 27 Mar 2020 17:33:33 -0700 (PDT) Received: from localhost.localdomain (c-73-231-41-185.hsd1.ca.comcast.net. [73.231.41.185]) by smtp.googlemail.com with ESMTPSA id g18sm4771575pgh.42.2020.03.27.17.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 17:33:33 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH] core/device: Handle Just-Works auto-accept Date: Fri, 27 Mar 2020 17:33:18 -0700 Message-Id: <20200328003318.13937-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The kernel starts to always request confirmation to BlueZ daemon for Just-Works pairing. In this patch the daemon does auto-accept if the client has clearly indicated a pairing intent by calling the Pair() D-Bus API. --- src/device.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index 69f98e488..db14cc129 100644 --- a/src/device.c +++ b/src/device.c @@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device *device, uint8_t type, auth->passkey = passkey; - if (confirm_hint) + if (confirm_hint) { + if (device->bonding != NULL) { + /* We know the client has indicated the intent to pair + * with the peer device, so we can auto-accept. */ + btd_adapter_confirm_reply(device->adapter, + &device->bdaddr, + type, TRUE); + return 0; + } + err = agent_request_authorization(auth->agent, device, confirm_cb, auth, NULL); - else + } else { err = agent_request_confirmation(auth->agent, device, passkey, confirm_cb, auth, NULL); + } if (err < 0) { if (err == -EINPROGRESS) { -- 2.17.1