All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: christian@brauner.io, jbenc@redhat.com,
	stephen@networkplumber.org, David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 03/20] net: Add extack to nlmsg_parse
Date: Thu,  4 Oct 2018 14:33:38 -0700	[thread overview]
Message-ID: <20181004213355.14899-4-dsahern@kernel.org> (raw)
In-Reply-To: <20181004213355.14899-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Make sure extack is passed to nlmsg_parse where easy to do so.
Most of these are dump handlers and leveraging the extack in
the netlink_callback.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 net/core/devlink.c             | 2 +-
 net/core/neighbour.c           | 3 ++-
 net/core/rtnetlink.c           | 4 ++--
 net/ipv4/devinet.c             | 9 +++++----
 net/ipv6/addrconf.c            | 2 +-
 net/ipv6/route.c               | 2 +-
 net/mpls/af_mpls.c             | 2 +-
 net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
 net/sched/act_api.c            | 2 +-
 net/sched/cls_api.c            | 6 ++++--
 net/sched/sch_api.c            | 3 ++-
 net/xfrm/xfrm_user.c           | 2 +-
 12 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index de6adad7ccbe..b207ba1188e2 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3489,7 +3489,7 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
 	start_offset = *((u64 *)&cb->args[0]);
 
 	err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize,
-			  attrs, DEVLINK_ATTR_MAX, ops->policy, NULL);
+			  attrs, DEVLINK_ATTR_MAX, ops->policy, cb->extack);
 	if (err)
 		goto out;
 
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index fb023df48b83..b06f794bf91e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2445,7 +2445,8 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
 	    ((struct ndmsg *)nlmsg_data(nlh))->ndm_flags == NTF_PROXY)
 		proxy = 1;
 
-	err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, NULL, NULL);
+	err = nlmsg_parse(nlh, sizeof(struct ndmsg), tb, NDA_MAX, NULL,
+			  cb->extack);
 	if (!err) {
 		if (tb[NDA_IFINDEX]) {
 			if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32))
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 57bf96d73e3b..c3b434d724ea 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1909,7 +1909,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
 		 sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg);
 
 	if (nlmsg_parse(cb->nlh, hdrlen, tb, IFLA_MAX,
-			ifla_policy, NULL) >= 0) {
+			ifla_policy, cb->extack) >= 0) {
 		if (tb[IFLA_TARGET_NETNSID]) {
 			netnsid = nla_get_s32(tb[IFLA_TARGET_NETNSID]);
 			tgt_net = rtnl_get_net_ns_capable(skb->sk, netnsid);
@@ -3764,7 +3764,7 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
 	int fidx = 0;
 
 	err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
-			  IFLA_MAX, ifla_policy, NULL);
+			  IFLA_MAX, ifla_policy, cb->extack);
 	if (err < 0) {
 		return -EINVAL;
 	} else if (err == 0) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 44d931a3cd50..ab2b11df5ea4 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -782,7 +782,8 @@ static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft,
 }
 
 static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
-				       __u32 *pvalid_lft, __u32 *pprefered_lft)
+				       __u32 *pvalid_lft, __u32 *pprefered_lft,
+				       struct netlink_ext_ack *extack)
 {
 	struct nlattr *tb[IFA_MAX+1];
 	struct in_ifaddr *ifa;
@@ -792,7 +793,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
 	int err;
 
 	err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy,
-			  NULL);
+			  extack);
 	if (err < 0)
 		goto errout;
 
@@ -897,7 +898,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	ASSERT_RTNL();
 
-	ifa = rtm_to_ifaddr(net, nlh, &valid_lft, &prefered_lft);
+	ifa = rtm_to_ifaddr(net, nlh, &valid_lft, &prefered_lft, extack);
 	if (IS_ERR(ifa))
 		return PTR_ERR(ifa);
 
@@ -1684,7 +1685,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
 	s_ip_idx = ip_idx = cb->args[2];
 
 	if (nlmsg_parse(cb->nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,
-			ifa_ipv4_policy, NULL) >= 0) {
+			ifa_ipv4_policy, cb->extack) >= 0) {
 		if (tb[IFA_TARGET_NETNSID]) {
 			fillargs.netnsid = nla_get_s32(tb[IFA_TARGET_NETNSID]);
 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a9a317322388..2f8aa4fd5e55 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5021,7 +5021,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
 	s_ip_idx = ip_idx = cb->args[2];
 
 	if (nlmsg_parse(cb->nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,
-			ifa_ipv6_policy, NULL) >= 0) {
+			ifa_ipv6_policy, cb->extack) >= 0) {
 		if (tb[IFA_TARGET_NETNSID]) {
 			netnsid = nla_get_s32(tb[IFA_TARGET_NETNSID]);
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3adf107b42d2..64ae1e383030 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4137,7 +4137,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
 	int err;
 
 	err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy,
-			  NULL);
+			  extack);
 	if (err < 0)
 		goto errout;
 
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 8fbe6cdbe255..55a30ee3d820 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1223,7 +1223,7 @@ static int mpls_netconf_get_devconf(struct sk_buff *in_skb,
 	int err;
 
 	err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX,
-			  devconf_mpls_policy, NULL);
+			  devconf_mpls_policy, extack);
 	if (err < 0)
 		goto errout;
 
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 62eefea48973..83395bf6dc35 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3234,7 +3234,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,
 
 	/* Try to find the service for which to dump destinations */
 	if (nlmsg_parse(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX,
-			ip_vs_cmd_policy, NULL))
+			ip_vs_cmd_policy, cb->extack))
 		goto out_err;
 
 
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 3c7c23421885..5764e1af2ef9 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1452,7 +1452,7 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
 	u32 act_count = 0;
 
 	ret = nlmsg_parse(cb->nlh, sizeof(struct tcamsg), tb, TCA_ROOT_MAX,
-			  tcaa_policy, NULL);
+			  tcaa_policy, cb->extack);
 	if (ret < 0)
 		return ret;
 
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index d670d3066ebd..43c8559aca56 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1727,7 +1727,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
 	if (nlmsg_len(cb->nlh) < sizeof(*tcm))
 		return skb->len;
 
-	err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
+	err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL,
+			  cb->extack);
 	if (err)
 		return err;
 
@@ -2054,7 +2055,8 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
 	if (nlmsg_len(cb->nlh) < sizeof(*tcm))
 		return skb->len;
 
-	err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
+	err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL,
+			  cb->extack);
 	if (err)
 		return err;
 
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 22e9799e5b69..121454f15f0f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1656,7 +1656,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
 	idx = 0;
 	ASSERT_RTNL();
 
-	err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL, NULL);
+	err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL,
+			  cb->extack);
 	if (err < 0)
 		return err;
 
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index df7ca2dabc48..ca7a207b81a9 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1007,7 +1007,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
 		int err;
 
 		err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, xfrma_policy,
-				  NULL);
+				  cb->extack);
 		if (err < 0)
 			return err;
 
-- 
2.11.0

  parent reply	other threads:[~2018-10-05  4:29 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 21:33 [PATCH net-next 00/20] rtnetlink: Add support for rigid checking of data in dump request David Ahern
2018-10-04 21:33 ` [PATCH net-next 01/20] netlink: Pass extack to dump handlers David Ahern
2018-10-05 17:41   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 02/20] netlink: Add extack message to nlmsg_parse for invalid header length David Ahern
2018-10-05 17:41   ` Christian Brauner
2018-10-04 21:33 ` David Ahern [this message]
2018-10-05 17:39   ` [PATCH net-next 03/20] net: Add extack to nlmsg_parse Christian Brauner
2018-10-05 18:42     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 04/20] net/ipv6: Refactor address dump to push inet6_fill_args to in6_dump_addrs David Ahern
2018-10-04 21:33 ` [PATCH net-next 05/20] netlink: Add new socket option to enable strict checking on dumps David Ahern
2018-10-05 17:36   ` Christian Brauner
2018-10-05 18:43     ` David Ahern
2018-10-05 18:45       ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 06/20] net/ipv4: Update inet_dump_ifaddr for strict data checking David Ahern
2018-10-05 18:02   ` Christian Brauner
2018-10-05 18:48     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 07/20] net/ipv6: Update inet6_dump_addr " David Ahern
2018-10-05 17:53   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 08/20] rtnetlink: Update rtnl_dump_ifinfo " David Ahern
2018-10-05 17:59   ` Christian Brauner
2018-10-05 19:22     ` David Ahern
2018-10-07 10:29       ` Christian Brauner
2018-10-08  1:29         ` David Ahern
2018-10-08  9:47           ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 09/20] rtnetlink: Update rtnl_bridge_getlink " David Ahern
2018-10-07 10:36   ` Christian Brauner
2018-10-08  1:31     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 10/20] rtnetlink: Update rtnl_stats_dump " David Ahern
2018-10-07 10:38   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 11/20] rtnetlink: Update inet6_dump_ifinfo " David Ahern
2018-10-05 17:48   ` Christian Brauner
2018-10-05 17:49     ` Christian Brauner
2018-10-05 19:25     ` David Ahern
2018-10-07 10:25       ` Christian Brauner
2018-10-05 17:54   ` Christian Brauner
2018-10-05 19:26     ` David Ahern
2018-10-07 10:23       ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 12/20] rtnetlink: Update ipmr_rtm_dumplink " David Ahern
2018-10-07 10:40   ` Christian Brauner
2018-10-08  1:32     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 13/20] rtnetlink: Update fib dumps " David Ahern
2018-10-07 10:43   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 14/20] net/neighbor: Update neigh_dump_info " David Ahern
2018-10-07 10:46   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 15/20] net/neighbor: Update neightbl_dump_info " David Ahern
2018-10-07 10:48   ` Christian Brauner
2018-10-08  1:34     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 16/20] net/namespace: Update rtnl_net_dumpid " David Ahern
2018-10-05 17:45   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 17/20] net/fib_rules: Update fib_nl_dumprule " David Ahern
2018-10-07 10:55   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 18/20] net/ipv6: Update ip6addrlbl_dump " David Ahern
2018-10-07 10:54   ` Christian Brauner
2018-10-04 21:33 ` [PATCH net-next 19/20] net: Update netconf dump handlers " David Ahern
2018-10-07 10:53   ` Christian Brauner
2018-10-08  1:38     ` David Ahern
2018-10-04 21:33 ` [PATCH net-next 20/20] net/bridge: Update br_mdb_dump " David Ahern
2018-10-05  7:34   ` David Miller
2018-10-05 15:49     ` David Ahern
2018-10-05 17:28   ` Christian Brauner
2018-10-05 21:18 ` [PATCH net-next 00/20] rtnetlink: Add support for rigid checking of data in dump request David Ahern
2018-10-05 21:58   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181004213355.14899-4-dsahern@kernel.org \
    --to=dsahern@kernel.org \
    --cc=christian@brauner.io \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=jbenc@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.