Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp409464pxp; Wed, 16 Mar 2022 08:13:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo6FZZfGqwA5Bo76XnZq3kJhOMjgJRJOkSMWO0tksNoPr2DKz7MAarCAgzqSkp0qY6ai14 X-Received: by 2002:a05:6a00:1ac7:b0:4f7:442d:a5cb with SMTP id f7-20020a056a001ac700b004f7442da5cbmr359777pfv.42.1647443633174; Wed, 16 Mar 2022 08:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647443633; cv=none; d=google.com; s=arc-20160816; b=l6FF+qbwoK32EdbY2xx0t5DzotRm45gWkTfjlM8he+fKeJ/CZGXWNIDC/iwiXdQP61 zGWWJ5sHnbB2Robwrq2ou3NZGKBUSHk2HYWu96yh4iW/xuLMKA2qMZkJKhZJ4c1dCXk3 wLNTx+F+mYIIo/1sSeXdj/9u+8kp9sWwvgOgijFo9/EnivplKxdRB2DXzMlII+zHGt5q KAOxDK93eaeRfKV3zDoMoRIj/l/H2y0r2Xeb+Ye6fIkg5r6ZBX4CFZMA659Fzg+6wP8D 2g3uVqciPTHBZOFZY0FZDWs2CbvBH1flwkSuqK7s9optlf3O5eynCR5Hk1oTWryMkUb+ QpcQ== 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 :user-agent:references:in-reply-to:date:to:from:subject:message-id :dkim-signature; bh=OEI24XL99P4h/59hQGCvtYQwH41FrBPjviFy7mCJix0=; b=v0wnsmfIpDEh+dOymUSvlSURk6TNe2KDR/Pcx7dmWKJMQXEc85VCD2s7HGDH4hdVeV s6eLVwUFfqLG3z46y+Ee5d8vUyMBOR7ugA5lQPxrPPlSCAAwfOZ67l9HDRmlpvtkk5OQ m16pLl7N2pssPxKzKgk07OWF7cwr190Yiz7FNnoSfxTwl823WhxG9sIoxxVl2CcXlW3g OdmxHvtNN5RwqKHJPhubITop1CiigUGQ5RxPYtUjwjBScC0pDecJHNN4f+HyKqYe7q4C NhvYd9Fw43RvBRMLPRXkRQ0jsaIlK3Sfd0lvPdKPFdgb8jR29HVUT6e7nzOYjwMnFJIz j1Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=fWBModca; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w130-20020a627b88000000b004fa11ee5f2bsi2048194pfc.245.2022.03.16.08.13.40; Wed, 16 Mar 2022 08:13:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@sipsolutions.net header.s=mail header.b=fWBModca; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355144AbiCPKbT (ORCPT + 70 others); Wed, 16 Mar 2022 06:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243190AbiCPKbT (ORCPT ); Wed, 16 Mar 2022 06:31:19 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000D45D5DD for ; Wed, 16 Mar 2022 03:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:To:From:Subject:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=OEI24XL99P4h/59hQGCvtYQwH41FrBPjviFy7mCJix0=; t=1647426604; x=1648636204; b=fWBModcayd9Nr/RMrqFM9CAXS2hJzjh0yZACiZ7DV1YuiQ0 N15ZsbDpB5csR/K1qM77E/dqtw6CpY9r/NLQLal0u86X/iMKPg0iSGexjtD4TvcHhmz8rofdmSGRL loF8I3wPvv1pH3UKFDISUDRhMtAqdKYhT0nbPECxVZNbWbo0OeP+MxuLUPm5CQMeI3oyN1ZFAjjPl y733t3s/lAVyFbDPzmuSqEYBUlNdTUARP7WO+MTsC3RbsQzIMSdQCK2oAEqDUXPL4/Y9WVp8pdcGG GRhN9Ds2SpKx/SygvMHA42d6zGEglBiJUNWXDvP27Q9Mol++vjpCxveNIwImqK4g==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nUQum-00DvkS-DI; Wed, 16 Mar 2022 11:30:00 +0100 Message-ID: <520961736af888cabdd106c7d86ee2153fea77f5.camel@sipsolutions.net> Subject: Re: [PATCH] rfkill: keep rfkill event compatibility with old userspace applications From: Johannes Berg To: Jose Ignacio Tornos Martinez , linux-wireless@vger.kernel.org Date: Wed, 16 Mar 2022 11:29:59 +0100 In-Reply-To: <20220315124811.237037-1-jtornosm@redhat.com> References: <20220315124811.237037-1-jtornosm@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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-wireless@vger.kernel.org Hi, It'd be nicer if you were to actually reply in the thread. Now I even have to copy/paste because you put everything into the signature :( Don't make it so hard to interact! > > On Tue, 2022-03-15 at 11:26 +0100, Jose Ignacio Tornos Martinez wrote: > > > Old userspace applications (for example bluez version before c939747f543a), > > > that still use the original format for rfkill events (with 8 bytes size / > > > RFKILL_EVENT_SIZE_V1) and are not requesting any specific size but a large > > > one, are broken because they are checking the received size. > > > > ... because they're *not* checking the received size. > > > I really wanted to say "because they're checking the received size", that is, > because older bluez is expecting 8, and as bluez bluez is receiving 9, it was > rejecting the event, and therefore it is broken. Well, ok, then "because they're incorrectly checking the received size". > I tested g-s-d without their fixes and it keeps on working fine because > although the message was buffered, it took 8 byte event size and when it read > immediately again, it got another message with 1 byte that was rejected (8 > bytes expected size) and this way exit from the loop. Not sure that's how it works? Before the fixes there in g-s-d, it would have accumulated the extra bytes until they were 8 bytes and a new message was formed, or something like that, no? Anyway, you can still argue we broke it by changing the size. > Yes I agree with you, it would be enough and easy to always send the 8 > bytes > events from the kernel as before (at least for RHEL). > But, I am just trying to do it in a more compatible way, because as > you said > we do not know the behavior of all applications using the rfkill. But you're doing it *less* compatible. If you want to be perfectly compatible, you have to revert the entire new event size. You're just hacking around the edges to make the two broken cases you found work. I really don't think that's a good idea. At the time, I was tempted to add an ioctl, so you'd have to do ioctl(fd, RFKILL_I_READ_THE_DOCS_ABOUT_STRUCT_SIZES, RFKILL_AND_I_PROMISE_TO_READ_NON_STREAMING); to get extended messages out at all ... Maybe should've done that. Right now, nobody really has to care about the extra field at all anyway. But honestly, compared to fixing two or three userspace applications (bluez and g-s-d, systemd just had an API not ABI issue that we could work around) seemed simpler? johannes