From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3C3ED3C685 for ; Mon, 13 Nov 2023 22:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dqz8r4KO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B0AEC433C7; Mon, 13 Nov 2023 22:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699915099; bh=FGsv7wdXiQu6Iku/2xGrGpaJYro5jFVKqvwxloDF4qk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Dqz8r4KOXJO7ioJ0Oww+RFpXkPQA9G/1IJBJ4RNT9gw7tQhCP+3cxeGRkP/c9z8Q3 rObwpp4LQqBjWfP13VfknEbzcwKDua/LRRplbQn9zkxUe6oDwGPbXbe6YKsFEGGHXn ZCbvI+UtsuNsImVwf5rXQPo5WX0//LHKJOjXitMPwdtJU2ABxtfAosLZbnWmCfS2bj mZ2T2qCFDWaNMAUAjimjHQYo7FFL4lry2szcGldpzEFm2Qk88qrwwV6rDOM21HPcEZ /g2HA9iHpFVRR5o25GfY8PIaPddQdKr8xUsLzMBHeMzmPm428/ZOvQ8qUuQF3uyGaD 0AZAO+IH62w6A== Message-ID: Date: Mon, 13 Nov 2023 15:38:18 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH iproute2] ip, link: Add support for netkit Content-Language: en-US To: Stephen Hemminger , Daniel Borkmann Cc: razor@blackwall.org, martin.lau@kernel.org, netdev@vger.kernel.org References: <20231113032323.14717-1-daniel@iogearbox.net> <20231113093429.434186eb@hermes.local> From: David Ahern In-Reply-To: <20231113093429.434186eb@hermes.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/13/23 10:34 AM, Stephen Hemminger wrote: > On Mon, 13 Nov 2023 04:23:23 +0100 > Daniel Borkmann wrote: > >> + if (tb[IFLA_NETKIT_POLICY]) { >> + __u32 policy = rta_getattr_u32(tb[IFLA_NETKIT_POLICY]); >> + const char *policy_str = >> + policy == NETKIT_PASS ? "forward" : >> + policy == NETKIT_DROP ? "blackhole" : "unknown"; >> + > > If you plan to add more modes in future, a table or helper would be good idea. > I would prefer a table driven approach through a helper than the multi-line logic here.