From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Benc Subject: Re: [PATCH RFC v2 net-next 03/25] netlink: introduce NLM_F_DUMP_PROPER_HDR flag Date: Tue, 2 Oct 2018 13:06:14 +0200 Message-ID: <20181002130614.77856ff8@redhat.com> References: <20181002002851.5002-1-dsahern@kernel.org> <20181002002851.5002-4-dsahern@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, davem@davemloft.net, christian@brauner.io, stephen@networkplumber.org, David Ahern To: David Ahern Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49314 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbeJBRtG (ORCPT ); Tue, 2 Oct 2018 13:49:06 -0400 In-Reply-To: <20181002002851.5002-4-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 1 Oct 2018 17:28:29 -0700, David Ahern wrote: > Add a new flag, NLM_F_DUMP_PROPER_HDR, for userspace to indicate to the > kernel that it believes it is sending the right header struct for the > dump message type (ifinfomsg, ifaddrmsg, rtmsg, fib_rule_hdr, ...). Why is this limited to dumps? Other kind of netlink messages contain the common struct, too. When introducing such mechanism, please make it generic. Last time when we were discussing strict checking in netlink, it was suggested to add a socket option instead of adding NLM flags[1]. It makes a lot of sense: the number of flags is very limited and we'd run out of them pretty fast. It's not just the header structure that is currently checked sloppily. It's also attributes, flags in attributes, etc. We can't assign a flag to all of them. You should also consider a different name for the flag: it should reflect what the effect of the flag is. "Proper header" is not an effect, it's a requirement for the message to pass. The effect is enforced strict checking of the header. Jiri [1] https://marc.info/?l=linux-netdev&m=144492718118955