From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8480633 for ; Fri, 19 May 2023 03:54:11 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0C510DD for ; Thu, 18 May 2023 20:54:08 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4E90E5C01AE; Thu, 18 May 2023 23:54:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 18 May 2023 23:54:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikishkin.pw; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1684468447; x=1684554847; bh=um SjgA4XUoB88WswBJFEy3EA9InqSo7y9pwlJc8Cz04=; b=L14lKNKLrRTbzWwmJ/ iYWKHyQ4VvJA0Cn5U8mcLPbygcr0ASqvUhzc2B/YAbMcJKx5Tw3P9f2b8QWZBdED 48mJTVSJqpxd5SS32sdbaQcGUQtnPTVYNmj5V8cS6Fu20JbC1xmFrEFjlpYrgz3Z 45o/O4CNI9lAcwUDPCYKpxx+qRY1qwPfxXnpl3J0l+3d+0vq3Aq4vEdsFlRACLGZ WhrT3XIctAS/5g1mGWNgOmQVNGEzeTO8NqEq5610Kj1uqrUBPAgHCmeZ0nGsY363 62p4MaCc80y3C8SRwXmLJYZzVC7oLBgFWv1EK3OBMcDCF2h/CDETbLUYrcrNKk4X Jg3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684468447; x=1684554847; bh=umSjgA4XUoB88 WswBJFEy3EA9InqSo7y9pwlJc8Cz04=; b=XzCqp2RKRojbMBhZYnkJbKkMhAWDJ wFubKH8+F9dTpc1/AmU1Ega4VQiwdg77yTBC+C3fA9wtovPTpJrvNLQmDJtrNgRF nRVljaOZ4hPEtjDfWAeFz0hfrwH8vxmYmDfD08/jNtBH8UfbFroUUSmoCyl1Cfc/ D0wqgu1+80Vz7F/S7bY4z2R2LZn9Xi1IMr1q6yLK1nuEReleVxn4wMqP3DhXGd7U oK7KvPAfVDgLDc84TnR4zBKf9KfSmygLceEv6iKnZK9b/hjfqupSEl1kGU/zYIJk sp1IlrrihgiOC/6rukkf+TvfI1TWNyoZjmS5pNejPj6Sm8gwc4eZyjJpw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeigedgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdluddtmdenucfjughrpehffgfhvfevufffjgfkgggtsehttdertddt redtnecuhfhrohhmpegglhgrughimhhirhcupfhikhhishhhkhhinhcuoehvlhgrughimh hirhesnhhikhhishhhkhhinhdrphifqeenucggtffrrghtthgvrhhnpeeigfdvgeeiieel udehueeuueejieeiheegudevhffggeeguddvveduueehueefgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvlhgrughimhhirhesnhhikhhi shhhkhhinhdrphif X-ME-Proxy: Feedback-ID: id3b446c5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 May 2023 23:54:03 -0400 (EDT) References: <20230518134601.17873-1-vladimir@nikishkin.pw> <20230518084908.7c0e14d4@hermes.local> User-agent: mu4e 1.8.14; emacs 30.0.50 From: Vladimir Nikishkin To: Stephen Hemminger Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, eng.alaamohamedsoliman.am@gmail.com, gnault@redhat.com, razor@blackwall.org, idosch@nvidia.com, liuhangbin@gmail.com, eyal.birger@gmail.com, jtoppins@redhat.com Subject: Re: [PATCH iproute2-next v4] ip-link: add support for nolocalbypass in vxlan Date: Fri, 19 May 2023 11:50:03 +0800 In-reply-to: <20230518084908.7c0e14d4@hermes.local> Message-ID: <87cz2xt1rb.fsf@laptop.lockywolf.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Stephen Hemminger writes: > On Thu, 18 May 2023 21:46:01 +0800 > Vladimir Nikishkin wrote: > >> + if (tb[IFLA_VXLAN_LOCALBYPASS]) { >> + __u8 localbypass = rta_getattr_u8(tb[IFLA_VXLAN_LOCALBYPASS]); >> + >> + print_bool(PRINT_JSON, "localbypass", NULL, localbypass); >> + if (localbypass) { >> + print_string(PRINT_FP, NULL, "localbypass ", NULL); >> + } else { >> + print_string(PRINT_FP, NULL, "nolocalbypass ", NULL); >> + } >> + } > > You don't have to print anything if nolocalbypass. Use presence as > a boolean in JSON. > > I.e. > if (tb[IFLA_VXLAN_LOCALBYPASS] && > rta_getattr_u8(tb[IFLA_VXLAN_LOCALBYPASS])) { > print_bool(PRINT_ANY, "localbypass", "localbypass", true); > } > > That is what other options do. > Follows the best practices for changes to existing programs: your > new feature should look like all the others. Sorry, I do not understand. I intended to do exactly that, and I copied and adjusted for the option name the code currently used for the "udpcsum" option. Which is exactly if (is_json_context()) { print_bool(PRINT_ANY, "udp_csum", NULL, udp_csum); } else { if (!udp_csum) fputs("no", f); fputs("udpcsum ", f); } I just replaced that option name with [no]localbypass. Fairly straightforward, prints noudpcsum or udpcsum. Later Andrea C Then Andrea Claudi suggested that print_bool knows about the json context itself, so the outer check is not needed, so I removed that. But the "model option" I used (really the simplest one), does have output both when set to true, and when set to false. I have neither an opinion on this nor an understanding what is better for scripting. But I do not understand the suggestion "do like the other options do", when seemingly, other options do what I suggest in the first place. -- Your sincerely, Vladimir Nikishkin (MiEr, lockywolf) (Laptop) -- Fastmail.