Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3164468iob; Fri, 6 May 2022 21:04:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylRzQZJj7cl5IUDnA+dV/qxRfuks0KMyEQHhSCDL/kJJva8M+iMldjJvE+Ahs2ygR1cesj X-Received: by 2002:a50:fe1a:0:b0:425:e276:5adf with SMTP id f26-20020a50fe1a000000b00425e2765adfmr6878682edt.284.1651896271782; Fri, 06 May 2022 21:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651896271; cv=none; d=google.com; s=arc-20160816; b=xa/WVzxbSOXgf65OoQA35MsdfzyGoWUnKpIdJRDODZExFBgILYqPJ3LoL9ZgiZ5G6d ynIm71f/pGCS8BmwgpAIlIka4HSGJjKCTRbwoXqnopw95MflrWLGjnf9AKNMsYV3DPlD OJz2hqgnhazzfpzt0EsN4Zq4OoDY6OnYoJrzh9fHQQJHqPBkfb4SPfh8XAlEOPZYW54z K74HoWEy6GxNAbjso3fbCQo3ZJKECPt6M/sLTzXpqSqBjLl2dDVpSbyjo+CjiYMJNwtO tl2kc0h1PND1m4ojpNjYFVAZPGq++rqu5jLjhhnWIWbuYd7f50y/TJjbVOhJGpZ+0JsN 2omg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=gZGmnHFBIKFDMNtGKtzPHZvKsJZMXHVNZs1J3SKNZHk=; b=YlMosZ1M1Fk0bqyI3WbclSuDv8XGONGbKdIgHZwVggTTLC/ZVeusFMfBWLLLNpLZKK LxT5mKjoaIM2qflG2F+5vxUmtJt3Dw3dqx2xXM1vWzzmEPIm5kIqTx82tBBWR54kzgsJ rTCurBCr99Ph3O5too+GDvAMprvQ5QMpeYPrLlIjpR9t/6ChQJRiJgcq9BpNTr+CtL4O mV8P5EyW1yY6FkrytRH32H49GVSN21KzNwC/mlWdvqCCBt9bh6uaJJhko0530vwHPrAM SEeuwCdHL2CrLCcJoCQoPeEIf6hyI2TPAb8oWoI5Bt9EKGA+8PwUVPYw42mB2eUWZ8Xs 24tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="mqW4sD/2"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb5-20020a1709071c8500b006f50917110esi5951897ejc.163.2022.05.06.21.03.39; Fri, 06 May 2022 21:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="mqW4sD/2"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386294AbiEFXMF (ORCPT + 99 others); Fri, 6 May 2022 19:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355923AbiEFXMF (ORCPT ); Fri, 6 May 2022 19:12:05 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BE149F11 for ; Fri, 6 May 2022 16:08:20 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id fv2so8257710pjb.4 for ; Fri, 06 May 2022 16:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=gZGmnHFBIKFDMNtGKtzPHZvKsJZMXHVNZs1J3SKNZHk=; b=mqW4sD/2pzcOlWfkG/4HPMCs+3YOC3HTz3/YfLkj46P1EHnqYACeBsHaaDSqpF/Pw8 T6lH4Gdek6iE2H0CV6tW3UfK2QLWwYWC+hpoWme7QQH47aEg35dNgVzeMI2lCvHD8r8m gsg41UnEH4byU3xGIgFDxw99JITzhGf4aPmm6C3TEok71ewkZXtc5dIVQ8pLayGk8UJH IMwL8eeHexoy3iiviawmTLXQ0zBG1P9pMUozGrZFQbDcaGZym5hSFjB0JHO8HyhQ8DHQ 4z2pSU3hygVC0UaomcYJempNgUgpQGVRYKT/R4Jl9yFnAba3ZCuzgQaDdIhiRsq9TRr0 6RyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=gZGmnHFBIKFDMNtGKtzPHZvKsJZMXHVNZs1J3SKNZHk=; b=ytHsg+Tm9OMEF3DaAmzIF5eHg5HT6qjUPEqDBE7n8IJaKMWEh792tc/hwshCaJqdkr LvjpUnGCcycvZL0ypfmsFca/quhgaGkEY6tfJ5NVhpMPxWP5iMvfOy0D75mXPHpvJhR7 +hK5O39yrL4NlhXu5iwvOQt0WNOY/wfXhFtz6w8mdECobCfsKTl/WJvCfMobGVLLI/qw 22et3rXKii3p7s/Bljxuwbctb6Es4LlRB5pwvGAbYY3YIpFWmjKeGs9fcUskpa14D0Yk RCwpRGJw+6w+Qmm3K41PSP1TCOK2yDysxk3UGBpMpTHgEoRcckSox0y+rm/BvonSpd6f Y0TA== X-Gm-Message-State: AOAM531FGfTdVS803WZ5nxy+0W1Nlm0WY2xuiwH5YwbN3++MZ1fwAB+D ytZ9GsbNQA+ugHTC5ltMwpfHm+CyVho= X-Received: by 2002:a17:902:7e06:b0:159:6c1:ea2b with SMTP id b6-20020a1709027e0600b0015906c1ea2bmr5906550plm.105.1651878500047; Fri, 06 May 2022 16:08:20 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id d4-20020a170902f14400b0015e8d4eb1fbsm2265822plb.69.2022.05.06.16.08.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 16:08:19 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] advertising: Treat empty LocalName the same as omitting it Date: Fri, 6 May 2022 16:08:19 -0700 Message-Id: <20220506230819.3954905-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This treats empty LocalName ("") the same as omitting it so not name is set in the advertising data since some D-Bus binding seems to have problems to omit properties at runtime. Fixes: https://github.com/bluez/bluez/issues/337 --- src/advertising.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/advertising.c b/src/advertising.c index 2110f17c9..ca23774ba 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -533,7 +533,15 @@ static bool parse_local_name(DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &name); free(client->name); - client->name = strdup(name); + + /* Treat empty string the same as omitting since there is no point on + * adding a empty name as AD data as it just take space that could be + * used for something else. + */ + if (name[0] != '\0') + client->name = strdup(name); + else + client->name = NULL; return true; } -- 2.35.1