Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp914897rdb; Tue, 30 Jan 2024 02:26:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+VHrgX/PCCipBJ4wWK6/3nzHQUF4lti+hHkQA1KAiqdU6eXnAMdvB9nnbw2bHyJdQaOjY X-Received: by 2002:a17:903:1212:b0:1d4:e0e6:693 with SMTP id l18-20020a170903121200b001d4e0e60693mr4810289plh.35.1706610371802; Tue, 30 Jan 2024 02:26:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706610371; cv=pass; d=google.com; s=arc-20160816; b=OS9Ia1wztnfNZ3o+p1z5rKMULqWse5/+Mh8h8sMRoNUFa1oxEjJPb2BbozW1bpz7Rg J9im0b15l4fkueOIQirKsiEuPVft78sVc16wY29jXS8CTU0dJGeCmUoVsqT01BLN36WV uO2CAOXyhAHIm+qduT70aNvn3Hcplv2LEFqgBc2SXAIgfzmmuIzGlujwYBu75qSY4CYL xDoIs23bKhBPhG6zzbKmz0h9E1+RVniju93WLyj0LN41Q3uD9EtDvaFpxfhxBRuwUQiX V0yzKgsVYCwRqBJqa/SFhDmXxSyF+YpEPJID9G50FlKhD5qQPBf7HlFPUYWaysilA9qH GpnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=9ywBcdQss8q6e4ixH8in3qk21AH6SiwYvw4fn6uYBzk=; fh=V5evHB5SqmexcxzF2z7PHVe22Z8eaWwa98YkjJS34VY=; b=cBcvthjbfffGJrwU5fBmmcpXhVXvRVzTl1h3jOMRf6i1bN2VQF2KGodm7hDSEDhLSq jtVy54L8yA/0J32p1KVDKTPEUN9HvHonca494HVRELhPGQPFegDiDA8X8B7Pl/DrEPwi F65PiKHIx5hoULQ+OPiGZkPEL009EDtNg69OqfCgQnU1UPTinQnNw2P8XmiI4z8bNnyP jmyCvhDeTm3QyGk/IZZ6rA86clBv3WcvVMxsU/fxaQfpZ8M6wuyFbikj0Nx62TUCApUq 0LVJYSt/NXM8gyTxkCVzMr936m4QTJcdL3eAM3F2hAxzG83ewibpDXgk8crixvJIqNx6 Svpw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Wc3680bx; arc=pass (i=1 spf=pass spfdomain=flex--apusaka.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h10-20020a170902f2ca00b001d8d8961d2bsi3575532plc.577.2024.01.30.02.26.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:26:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Wc3680bx; arc=pass (i=1 spf=pass spfdomain=flex--apusaka.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D217B2851CF for ; Tue, 30 Jan 2024 10:25:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B86860DDE; Tue, 30 Jan 2024 10:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Wc3680bx" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CADE60DC9 for ; Tue, 30 Jan 2024 10:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706610335; cv=none; b=g6Q6ltTFBoRSr0r2Jm6sB1JRMOnObYIIXXdNvOvgyu8R+Dj6YFudVJPSVvccgAtr1I5sIpkzWOd7atqPX5kbK/KUCXHPW6135dTgOvgyflqBqBzPsjpRa3QN/CQ9+Z4dBWaqR/KUDAlKlNW0rxCHORTfIsuD8ONEK+tmBhTUMEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706610335; c=relaxed/simple; bh=7+yer1B1xGXZd+b5cYdwisoEZEyllw7IlGJHz5RU0jY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dOA5l60HRhoJ4xWzgfVVn66aTQbZPCX1QPAQBb5giy/QoicHpyLOJ2vpzvJD0FwGz+lLOHaxWGreBcYtfew5DWy/8njOJFoNn+WDlCksBjcmI/maBaAZfK+XnBnfGaBOmyhysWsjcJmuijJ7AxlT8OzFzVzbmtSNkui0Z3G63cc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--apusaka.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Wc3680bx; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--apusaka.bounces.google.com Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-1d8dee47308so17602105ad.2 for ; Tue, 30 Jan 2024 02:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706610334; x=1707215134; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9ywBcdQss8q6e4ixH8in3qk21AH6SiwYvw4fn6uYBzk=; b=Wc3680bx+XQRuUQALYvMtDXPVHBUKoZ6StWuDEC4g84vwEut2EnMrLWy6uTJbN5wXa 9cZt0eS+kLBb6l5kv9uOQtV8WuRVCKzLduIquYexbt/aL6+EbZ1BBG7c7WELksbCDhsx AtJzgUf+Rap23IMxWdpA6ooD1zEbzxbRi4XBTZilfTVH49Tun+03+tOMsYzCRBjZf1w3 mPU7ZkJ+beki8GCLXXafQ1OV9I2QlbGRRtHudkh8E1shoIIE6c+gBlUdZc1CrRq9wc1X 79plXoc8WQZvmqQqnGLt39ta/KlXkhkh3ALgkQVDMXfstlFR0dHVLHQGJ7FEPDIQgVCP K7Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706610334; x=1707215134; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9ywBcdQss8q6e4ixH8in3qk21AH6SiwYvw4fn6uYBzk=; b=SUC4WmjYMrTjq4OMsukK3STFTPddGIkbdcBQYQdFd7VHR82STO219DpVgrRlcdAHXu EhoL2TYSpYJXcg1hSEyoHpmK9ly7ixxidh21it+L5gsVlPAnhSrmbLrXMUnHExWY6wzn nWZxDyTI5f5mdMUWaKU0NCZqN4oA1A+vxWikljnGasL2pZbWaMzxylnMrRwWEMxP0YFL QOaG/sRBjpbRqviEArOBixscCmQ1ATR9HE/EOldwBcufTfZN4Ud1s3S5TfL+X/b0nLdt UN5Wq9r2HoMc9tCw1vypRq71XbU3weFYzJiBS5nKVqWb8g/2O3REnQh6aPOU61VsCfy9 vs9w== X-Gm-Message-State: AOJu0YxS0hRoc+S5a6VYUKfF5mOSYhoxaOe6FSk3l4s8yr6GZHryqa8C +ZETZlrtqq5JzvXCgKWqYqkY2rD0iNXa2MkoirBSgmEExkc7uMuH/SnU4MQUCO3M9gLqBjUHpMG UOZgvV/OYX/sDI8wUsegEg72Pez3ixFx+UuhPrHAaU2Sxrd2qUcDOcY+g8rJqcDEMLK/v8gNkFC E5QYNMLOM8J0sZaQZmqKXtBlnzQ8P6+mMUnaRUWfgBJUaCxMhNjA== X-Received: from apusaka-p920.tpe.corp.google.com ([2401:fa00:1:17:683d:ac9b:1d63:b3ff]) (user=apusaka job=sendgmr) by 2002:a17:902:f212:b0:1d8:dbda:46b9 with SMTP id m18-20020a170902f21200b001d8dbda46b9mr26358plc.1.1706610333239; Tue, 30 Jan 2024 02:25:33 -0800 (PST) Date: Tue, 30 Jan 2024 18:25:00 +0800 In-Reply-To: <20240130182459.Bluez.v2.1.If74ccbca4d541c5f576765a3a78cb8923b5f85b1@changeid> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240130182459.Bluez.v2.1.If74ccbca4d541c5f576765a3a78cb8923b5f85b1@changeid> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240130182459.Bluez.v2.2.Ic61e507a408f2dab76fd079263b565802fe3537c@changeid> Subject: [Bluez PATCH v2 2/2] Monitor: Avoid printing stale address on connection event From: Archie Pusaka To: linux-bluetooth , Luiz Augusto von Dentz , Johan Hedberg , Marcel Holtmann Cc: CrosBT Upstreaming , Archie Pusaka Content-Type: text/plain; charset="UTF-8" From: Archie Pusaka We now remove potentially stale handle when assigning a new handle. However, that is done after printing the handle and the stale address associated with it. Directly use print_field instead of print_handle to avoid printing the stale address. We still print the correct address on the following line anyway. --- (no changes since v1) monitor/packet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitor/packet.c b/monitor/packet.c index 164cc82bb2..3c32735b73 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -10083,7 +10083,7 @@ static void conn_complete_evt(struct timeval *tv, uint16_t index, const struct bt_hci_evt_conn_complete *evt = data; print_status(evt->status); - print_handle(evt->handle); + print_field("Handle: %d", le16_to_cpu(evt->handle)); print_bdaddr(evt->bdaddr); print_link_type(evt->link_type); print_enable("Encryption", evt->encr_mode); @@ -10655,7 +10655,7 @@ static void sync_conn_complete_evt(struct timeval *tv, uint16_t index, const struct bt_hci_evt_sync_conn_complete *evt = data; print_status(evt->status); - print_handle(evt->handle); + print_field("Handle: %d", le16_to_cpu(evt->handle)); print_bdaddr(evt->bdaddr); print_link_type(evt->link_type); print_field("Transmission interval: 0x%2.2x", evt->tx_interval); @@ -11084,7 +11084,7 @@ static void le_conn_complete_evt(struct timeval *tv, uint16_t index, const struct bt_hci_evt_le_conn_complete *evt = data; print_status(evt->status); - print_handle(evt->handle); + print_field("Handle: %d", le16_to_cpu(evt->handle)); print_role(evt->role); print_peer_addr_type("Peer address type", evt->peer_addr_type); print_addr("Peer address", evt->peer_addr, evt->peer_addr_type); @@ -11213,7 +11213,7 @@ static void le_enhanced_conn_complete_evt(struct timeval *tv, uint16_t index, const struct bt_hci_evt_le_enhanced_conn_complete *evt = data; print_status(evt->status); - print_handle(evt->handle); + print_field("Handle: %d", le16_to_cpu(evt->handle)); print_role(evt->role); print_peer_addr_type("Peer address type", evt->peer_addr_type); print_addr("Peer address", evt->peer_addr, evt->peer_addr_type); -- 2.43.0.429.g432eaa2c6b-goog