From: Ido Schimmel <idosch@idosch.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Guillaume Nault <gnault@redhat.com>,
David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCHv3 iproute2-next] rtnetlink: add new function rtnl_echo_talk()
Date: Tue, 8 Nov 2022 10:40:45 +0200 [thread overview]
Message-ID: <Y2oWDRIIR6gjkM4a@shredder> (raw)
In-Reply-To: <20220929081016.479323-1-liuhangbin@gmail.com>
On Thu, Sep 29, 2022 at 04:10:16PM +0800, Hangbin Liu wrote:
> diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
> index 59f8f2fb..c87e847f 100644
> --- a/ip/ipnexthop.c
> +++ b/ip/ipnexthop.c
> @@ -919,12 +919,7 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
> .n.nlmsg_type = cmd,
> .nhm.nh_family = preferred_family,
> };
> - struct nlmsghdr *answer;
> __u32 nh_flags = 0;
> - int ret;
> -
> - if (echo_request)
> - req.n.nlmsg_flags |= NLM_F_ECHO | NLM_F_ACK;
>
> while (argc > 0) {
> if (!strcmp(*argv, "id")) {
> @@ -1005,23 +1000,9 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
> req.nhm.nh_flags = nh_flags;
>
> if (echo_request)
> - ret = rtnl_talk(&rth, &req.n, &answer);
> - else
> - ret = rtnl_talk(&rth, &req.n, NULL);
> -
> - if (ret < 0)
> - return -2;
> + return rtnl_echo_talk(&rth, &req.n, json, print_nexthop_nocache);
>
> - if (echo_request) {
> - new_json_obj(json);
> - open_json_object(NULL);
> - print_nexthop_nocache(answer, (void *)stdout);
> - close_json_object();
> - delete_json_obj();
> - free(answer);
> - }
> -
> - return 0;
> + return rtnl_talk(&rth, &req.n, NULL);
> }
Hangbin,
This change breaks the nexthop selftest:
tools/testing/selftests/net/fib_nexthops.sh
Which is specifically checking for "2" as the error code. Example:
# attempt to create nh without a device or gw - fails
run_cmd "$IP nexthop add id 1"
log_test $? 2 "Nexthop with no device or gateway"
I think it's better to restore the original error code than "fixing" all
the tests / applications that rely on it.
The return code of other subcommands was also changed by this patch, but
so far all the failures I have seen are related to "nexthop" subcommand.
Thanks
next prev parent reply other threads:[~2022-11-08 8:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 8:10 [PATCHv3 iproute2-next] rtnetlink: add new function rtnl_echo_talk() Hangbin Liu
2022-09-29 15:10 ` patchwork-bot+netdevbpf
2022-11-08 8:40 ` Ido Schimmel [this message]
2022-11-08 9:09 ` Hangbin Liu
2022-11-08 9:40 ` Ido Schimmel
2022-11-08 12:43 ` Hangbin Liu
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=Y2oWDRIIR6gjkM4a@shredder \
--to=idosch@idosch.org \
--cc=dsahern@kernel.org \
--cc=gnault@redhat.com \
--cc=liuhangbin@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).