From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: idosch@mellanox.com, stephen@networkplumber.org,
David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2-next 4/5] libnetlink: Add RTNL_HANDLE_F_STRICT_CHK flag
Date: Wed, 2 Jan 2019 20:38:31 -0800 [thread overview]
Message-ID: <20190103043832.3748-5-dsahern@kernel.org> (raw)
In-Reply-To: <20190103043832.3748-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
Add RTNL_HANDLE_F_STRICT_CHK flag and set in rth flags to let know
commands know if the kernel supports strict checking.
Extracted from patch from Ido to fix filtering with strict checking
enabled.
Cc: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
---
include/libnetlink.h | 1 +
lib/libnetlink.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 148951510d1e..0854d6ad2fab 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -23,6 +23,7 @@ struct rtnl_handle {
FILE *dump_fp;
#define RTNL_HANDLE_F_LISTEN_ALL_NSID 0x01
#define RTNL_HANDLE_F_SUPPRESS_NLERR 0x02
+#define RTNL_HANDLE_F_STRICT_CHK 0x04
int flags;
};
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 19318b445266..600e9a2476ba 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -166,8 +166,11 @@ void rtnl_set_strict_dump(struct rtnl_handle *rth)
{
int one = 1;
- setsockopt(rth->fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK,
- &one, sizeof(one));
+ if (setsockopt(rth->fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK,
+ &one, sizeof(one)) < 0)
+ return;
+
+ rth->flags |= RTNL_HANDLE_F_STRICT_CHK;
}
void rtnl_close(struct rtnl_handle *rth)
--
2.11.0
next prev parent reply other threads:[~2019-01-03 4:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 4:38 [PATCH iproute2-next 0/5] ip bridge: Updates to neigh and fdb dumps David Ahern
2019-01-03 4:38 ` [PATCH iproute2-next 1/5] libnetlink: Add filter function to rtnl_neighdump_req David Ahern
2019-01-03 4:38 ` [PATCH iproute2-next 2/5] ip neigh: Convert do_show_or_flush to use rtnl_neighdump_req David Ahern
2019-01-03 4:38 ` [PATCH iproute2-next 3/5] bridge: Update fdb show " David Ahern
2019-01-03 4:38 ` David Ahern [this message]
2019-01-03 4:38 ` [PATCH iproute2-next 5/5] bridge: fdb: Fix filtering with strict checking disabled David Ahern
2019-01-04 13:45 ` Ido Schimmel
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=20190103043832.3748-5-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=dsahern@gmail.com \
--cc=idosch@mellanox.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).