netlink: Add flag to suppress print of nlmsg error
Allow callers of the dump API to handle nlmsg errors (e.g., an unsupported feature). Setting RTNL_HANDLE_F_SUPPRESS_NLERR in the rtnl_handle avoids unnecessary messages to the users in some case. For example, RTNETLINK answers: Operation not supported when probing for support of a new feature. Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
This commit is contained in:
parent
dfb60ddd29
commit
3ad6d17638
|
|
@ -21,6 +21,7 @@ struct rtnl_handle {
|
|||
int proto;
|
||||
FILE *dump_fp;
|
||||
#define RTNL_HANDLE_F_LISTEN_ALL_NSID 0x01
|
||||
#define RTNL_HANDLE_F_SUPPRESS_NLERR 0x02
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,8 @@ static void rtnl_dump_error(const struct rtnl_handle *rth,
|
|||
errno == EOPNOTSUPP))
|
||||
return;
|
||||
|
||||
perror("RTNETLINK answers");
|
||||
if (!(rth->flags & RTNL_HANDLE_F_SUPPRESS_NLERR))
|
||||
perror("RTNETLINK answers");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue