From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <shemming@brocade.com>
Cc: netdev@vger.kernel.org
Subject: [iproute PATCH v2 3/6] libnetlink: introduce nc_flags
Date: Sun, 8 Nov 2015 21:22:18 +0100 [thread overview]
Message-ID: <1447014141-3565-4-git-send-email-phil@nwl.cc> (raw)
In-Reply-To: <1447014141-3565-1-git-send-email-phil@nwl.cc>
Allow for a filter to ignore certain nlmsg_flags.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changed since v1:
- Fix typo in #define of rtnl_dump_filter().
include/libnetlink.h | 7 ++++++-
lib/libnetlink.c | 10 ++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 2280c39..431189e 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -60,11 +60,16 @@ struct rtnl_dump_filter_arg
{
rtnl_filter_t filter;
void *arg1;
+ __u16 nc_flags;
};
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_dump_filter_nc(struct rtnl_handle *rth,
+ rtnl_filter_t filter,
+ void *arg, __u16 nc_flags);
+#define rtnl_dump_filter(rth, filter, arg) \
+ rtnl_dump_filter_nc(rth, filter, arg, 0)
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..922ec2d 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -259,6 +259,8 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
while (NLMSG_OK(h, msglen)) {
int err = 0;
+ h->nlmsg_flags &= ~a->nc_flags;
+
if (nladdr.nl_pid != 0 ||
h->nlmsg_pid != rth->local.nl_pid ||
h->nlmsg_seq != rth->dump)
@@ -317,13 +319,13 @@ skip_it:
}
}
-int rtnl_dump_filter(struct rtnl_handle *rth,
+int rtnl_dump_filter_nc(struct rtnl_handle *rth,
rtnl_filter_t filter,
- void *arg1)
+ void *arg1, __u16 nc_flags)
{
const struct rtnl_dump_filter_arg a[2] = {
- { .filter = filter, .arg1 = arg1, },
- { .filter = NULL, .arg1 = NULL, },
+ { .filter = filter, .arg1 = arg1, .nc_flags = nc_flags, },
+ { .filter = NULL, .arg1 = NULL, .nc_flags = 0, },
};
return rtnl_dump_filter_l(rth, a);
--
2.1.2
next prev parent reply other threads:[~2015-11-08 20:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-08 19:21 [iproute PATCH 0/6] flush many addresses and some cleanups Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 1/6] ipaddress: make flush command more error-tolerant Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 2/6] ipaddress: simplify ipaddr_flush() Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 3/6] libnetlink: introduce nc_flags Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 4/6] ipaddress: fix ipaddr_flush for Linux >= 3.1 Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 5/6] ipaddress: drop unnecessary check in ipaddr_list_flush_or_save() Phil Sutter
2015-11-08 19:21 ` [iproute PATCH 6/6] iptoken: simplify iptoken_list a bit Phil Sutter
2015-11-08 20:22 ` [iproute PATCH v2 0/6] flush many addresses and some cleanups Phil Sutter
2015-11-08 20:22 ` [iproute PATCH v2 1/6] ipaddress: make flush command more error-tolerant Phil Sutter
2015-11-24 0:31 ` Stephen Hemminger
2015-11-24 14:30 ` [iproute PATCH v3 0/5] flush many addresses and some cleanups Phil Sutter
2015-11-24 14:31 ` [iproute PATCH v3 1/5] ipaddress: simplify ipaddr_flush() Phil Sutter
2015-11-24 14:31 ` [iproute PATCH v3 2/5] libnetlink: introduce nc_flags Phil Sutter
2015-11-24 14:31 ` [iproute PATCH v3 3/5] ipaddress: fix ipaddr_flush for Linux >= 3.1 Phil Sutter
2015-11-25 13:36 ` Sergei Shtylyov
2015-11-25 14:32 ` Phil Sutter
2015-11-25 14:40 ` Sergei Shtylyov
2015-11-24 14:31 ` [iproute PATCH v3 4/5] ipaddress: drop unnecessary check in ipaddr_list_flush_or_save() Phil Sutter
2015-11-24 14:31 ` [iproute PATCH v3 5/5] iptoken: simplify iptoken_list a bit Phil Sutter
2015-11-29 19:50 ` [iproute PATCH v3 0/5] flush many addresses and some cleanups Stephen Hemminger
2015-11-08 20:22 ` [iproute PATCH v2 2/6] ipaddress: simplify ipaddr_flush() Phil Sutter
2015-11-08 20:22 ` Phil Sutter [this message]
2015-11-08 20:22 ` [iproute PATCH v2 4/6] ipaddress: fix ipaddr_flush for Linux >= 3.1 Phil Sutter
2015-11-09 18:51 ` Sergei Shtylyov
2015-11-09 18:58 ` Sergei Shtylyov
2015-11-10 11:21 ` Phil Sutter
2015-11-08 20:22 ` [iproute PATCH v2 5/6] ipaddress: drop unnecessary check in ipaddr_list_flush_or_save() Phil Sutter
2015-11-08 20:22 ` [iproute PATCH v2 6/6] iptoken: simplify iptoken_list a bit Phil Sutter
2015-11-11 11:03 ` Daniel Borkmann
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=1447014141-3565-4-git-send-email-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netdev@vger.kernel.org \
--cc=shemming@brocade.com \
/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).