ip: netconf: fix overzealous error checking
The rtnetlink.sh kernel test started reporting errors after
iproute2 update. The error checking introduced by commit
under fixes is incorrect. rtnl_listen() always returns
an error, because the only way to break the loop is to
return an error from the handler, it seems.
Switch this code to using normal rtnl_talk(), instead of
the rtnl_listen() abuse. As far as I can tell the use of
rtnl_listen() was to make get and dump use common handling
but that's no longer the case, anyway.
Before:
$ ip -6 netconf show dev lo
inet6 lo forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off
$ echo $?
2
After:
$ ./ip/ip -6 netconf show dev lo
inet6 lo forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off
$ echo $?
0
Fixes: 00e8a64dac ("ip: detect errors in netconf monitor mode")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
committed by
Stephen Hemminger
parent
f305296e40
commit
6887a0656d
@@ -187,16 +187,16 @@ static int do_show(int argc, char **argv)
|
||||
ll_init_map(&rth);
|
||||
|
||||
if (filter.ifindex && filter.family != AF_UNSPEC) {
|
||||
struct nlmsghdr *answer;
|
||||
|
||||
req.ncm.ncm_family = filter.family;
|
||||
addattr_l(&req.n, sizeof(req), NETCONFA_IFINDEX,
|
||||
&filter.ifindex, sizeof(filter.ifindex));
|
||||
|
||||
if (rtnl_send(&rth, &req.n, req.n.nlmsg_len) < 0) {
|
||||
perror("Can not send request");
|
||||
exit(1);
|
||||
}
|
||||
if (rtnl_listen(&rth, print_netconf, stdout) < 0)
|
||||
if (rtnl_talk(&rth, &req.n, &answer) < 0)
|
||||
exit(2);
|
||||
|
||||
print_netconf2(answer, stdout);
|
||||
} else {
|
||||
rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
|
||||
dump:
|
||||
|
||||
Reference in New Issue
Block a user