Thread (74 messages) 74 messages, 6 authors, 2019-07-10

Re: [PATCH net-next v6 05/15] ethtool: helper functions for netlink interface

From: Michal Kubecek <hidden>
Date: 2019-07-03 07:23:30
Also in: lkml

On Tue, Jul 02, 2019 at 06:37:24PM -0700, Jakub Kicinski wrote:
On Tue,  2 Jul 2019 13:50:04 +0200 (CEST), Michal Kubecek wrote:
quoted
Add common request/reply header definition and helpers to parse request
header and fill reply header. Provide ethnl_update_* helpers to update
structure members from request attributes (to be used for *_SET requests).

Signed-off-by: Michal Kubecek <redacted>
quoted
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 3c98b41f04e5..e13f29bbd625 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -1,8 +1,181 @@
 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 
+#include <net/sock.h>
 #include <linux/ethtool_netlink.h>
 #include "netlink.h"
 
+static struct genl_family ethtool_genl_family;
+
+static const struct nla_policy dflt_header_policy[ETHTOOL_A_HEADER_MAX + 1] = {
+	[ETHTOOL_A_HEADER_UNSPEC]	= { .type = NLA_REJECT },
I think we want strict checking on all new netlink interfaces, and
unfortunately that feature is opt-in.. so you need to add:

	.strict_start_type = ETHTOOL_A_HEADER_UNSPEC + 1

To the first attr.
Oops... I'll have to check again how this works. I thought using
nla_parse_nested() instead of nla_parse_nested_deprecated() is
sufficient to have everything strict checked.

Michal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help