From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCHv4 net-next 02/14] net: sched: sch_api: handle generic qdisc errors Date: Tue, 26 Dec 2017 12:53:09 +0100 Message-ID: <20171226115309.GC2173@nanopsycho> References: <20171220173524.25874-1-aring@mojatatu.com> <20171220173524.25874-3-aring@mojatatu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, netdev@vger.kernel.org, kernel@mojatatu.com, David Ahern To: Alexander Aring Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:45356 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbdLZLxV (ORCPT ); Tue, 26 Dec 2017 06:53:21 -0500 Received: by mail-wm0-f67.google.com with SMTP id 9so34733169wme.4 for ; Tue, 26 Dec 2017 03:53:20 -0800 (PST) Content-Disposition: inline In-Reply-To: <20171220173524.25874-3-aring@mojatatu.com> Sender: netdev-owner@vger.kernel.org List-ID: Wed, Dec 20, 2017 at 06:35:12PM CET, aring@mojatatu.com wrote: >This patch adds extack support for generic qdisc handling. The extack >will be set deeper to each called function which is not part of netdev >core api. > >Cc: David Ahern >Acked-by: Jamal Hadi Salim >Signed-off-by: Alexander Aring >--- [...] >@@ -1349,21 +1387,33 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, > > if (!q || !tcm->tcm_handle || q->handle != tcm->tcm_handle) { > if (tcm->tcm_handle) { >- if (q && !(n->nlmsg_flags & NLM_F_REPLACE)) >+ if (q && !(n->nlmsg_flags & NLM_F_REPLACE)) { >+ NL_SET_ERR_MSG(extack, "NLM_F_REPLACE needed to override"); > return -EEXIST; >- if (TC_H_MIN(tcm->tcm_handle)) >+ } >+ if (TC_H_MIN(tcm->tcm_handle)) { >+ NL_SET_ERR_MSG(extack, "Invalid minor handle"); > return -EINVAL; >+ } > q = qdisc_lookup(dev, tcm->tcm_handle); >- if (!q) >+ if (!q) { >+ NL_SET_ERR_MSG(extack, "No qdisc found for specified handle"); This is incorrect. This is hit on successpath as well, confusing user with the message. I will send fix shortly. > goto create_n_graft; >- if (n->nlmsg_flags & NLM_F_EXCL) >+ }