[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 18 Nov 2015 10:52:09 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: netdev@...r.kernel.org
Cc: edumazet@...gle.com, ek@...gle.com, maze@...gle.com,
dtor@...gle.com, Lorenzo Colitti <lorenzo@...gle.com>
Subject: [ss PATCH 1/2] libnetlink: ignore some errors from SOCK_DIAG_BY_FAMILY
rtnl_dump ignors ENOENT or EOPNOTSUPP when attempting
SOCK_DIAG_BY_FAMILY dumps. Do the same in rtnl_talk.
Signed-off-by: Lorenzo Colitti <lorenzo@...gle.com>
---
include/libnetlink.h | 3 +++
lib/libnetlink.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 2280c39..9855fd5 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -65,6 +65,9 @@ struct rtnl_dump_filter_arg
int rtnl_dump_filter_l(struct rtnl_handle *rth,
const struct rtnl_dump_filter_arg *arg);
int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter, void *arg);
+int rtnl_talk_l(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+ struct nlmsghdr *answer, size_t len, int expect_success)
+ __attribute__((warn_unused_result));
int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
struct nlmsghdr *answer, size_t len)
__attribute__((warn_unused_result));
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 09b0e91..7e768a6 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -417,6 +417,11 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
return 0;
}
+ if (rtnl->proto == NETLINK_SOCK_DIAG &&
+ (errno == ENOENT ||
+ errno == EOPNOTSUPP))
+ return -1;
+
fprintf(stderr, "RTNETLINK answers: %s\n",
strerror(-err->error));
errno = -err->error;
--
2.6.0.rc2.230.g3dd15c0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists